Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect to forum index after new topic or reply submitted


  • dwl003
    Participant

    @dwl003

    Hi guys,

    I am looking to redirect after new post or reply to the forum index of the new post/reply.I did a fair amount of searching but was unable to come up with a solution.

    Any help would be appreciated.

    Thanks

    Dennis

Viewing 4 replies - 1 through 4 (of 4 total)

  • dwl003
    Participant

    @dwl003

    After re-reading my original request, it seems a bit vague so let me clarify:

    After entering a new forum post and clicking “Post”, I am looking to display the topic index of the forum that was posted to.

    Ditto for a reply to a post.

    Hopefully this can be achieved with a small modification in the child theme functions.php ?

    Thanks in advance for any help.

    Dennis


    Robin W
    Moderator

    @robin-w

    yes, this should work – add this to the functions file in your child theme

    add_filter( 'bbp_new_topic_redirect_to', 'rew_forum_redirect_topic' , 10 ,3 ) ;
    add_filter( 'bbp_new_reply_redirect_to', 'rew_forum_redirect_reply' , 10 ,3 ) ;
    
    function rew_forum_redirect_topic ($redirect_url, $redirect_to, $topic_id ){
    	$forum_id = bbp_get_topic_forum_id($topic_id);
    	$redirect_url = bbp_get_forum_permalink( $forum_id ) ;
    return $redirect_url ;
    
    }
    
    function rew_forum_redirect_reply ($redirect_url, $redirect_to, $reply_id ){
    	$forum_id = bbp_get_reply_forum_id($reply_id);
    	$redirect_url = bbp_get_forum_permalink( $forum_id ) ;
    return $redirect_url ;
    
    }

    dwl003
    Participant

    @dwl003

    Thanks Robin – that worked perfectly. BTW I just discovered the style pack – excellent stuff 🙂

    Thanks again,

    Dennis


    Robin W
    Moderator

    @robin-w

    I’m about to add this as a function within the style pack !

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar