Forum Replies Created
-
AuthorPosts
-
John Rood
ParticipantSo we ended up adapting the idea Long gave us in Gravity Forms rather than Meta Box, as we needed to use notifications to notify users when this happened. Basically, we set up a gravity form that was just the submit button and a hidden field. In the hidden field, we used Gravity Forms' Dynamic Population feature to pull in the post ID. Then we used the
gform_after_submissionhook to update the post's status on submit, using the ID as the method of getting the post.This is just a surface level explanation, as our use case is actually a lot more complicated than this, so I can't just post the code.
John Rood
ParticipantWe are also looking for similar functionality and are wondering if there have been any updates on this, or if someone has found their own solution.
John Rood
ParticipantThat works really well for displaying fields with code, I was just wondering if there was some kind of filter that handles when the value is output through Oxygen Builder's Dynamic Data so that I can modify the output with PHP.
Basically I'm just wondering if there's a Meta Box equivalent to ACF's
format_valuefilter.Since (when using the builder) I only have the option to return the field itself, this would be a clean way to handle those fields. I'm just not sure if that's something MB does.
Thanks for all your help,
JohnJohn Rood
ParticipantThat is what we ended up doing. For anyone in the same boat, we ended up using a role of "Pending" that was a duplicate of the Subscriber role.
[mb_user_profile_register id="meta-box-id" role="pending"]Then as part of the approval process, the admin changes the role to "Approved" which has the capabilities we want, then we use another plugin to fire off the account activation and all of that stuff.
Thanks for the help!
John Rood
ParticipantOkay, thank you for the insight!
John Rood
ParticipantWe were able to accomplish this another way, thank you for your help!
June 29, 2022 at 10:27 PM in reply to: ✅How to modify deafult fields specifically on front-end User Registration Form #36723John Rood
ParticipantThank you, that will work for now. It would be helpful to have this functionality in the future, as it would allow the actual set of default fields to be ordered alongside the others in the registration form.
June 29, 2022 at 4:57 AM in reply to: ✅How to modify deafult fields specifically on front-end User Registration Form #36704John Rood
ParticipantOkay, follow up question:
I have followed the examples you shared, and ended up with the resulting code:
//adapted from: https://support.metabox.io/topic/mb_user_profile_register-autocompletenew-password/ //relevant docs: https://docs.metabox.io/extensions/mb-user-profile/#form-fields-filters function add_more_registration_fields( $fields ) { $fields = [ 'first_name' =>[ 'id' => 'first_name', // THIS 'name' => 'First Name', 'type' => 'text', 'required' => true, 'columns' => 4, ], 'last_name' =>[ 'id' => 'last_name', // THIS 'name' => 'Last Name', 'type' => 'text', 'required' => true, 'columns' => 4, ], 'username' => [ 'name' => __( 'Username', 'mb-user-profile' ), 'id' => 'user_login', 'type' => 'text', 'required' => true, 'columns' => 4, ], 'email' => [ 'name' => __( 'Email', 'mb-user-profile' ), 'id' => 'user_email', 'type' => 'email', 'required' => true, 'columns' => 6, 'desc' => 'Used for notifications and alerts (if opted-in).', ], 'phonenumber' => [ 'name' => __( 'Phone Number', 'mb-user-profile' ), 'id' => 'phonenumber', 'type' => 'tel', 'required' => true, 'desc' => 'Used for notifications and alerts (if opted-in).', 'columns' => 6, ], 'password' => [ 'name' => __( 'Password', 'mb-user-profile' ), 'id' => 'user_pass', 'type' => 'password', 'required' => true, 'columns' => 6, 'desc' => '<span id="password-strength" class="rwmb-password-strength"></span>', 'attributes' => [ 'autocomplete' => 'new-password' ] ], 'password2' => [ 'name' => __( 'Confirm Password', 'mb-user-profile' ), 'id' => 'user_pass2', 'type' => 'password', 'required' => true, 'columns' => 6, ], // ... add more fields here ]; return $fields; } add_filter( 'rwmb_profile_register_fields', 'add_more_registration_fields' );Everything works except the first 2 fields. The first and last name do not get copied into the user meta. I am following the instructions listed here: https://docs.metabox.io/extensions/mb-user-profile/#edit-default-fields. The IDs match. Is there something else I'm doing wrong?
June 29, 2022 at 2:19 AM in reply to: ✅How to modify deafult fields specifically on front-end User Registration Form #36702John Rood
ParticipantThis is extremely helpful, thank you!
John Rood
ParticipantWhen I try to submit the contact form, I get this error:
The link you followed has expired.
Can you send me an email directly, [email protected] so that I can respond back with the credentials?
John Rood
ParticipantIt looks like I didn't copy the listing link correctly, you can see it here:
listing
I'll also send over the site credentials for you to get in and take a closer look.
John Rood
ParticipantCan you please share some screenshots of the issue (full screen)?
Here are some screenshots of what I'm seeing when I look at the offer and listing:
offer
https://prnt.sc/Db5Vz3vrv5L3listing
https://prnt.sc/Db5Vz3vrv5L3And please notice that the custom field (relationship) shows on the object from get object type, post type, and field settings from object to. That means when you edit a listing post, you will see a meta box with a list of offer posts and some post statuses.
I'm not sure I'm understanding what you mean here - when I view either an offer or listing I can see a dropdown for the other related field.
John Rood
ParticipantThanks for the help, here's what I've been working with to try and get it to work based on your post and the examples you listed for dealing with a Relationship between one custom post type, (slug='offer'), to another custom post type, (slug='listing'). I've confirmed that the Relationship ID is 'listing-to-offer-relationship' by going to Meta Box > Relationships > Listing to Offer Relationship and copying it from there.
/** * Allow Meta Box Relationship to use post statuses besides just Published */ add_action( 'mb_relationships_init', function() { MB_Relationships_API::register([ 'id' => 'listing-to-offer-relationship', 'from' => [ 'object_type' => 'post', 'post_type' => 'listing', 'field' => [ 'query_args' => [ 'post_status' => array( 'publish', 'draft' ) ], ], ], 'to' => [ 'object_type' => 'post', 'post_type' => 'offer', 'field' => [ 'query_args' => [ 'post_status' => array( 'publish', 'draft', 'accepted', 'rejected' ) ], ], ], ]); });Nothing I test has been working for me though. When I have an custom post type 'offer' in draft I can see the connected custom post type 'listing' just fine. But when I view the connected 'listing' the connected 'offer' is blank. I've tried to set the 'post_type' in both the from and to arrays to 'post' instead of 'offer' and 'listing' which didn't seem to help. I've also tried to wrap it with your example 'function your_prefix_function_name() {' instead of 'add_action( 'mb_relationships_init', function() {' and that didn't work for me either.
I've also tried to add post statuses through the Meta Box interface under Meta Box > Relationships > Listing to Offer Relationship > From > Field > Query args:
key=post_status value=publish
key=post_status value=draftkey=post_status value='publish'
key=post_status value='draft'key=post_status value=array('publish','draft')
Along with the other matching To > Field > Query args and that didn't work either.
John Rood
ParticipantTaking another look at the Custom Fields section in Gravity Forms for the Advanced Post Creation it's possible to add a new custom field in and use the 'text_07vqcymyr6iw' field name from Meta Box Custom Field Group solves my issue. But I'm still left mapping each field from the form over, is there an easier way to do this or am I stuck doing this for each field?
-
AuthorPosts