Forum Replies Created
-
AuthorPosts
-
davidrknowles
ParticipantYes, unfortunately, the post title is a bit more of a pain due to where and how the data is saved.
What you could do is write a function in the meantime that mirrors the CF and rewrites the post title with it. You could use the submission hook rwmb_frontend_after_process, so you have the post ID to target the rewrite of the title with as I am not sure the $config submission contains the title.
davidrknowles
ParticipantYes, it is, just include it in your shortcode example: [mb_frontend_form id="your_mb_id" post_fields="title, content, excerpt, date, thumbnail."]
You can read more about it here: https://docs.metabox.io/extensions/mb-frontend-submission/#shortcode-attributes
Hope this helps.
davidrknowles
ParticipantI tried this and I thought
get_the_title(get_the_ID())might work as an std but it doesn't, mainly I think due to when the filter fires.But I think what might work is using one of the hooks, try this:
add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { if ( 'my-meta-box' === $config['id'] ) { $sub_title = get_the_title(get_the_ID()); update_post_meta($post_id, 'submitted_from', $sub_title); } }, 10, 2 );Change "my-meta-box" to your overall meta_box id,
change "submitted_from" to the field you want to populate.If you don't want this field to show on the front end you may have to manually hide it.
Hope this helps you.
davidrknowles
ParticipantThat works perfectly. also just realised you can also pull the other standard user meta in by using their keys (first_name or last_name).
Is it possible to use a MB helper function to retrieve data fields from the user table, like if one wanted to change s password or email in the user profile?
davidrknowles
ParticipantThe hard part of this is getting the users time, and this could depend on timezone, DST etc.
The only way I have found this possible is using JS to get browser information and then compare it with the server output. You will have to pass the server output to the DOM or use AJAX to make the communication with the server.
Bit of a challenge, I was doing this for a listing site for displaying opening hours and notifying the users if the business was open, I have put it on the back burner for now.
davidrknowles
ParticipantHow are you guys travelling with this?
I am at this same junction if its possible to have a password to confirm the submission of changed user details. It would also be handy to append the form first rather than after the authenticated field.
davidrknowles
ParticipantThis is the rendered HTML on the page, as you can see the last column is nesting two of the fields, I don't really understand why:
davidrknowles
ParticipantThis is a simplified version out of the builder that seems to have the same strange rendering behaviour:
davidrknowles
Participantjust to get your thoughts and for others reading this, would just using something like array_walk_recursive be the best course of action to collect all the keys and values into a single object, like:
$group_values = rwmb_meta( 'group_in_question', array( 'object_type' => 'setting' ), 'settings_option_name' ); $found = []; array_walk_recursive($group_values, function($value, $key) use (&$found) { $found[$key] = $value; }); return $found;davidrknowles
ParticipantThanks, Anh, keep up the great work.
davidrknowles
ParticipantOk an update, I did some digging and due to some of the loops I was running I used a few nested groups to manage data like group=>group so I cleaned that up with an array merge, but it still doesn't work there are still nested groups but all have a purpose.
So then I thought I would try getting the rwmb_meta for the first parent group.... BANG it returned all the values that had been changed from their default value in an array with the array in that with the key and values.
Is this normal behaviour for rwmb_meta in a group scenario? you have to target the Group ID and them loop through all the results?
Thanks
-
AuthorPosts