Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Users Can't Log Out #551591

    Having the same problem. Made a child theme ( see the how-to here) and then added this code

    //sends the user to $url - in this case '/forums/'  
    function rw_logout ($redirect_to) {
    	$url='/forums/' ;
    	$redirect_to = '<a href="' . wp_logout_url( $url ) . '" class="button logout-link">' . esc_html__( 'Log Out', 'bbpress' ) . '</a>' ;
    	return $redirect_to ;
    	}
    	
    	add_filter ('bbp_get_logout_link', 'rw_logout') ;

    as proposed here but it didn’t work.

    I post function.php content here as wordpress hast changed the way to make a child theme and almost every solution proposal I found did it the old way.

    <?php
    
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    
    }
    
    function rw_logout ($redirect_to) {
    	$url='/blog/' ;
    	$redirect_to = '<a href="' . wp_logout_url( $url ) . '" class="button logout-link">' . esc_html__( 'Log Out', 'bbpress' ) . '</a>' ;
    	return $redirect_to ;
    	}
    	
    	add_filter ('bbp_get_logout_link', 'rw_logout') ;

    Everthing is fine with the default theme. It seems clearly linked to the bbPress plugin.

    • This reply was modified 9 years, 4 months ago by HansHuckebein.

    Hey,

    tried this as well, but without luck. Do I have to configure bbPress somehow.

    Didn’t help.
    It seems the description there is outdated.

    Meanwhile I got a child theme working (as a starting point) but how to proceed from there. Every time I include a function into the functions.php file in the child theme it’s not working anymore.
    Here’s what I tried.

    apply_filters('logout_url', 'my_fixed_wp_logout_url')
            function my_fixed_wp_logout_url($redirect = '') {
        $args = array( 'action' => 'logout' );
        if ( !empty($redirect) ) {
            $args['redirect_to'] = urlencode( $redirect );
        }
    
        $logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));
        $logout_url = wp_nonce_url( $logout_url, 'log-out' );
    
        return $logout_url;
    }

    Thanks for your quick reply. Deactivating bbPress removed the problem. Any hint on how to continue from here?

Viewing 6 posts - 1 through 6 (of 6 total)