Skip to:
Content
Pages
Categories
Search
Top
Bottom

Created private forum, but title is "Private: Private: Own Your Mission Forum"


  • drsheck
    Participant

    @drsheck

    Just named it “Own Your Mission”, understand if it needs to prefix it as “private”, but why twice?

    Using it on a Premise membership site with their plugin, but don’t think it’s that.

    Thoughts please?

    Thanks,
    Adan

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

  • Fee
    Participant

    @wdfee

    I’ve the same problem. Solved it by replacing the_title() with bbp_forum_title() on my theme’s page template – but that’s not a real solution, because the problem is in all tested themes (bp-default, twentytwelve) and needs some conditions to use it only with bbpress forums.


    Fee
    Participant

    @wdfee

    The ‘Private: …’ is added by WP in wp-includes/post-template.php inside of the function get_the_title(). bbpress uses this function in it’s own function bbp_get_forum_title() to generate the title -> ‘Private:’ is appended first time. When the theme now calls the_title() ‘Private:’ is appended again.

    I adjusted bbp_get_forum_title() now: Add two filters, the first removes the ‘Private:’ from all Breadcrumbs and so on, the second appends ‘Private Forum:’ to the forum title.

    function bbp_get_forum_title( $forum_id = 0 ) {
    $forum_id = bbp_get_forum_id( $forum_id );
    add_filter( 'private_title_format', function(){ return '%s'; } );
    $title    = get_the_title( $forum_id );
    add_filter( 'private_title_format', function(){ return __( 'Private Forum: %s', 'bbpress' ); } );
    return apply_filters( 'bbp_get_forum_title', $title, $forum_id );
    }

    Could one of the devs please take a look if this would be an option for you? I hardcoded it for now…

    You shouldn’t use antonymous functions (closures) for those filters. Those are only PHP 5.3+ compatible.

    What we could do instead of all those filters is getting the forum object and use the $forum->post_title field directly, instead of calling get_the_title on it’s ID. I imagine people who wants to modify forums titles tends to filter bbp_get_forum_title and not get_the_title


    Fee
    Participant

    @wdfee

    Thanks, Daniel, sure you could do it with an own function instead.

    I saw that there is already a ticket related to the title: https://bbpress.trac.wordpress.org/ticket/1764
    Didn’t test the patch yet.


    skyynet
    Participant

    @skyynet

    Thanks, Fee. As of WordPress 4.0 the problem still exists, so I commented out the

    
    //$private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
    //$title = sprintf( $private_title_format, $title );
    

    in wp-includes/post-template.php to get rid of the private: in front of private tagged forums which I use.


    Robin W
    Moderator

    @robin-w

    you could also add the following to your functions file

    add_filter('protected_title_format', 'remove_protected_title');
    add_filter('private_title_format', 'remove_private_title');
    
    //removes 'private' and protected prefix for forums
    function remove_private_title($title) {
    	return '%s';
    	}
    
    function remove_protected_title($title) {
    	return '%s';
    	}
    		
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar