Skip to:
Content
Pages
Categories
Search
Top
Bottom

Embed Forum – subscribe not working

  • @franckc2

    Participant

    Hi I have embedded a forum into a WP page with the shortcode.

    Displaying and browsing the forum works as it should but when I clik on the “subscribe” button, the page reloads and I’m not subscribe for alerts on that forum.

    Seems to be doing that only when I embed the forum in another page.

    If I go directly to the forum, then the button works.
    Looks like something with the “rewrite” string or something like that.

    Any clue how I could fix that ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @robin-w

    Moderator

    so is the permalink of the page the same as the forum slug in

    dashboard>settings>forums>forum root ?

    @johngtur

    Participant

    For anyone with the same problem, this appears to be a bug in BBPress. The script that is meant to fire when someone clicks the “subscribe” button (engagements.js) is only enqueued for the forum and topic post-types. When a forum or topic is embedded on any other post-type, the script is not enqueued, and the button doesn’t do anything.

    A quick fix is to add this to your functions.php file, to enqueue the script whenever a forum or topic is embedded via a bbp-single-topic / bbp-single-forum shortcode:

    add_filter( ‘do_shortcode_tag’,’subscription_button_fix’,10,3);
    function subscription_button_fix($output, $tag){

    $arr = array(‘bbp-single-topic’, ‘bbp-single-forum’);
    if(!in_array($tag, $arr)){
    return $output;
    }
    bbp_enqueue_script( ‘bbpress-engagements’, ‘js/engagements.js’, array( ‘jquery’ ), true );
    wp_localize_script( ‘bbpress-engagements’, ‘bbpEngagementJS’, array(
    ‘object_id’ => get_the_ID(),
    ‘bbp_ajaxurl’ => bbp_get_ajax_url(),
    ‘generic_ajax_error’ => esc_html__( ‘Something went wrong. Refresh your browser and try again.’, ‘bbpress’ ),
    ) );

    return $output;
    }

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