Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying bbPress Template Parts within Gutenberg Block

  • @cayd

    Participant

    Hi all,

    I’m currently working on trying to display the currently signed in users subscriptions to both forums and topics within a Gutenberg block, but when accessing the user-subscriptions.php template, it shows that I’m not currently subscribed to any topics or forums, even though I can see I’m subscribed to them on the true subscriptions page at /forums/subscriptions. Is there any way to output this same content into a custom block?

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

    Moderator

    can you give us the code for your custom block please

    @cayd

    Participant

    I actually don’t have much written as it wasn’t doing squat at the time! Lol. And it’s not a true Gutenberg block, it’s just an ACF block that pulls in some PHP. Really what I tried most was using

    <?php if ( bbp_get_user_forum_subscriptions() ) : ?>
    
        <?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    <?php else : ?>
    
        <?php bbp_get_template_part( 'feedback', 'no-forums' ); ?>
    
    <?php endif; ?>

    However, when displaying that content within any standard page and passing the current user ID into bbp_get_user_forum_subscriptions(), it only outputs a single forum subscription.

    @robin-w

    Moderator

    ok, so can you outline what you wish to achieve?

    @cayd

    Participant

    Like I said in the opening of my post, I’m looking to display the user’s subscribed to topics and forums on the homepage of the site. Here’s the actual design I’m going for – https://i.imgur.com/zoAhh5G.png. I pretty much just want to emulate what’s happening on the profile level forums page within my custom ACF block.

    @robin-w

    Moderator

    thanks, sorry I don’t always get enough brain time to go back through a topic.

    hmmm…code would take a while to work out, beyond free help from me, sorry.

    @cayd

    Participant

    I’m not necessarily looking for someone to write out the code for me. I’m just looking for some general direction on how to get it done. Any links to other resources would be super valuable.

    @robin-w

    Moderator

    🙂 The problem is that I’d have to work out how to do it first !! so lots of code searching.

    So a bit like you wanting some hints on how to solve a crossword clue – until I’ve solved it, I can’t help you and then I might as well give you the answer 🙂

    I’d suspect it is to do with resetting globals

    best offer I can have is download the bbp_style_pack plugin, and navigate to /includes/shortcodes.php

    the bsp-display-topic-index does topics within a page, and line 34 is a link to the query which filters these to the settings.

    so if you copied that function and all it’s sub functions, renamed them all to prevent conflict, and then if you used the guts of bbp_get_user_topic_subscriptions to replace the query, that might get you close.

    Once done for topics, then you could re-write for forums.

    Best I can do

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