Title of post is removed after updating the post

Support MB Frontend Submission Title of post is removed after updating the postResolved

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #12407
    EddyPiVEddyPiV
    Participant

    I am building a membersite where my members will enter their details through Frontend Submission.
    They also can update their own details.
    But... with the update the title of the post gets removed... (No title)

    To update I use:
    [mb_frontend_form id="<the field groups>" post_id="current" submit_button="Update" confirmation="Your profile has been updated successfully."]

    How to resolve this?

    #12436
    Anh TranAnh Tran
    Keymaster

    Hi,

    Please add post_fields="title" to the shortcode. It will tell the extension to add post title field to the form and process its value.

    #12447
    EddyPiVEddyPiV
    Participant

    Great, that was it.

    Thanks!

    #18447
    netalysnetalys
    Participant

    Hey Anh, ok it's working but what about if we don't want the user to edit the title ?
    Thanks.
    Cedric.

    #18464
    Anh TranAnh Tran
    Keymaster

    Hi netalys,

    You probably need to set attribute disabled or readonly for the title field. Please see this blog post to know how to create custom settings for post fields.

    #18476
    netalysnetalys
    Participant

    OK but I can't find the info in the link you provide...
    The title is not a field we define in the custom fields, I don't understand how to do this...

    It should be awesome that if we don't add post_fields="title" in the shortcode then the title doesn't change rather then updating for "No title".

    #18490
    Anh TranAnh Tran
    Keymaster

    Hi Cedric,

    To be able to set a custom attribute for title, you need to create a text field and put it in the meta box (which has ID in the shortcode), like this:

    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        $meta_boxes[] = [
            'title' => 'Your title',
            'id'    => 'your-id',
            'fields' => [
                [
                    'title' => 'Post title',
                    'id' => 'post_title',
                    'disabled' => true,
                ],
                // Other fields here
            ],
        ];
    } );

    And in your shortcode, don't include the post_fields parameter:

    [mb_frontend_form id="your-id"]
    
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.