iamnotadoll (@iamnotadoll)

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 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 );
    }

    `


    iamnotadoll
    Participant

    @iamnotadoll

    I’m having this issue as well. Something is happening to my URLS when posting replies.

    The site is running on ISS 7, the URL Rewrite Module has been installed at it is working perfectly fine with pretty permalinks on my posts and categories.

    Posting a new topic will redirect me to that topic’s page, so that’s working.

    The only thing that’s not working is the redirect when posting a reply – it’s redirecting me all over the place, sometimes back to the parent forum, sometimes to an error page, sometimes back to the main forum index.

    Is there some code that I can modify so that when someone hits ‘submit’ to post a reply, it just refreshes the page or something, instead of redirecting to random places?

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