Skip to:

I think I found a bug in bbp_topic_subscription_link

  • Mike


    I am trying to use bbp_topic_subscription_link with a genericon icon.

    No problem displaying the icons on browser load, but as Ajax is being used the reverse genericon on a click, the icon is not reversed on the this click. Instead a “|” is displayed even though I have set the array to not display that. I have tried loading the icons through the subscribe/unsubscribe settings, and via an “if” with the conditional tag, ‘bbp_is_user_subscribed_to_topic()’ in “before” with separate subscribe and unsubscribe statements.

    Example 1

    <span class="my-class"><?php bbp_topic_subscription_link(array('unsubscribe'=> '<i class="genericon genericon-unsubscribe"></i>Unsubscribe','subscribe'=> '<i class="genericon genericon-subscribe"></i>Subscribe','before' => '&nbsp;&nbsp;')); ?></span>

    Example 2

    	if (bbp_is_user_subscribed_to_topic())
    	{ ?>
    	<span class="my-class"><?php bbp_topic_subscription_link(array('unsubscribe'=> '<i class="genericon genericon-unsubscribe"></i>Unsubscribe')); ?></span>
    	<?php }
    	{  ?>
    	<span class="my-class"><?php bbp_topic_subscription_link(array('subscribe'=> '<i class="genericon genericon-subscribe"></i>Subscribe')); ?></span>
    	<?php }


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

  • Mike


    BTW, Forum Subscribe is working exactly as I wanted Topic Subscribe to work as it doesn’t use AJAX.

    You are more than likely correct 🙁

    Things are a bit funky for forum and topic subscriptions and topic favorites.

    This was discussed at great length in the following topic, you might be able to get a temp fix from here until we get it patched for bbPress 2.6.

    Is there a way to remove this character "|" next to the subscription link?

    The bug/s

    I also plan on using ‘dashicons’



    Hi Stephen
    I saw you are very helpful on the forum, but unfortunately I don’t comprehend most of your proposed solutions.

    I temporarily solved the problem by copying the functions:

    1. bbp_user_subscribe_link
    2. bbp_get_user_subscribe_link

    to my theme. Funny enough, even when I deleted the “|” from both functions it still appeared.
    But I noticed that the AJAX was triggered by $wrap = true in bbp_user_subscribe_link so I changed it to false and now I get what I want. I will wait patiently for the AJAX when it has more ammonia.


    Thanks Mike, I am one of the bbPress core developers, with some luck I’ll get this fixed within the next few days. At this stage until I dig into all the code properly it is about as clear as mud for myself also.

    Either or, glad you have a temp fix for now 🙂



    Hi Mike – to filter the ajax call try this :

    function hide_before2 ($args = array() ) {
    $args['before'] = '&nbsp';
    $args['subscribe'] = '<i class="genericon genericon-subscribe"></i>Subscribe';  
    $args['unsubscribe'] = '<i class="genericon genericon-unsubscribe"></i>Unsubscribe'; // or whatever
     return $args;
    add_filter('bbp_before_get_user_subscribe_link_parse_args', 'hide_before2');

    <can people see edits? I’m just wondering if anyone can see my stupid errors>

    Anyway, you should, I think, be able to use the above *instead* of your copied functions as it will work with the initial ones too not just after the ajax call.



    Thanks, but I finished and moved on. I tried and failed with several different approaches like this, but copying and altering 2 functions took less than 2 minutes as the //comments were clear about how to disable the AJAX.

    I took me almost 2 weeks part-time to customise the bbpress forum. I spent a lot of time messing with IDs and classes to target CSS changes and trying to figure out the proper code to modify defaults.

    For example finding the code to return just an “edit” for replies was a matter of great googling and some luck.



    Somewhat related… anyone else have an issue where no anchor is generated for bbp_topic_subscription_link?

    In the loop-replies.php template I have:

    <div class="reply-content">
    <button type="button" class="btn btn-default btn-sm" title="Set as Favorite"><?php bbp_user_favorites_link(); ?></button>
    <button type="button" class="btn btn-default btn-sm subscribe" title="Subscribe to Topic"><?php bbp_topic_subscription_link(); ?></button>

    If you view source on the webpage there is no anchor present.
    Subscribing to Forums works as expected.

    Probably related to these:

    Subscribe to topic link is no longer displayed

    BBP: Topic Subscribe Not Working

    I think I found a bug in bbp_topic_subscription_link



    @tharsheblows I don’t know if it matters but just letting you know that your code fixed this for me! thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.