Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum reply redirect URL rewrite issue

Viewing 4 replies - 26 through 29 (of 29 total)

  • iamnotadoll
    Participant

    @iamnotadoll

    I modified the code in includes/common/template-tags.php as outlined on this page and (for now) it seems to have fixed the issue.

    `
    function bbp_redirect_to_field( $redirect_to = ” ) {

    // Rejig the $redirect_to
    //if ( !isset( $_SERVER[‘REDIRECT_URL’] ) || ( !$redirect_to == home_url( $_SERVER[‘REDIRECT_URL’] ) ) )
    // $redirect_to = wp_get_referer();

    // Make sure we are directing somewhere
    if ( empty( $redirect_to ) )
    $redirect_to = home_url( isset( $_SERVER[‘REQUEST_URI’] ) ? $_SERVER[‘REQUEST_URI’] : wp_get_referer() );

    // Remove loggedout query arg if it’s there
    $redirect_to = (string) esc_attr( remove_query_arg( ‘loggedout’, $redirect_to ) );
    $redirect_field = ”;

    echo apply_filters( ‘bbp_redirect_to_field’, $redirect_field, $redirect_to );
    }
    `

    Initially it wasn’t working because I didn’t remove the //Rejig the redirect part (can’t believe I didn’t see it the first time).

    Now my question is, where (and how) would I put this modified function to stop any future updates from overwriting it?

    I tried using add_filter(‘bbp_redirect_to_field’) in my bbpress-functions file but it makes the site really slow. Is there a better way to do it?

    `
    add_filter(‘bbp_redirect_to_field’, ‘bbp_redirect_to_field_filter’);

    /**
    * Filter to fix the reply redirects
    **/
    function bbp_redirect_to_field_filter( $redirect_to = ” ) {

    // Make sure we are directing somewhere
    if ( empty( $redirect_to ) )
    $redirect_to = home_url( isset( $_SERVER[‘REQUEST_URI’] ) ? $_SERVER[‘REQUEST_URI’] : wp_get_referer() );

    // Remove loggedout query arg if it’s there
    $redirect_to = (string) esc_attr( remove_query_arg( ‘loggedout’, $redirect_to ) );
    $redirect_field = ”;

    echo apply_filters( ‘bbp_redirect_to_field’, $redirect_field, $redirect_to );
    }

    `

    With what you patched via #1835.diff that is the same as what was committed to /trunk in r4533 and is included in the upcoming bbPress 2.3.


    jaydd
    Participant

    @jaydd

    Same problem for me as for@iamnotadoll :/ But rewriting .php just made my site blank.
    BBpress 2.5.4 version tho


    reedy
    Participant

    @reedy

    I’m having an issue with redirects after replying to a post, too.

    I’ve noticed that most of the time, it seems to work OK – if you post, it submits and you are redirect back to the post you just submitted (ie the new ‘last post’ in the topic).

    However, it looks as though there are issues when it comes to dealing with pagination.

    For example, getting to the end of a topic with the following URI:

    /forums/topic/name-of-topic/page/155/

    The redirect after submitting a reply is:

    /forums/topic/name-of-topic/#post-599473

    So basically, the pagination slugs seem to have been stripped. As a result, the poster is directed back to the first page of the topic.

    Is anyone else able to reproduce this?

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