Forum Replies Created
-
AuthorPosts
-
pluginoven
ParticipantAre you testing this in the default language?
Try switching WordPress to another language...
if ( file_exists( RWMB_DIR . "validation/i18n/messages_$locale.js" ) ) {...}
And yes, we have tested both theRWMB_DIRand theRWMB_JS_URLconstants, which is the reason of opening this thread.August 8, 2023 at 4:00 AM in reply to: ✅issue using rwmb_frontend_dashboard_delete_action filter to remove delete icon #42840pluginoven
Participantthe filter function is returning the
$show_deletevar. it was missing in the above example:function fix_frontend_delete_button ( $show_delete, $post_id ){ $post_type = get_post_type( $post_id ); //workplace if ( !current_user_can( 'delete_'.$post_type.'s' ) ) { $show_delete = false; } return $show_delete; }August 7, 2023 at 9:40 PM in reply to: ✅Does MB Front End submission work with User Posts Limit #42829pluginoven
ParticipantFor limiting a user to only create X amount of posts, we are using the mbfs_dashboard_add_new_button filter like so:
add_filter( 'mbfs_dashboard_add_new_button', 'limit_num_of_workplaces', 20, 2 ); function limit_num_of_workplaces( $add_new_button, $atts ) { if( $atts['post_type'] == 'workplace' && current_user_can('some_user_role') ){ //how many workplaces does this user have? (we are limiting to 3) if (count_user_posts( get_current_user_id(), $atts['post_type'], false ) > 2 ){ $add_new_button = ''; //no soup for you! } return $add_new_button; } }June 15, 2023 at 4:33 PM in reply to: Missing filter to allow devs to extend which screens to show on #42220pluginoven
ParticipantI would be delighted to explain, Tran!
The short version is because developers build things beyond the default WordPress setup and want to use this great set of meta box plugins to do so.
We are using WordPress along Meta Box and MB User Profiles to create rapid prototypes that include a large, and very complex set of Forms in the user profile area.So many fields, in fact, they needed to be grouped into Tabs. So Complex, in fact, we quickly outgrew using the MB Tabs extension and started using a very clever plugin called WP-User-Profiles to separate the field groups into Tabs. These tabs and sub-tabs have their own screen id's such as: "admin_page_services" for when the user is viewing a tab called "services" under their own profile and "users_page_services" when an admin is viewing a users's service tab. So far so good? good.
Now, it's not a problem to have the meta-boxes appear in these new tabs in the user profile. we simply assign the post_types attribute when we create the metabox like so:
'type' => 'user', 'post_types' => ['admin_page_service','users_page_service','toplevel_page_service'],The problem, and the reason we have modified the mb-user-profiles plugin--well, actually the mb-user-meta plugin that is included in this plugin--as described above for the last four years is that all scripts that make metabox so nice for users profiles such as the validation, special advanced fields and so on are hard-coded to only be loaded on "user profiles" that have screen ids of:
array( 'profile', 'user-edit', 'profile-network', 'user-edit-network' )Feel free to reach out to me on Github or directly via email if you would like to have a closer look at how we are using your plugins. It's probably one of the more advanced use cases given the number of times pull requests have been submitted when we run into a limitation.
June 14, 2023 at 6:20 PM in reply to: Missing filter to allow devs to extend which screens to show on #42194pluginoven
ParticipantJust a quick update.
While this technically works, keep in mind that the
is_edit_screenfunction will loop for each defined metabox. To make this more efficient, the core plugin'sRW_Meta_Boxclass would need to be modified to allow the $edit_screens to be defined and filtered once then passing this array over, and over and over again to theis_edit_screen_pluginoven
ParticipantAh ha! It's only under the 'Multiple addresses' section that some hint is provided:
'address_field' => 'address_id'So a simplified OSM example would look like this:
$meta_boxes[] = [ 'id' => 'private_details_box', 'title' => 'Private Address', 'type' => 'user', 'geo' => true, // include the geo API 'context' => 'normal', 'priority' => 'high', 'fields' => [ [ 'type' => 'osm', 'name' => 'The Required OSM Map', 'address_field' => 'private_address' // tell the map which field to use ], [ 'type' => 'text', 'name' => 'Private Address', 'id' => 'private_address', // does NOT need to start with address ], [ 'type' => 'text', 'name' => 'Street Address', 'id' => 'private_street_address', 'attributes' => [ 'binding' => 'streetaddress', 'required' => true, ], ], [ 'type' => 'number', 'name' => 'Postal Code', 'id' => 'private_postal_code', 'attributes' => [ 'required' => true, 'binding' => 'postcode' ], ], ] ];pluginoven
ParticipantI totally agree with @digisavvy that the documentation is for Geolocation is confusing. Extremely helpful would be a code example of how Google version with binding is structured and a separate code example for the OSM variant with binding.
Of note: the animated demo of this extension shows the Google version, but the OSM version requires that an OSM map be included in the field group.
pluginoven
ParticipantYes. this is a valid solution.
This issue can be marked as resolved.
Thank you.pluginoven
ParticipantThe suggested modifications to
src/Forms/info.phpare as follows:
1. Add theclass_submitattribute to the $config.$config = shortcode_atts( [ ... // Appearance options. ... 'id_password' => 'user_pass', 'id_password2' => 'user_pass2', 'id_submit' => 'submit', 'class_submit' => '', // Add class_submit attribute ... ], $config );2. add
$this->config['class_submit']to the button class:protected function submit_button() { ?> <div class="rwmb-field rwmb-button-wrapper rwmb-form-submit"> <div class="rwmb-input"> <button type="submit" class="rwmb-button <?= esc_attr( $this->config['class_submit'] ); ?>" id="<?= esc_attr( $this->config['id_submit'] ) ?>" name="rwmb_profile_submit_info" value="1"><?= esc_html( $this->config['label_submit'] ) ?></button> </div> </div> <?php }pluginoven
ParticipantThe CSS workaround would work if I could assign a class to the submit button. Is this possible? An ID can be assigned using the id_submit but then either:
a) custom CSS to hide multiple submit buttons by their unique ID if they exist on the same page would need to be created. or
b) a new id_class attribute would need to be added to the plugin allowing one CSS class definition to be used to hide the submit button.of course, something like id_submit="hidden_submit" could be used in conjunction with a single CSS ID definition, but then, when multiple forms are used on the same page (or in different tabs on the same page), multiple elements with the same ID would exist in the DOM. Not good.
As many times before, I will modify the plugin to get around this issue for the immediate need and would be happy to submit a pull request.
April 26, 2023 at 7:57 PM in reply to: Missing filter to allow devs to extend which screens to show on #41623pluginoven
ParticipantUpdate. Since this plugin actually does include 'mb-user-meta', this is actually exactly the same issue as posted back in 2019. In this case, the file is found under:
vendor > meta-box > mb-user-meta > src > MetaBox.php
The function:public function is_edit_screen( $screen = null ) { if ( ! is_admin() ) { return false; } $screen = get_current_screen(); return in_array( $screen->id, ['profile', 'user-edit', 'profile-network', 'user-edit-network'], true ); }should be updated to:
public function is_edit_screen( $screen = null ) { if ( ! is_admin() ) { return false; } $screen = get_current_screen(); // Allow edit screens to be expanded $edit_screens = apply_filters( 'rwmb_user_edit_screens', [ 'profile', 'user-edit', 'profile-network', 'user-edit-network' ] ); return in_array( $screen->id, $edit_screens, true ); }I see that the array was changed from
array()to[]... yet the filter was not added.pluginoven
ParticipantThere is no option to change this title
Yes there is. This is defined in the file mb-user-profile > src > DefaultFields.php at line 25:
'title' => 'register',
Why this is hardcoded is beyond me.It seems like every post I make ends the same way. Here to, this is true:
@rilwis
I am more than happy to contribute a pull request to either a) Allow the title to be translated:
'title' => __( 'Register', 'mb-user-profile' ),
or allow the title to be filtered / set to blank within the shortcode attributes.pluginoven
ParticipantDecember 14, 2021 at 6:53 PM in reply to: Warning: RWMB_Post_Field::search_by_title() expected to be a reference #32605pluginoven
ParticipantFound the issue:
fields/post.php line 181:
public static function search_by_title( $search, &$wp_query ) {
should be:
public static function search_by_title( $search, $wp_query ) {
remove the & symbol before the variable.
Shall I submit a pull request?December 14, 2021 at 6:26 PM in reply to: Warning: RWMB_Post_Field::search_by_title() expected to be a reference #32603pluginoven
ParticipantUpdate:
The issue appears to be coming from commit e5cb8b9 -
AuthorPosts