BuddyDev

Search

[Resolved] BuddyPress Simple Front End Post | add redirect after submitting post.

  • Participant
    Level: Initiated
    Posts: 10
    Brendan on #14628

    Hello,

    I’d like to add a redirect after a user submits a post. How do I do that?

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #14629

    Hi Brendan,
    When registering the form you can register the callback to be called after post is saved

    
    
    'update_callback'       => 'buddydev_form_saved_callback',
    
    

    Now, In the callback, you can redirect as you please.
    Here is how the function should look like

    
    
    /**
     * This gets called when a post is saved/updated in the database
     * after create/edit action handled by BP simple front end post plugin
     *
     * @param int                      $post_id post id.
     * @param boolean                  $is_new is new post.
     * @param BPSimpleBlogPostEditForm $form_object form.
     */
    function buddydev_form_saved_callback( $post_id, $is_new, $form_object ) {
    // do a redirect here.
    }
    
    

    You get the post id, whether is was a new post or an edit post and the form object.

    I hope you can take from there.

    Best Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved