Search

bbPress Showcase » Plugins by _ck_

"Hidden Forums" and using an image as a label

RSS

  1. r-a-y
    User has not uploaded an avatar

    junior member
    Joined: Jul '09
    Posts: 7

    offline

    Hi _ck_,

    Got another question for you.

    I'm using your "Hidden Forums" plugin and am using an image as a label, instead of the default '[H] ' string.

    When I define $hidden_forums['label'] as an image, the image shows up as expected, but when you enter a hidden forum, the (img) tag isn't stripped from the page (title).

    I commented out this line:
    add_filter( 'get_forum_name', 'hidden_forums_label',11,2);

    Which remedies the problem, but the label doesn't apply to the forum list.

    So then, I looked through the bb-template functions to see if there was a filter that only applied to the forum list name, but couldn't find one.

    Of course, I don't have the knowledge of bbPress like you do, maybe there's a filter I'm overlooking?

    --

    Also I have a feature request, would it be possible to create a template tag we could use to determine if a thread is in a forum that is hidden? Reason is I would like to display a message that the thread is a hidden topic. Definitely not important, but thought I'd mention it.

    Thanks for reading!

    Posted 2 years ago #
  2. _ck_
    _ck_

    senior admin
    Joined: Jul '06
    Posts: 908

    offline

    Do it like this then:

    if (!is_topic()) {add_filter( 'get_forum_name', 'hidden_forums_label',11,2);}
    Posted 2 years ago #
  3. r-a-y
    User has not uploaded an avatar

    junior member
    Joined: Jul '09
    Posts: 7

    offline

    Thanks _ck_!
    That worked.

    Should have thought of using a conditional!
    I made one small change; I changed the if statement to !is_forum instead, since the problem was only happening on a forum page.

    Thanks again!

    Posted 2 years ago #
  4. r-a-y
    User has not uploaded an avatar

    junior member
    Joined: Jul '09
    Posts: 7

    offline

    Just upgraded to bbPress 1.0.2.

    Thought I'd mention that the "esc_html" filter is added to "forum_name" in this release, so the "img" tag gets escaped when using an image as a label.

    To fix this, in the following conditional:
    if (!empty($hidden_forums['label']) && $hidden_forums_list!=array_flip($hidden_forums['hidden_forums'])) {

    Add the following:

    if (!is_forum()) {
    		add_filter( 'get_forum_name', 'hidden_forums_label',11,2);
    		remove_filter( 'forum_name', 'esc_html');
    	}

    This snippet also fixes the problem I noted at the beginning of this thread.

    Again, this only applies to bbPress 1.0.2.

    Posted 2 years ago #

RSS feed for this topic

Post a reply to “"Hidden Forums" and using an image as a label”

You must log in to post.

keep _ck_ coding >> donate $5 <<     Theme Switcher:
34 users online from in the past 30 minutes. 13 bots 21 guests
7,160 views today 8,426 yesterday 16,043 peak. Most at once 50 today 62 yesterday 131 peak. Visited today: Amylawrence, guava, JeffreyCasivant, wigbuy123, gdfddfs, nandao, _ck_, summerfortun
2,288 posts in 394 topics over 66 months by 430 of 2,167 members. Latest: watchessaleus, wigbuy123, JeffreyCasivant