Skip to:
Content
Pages
Categories
Search
Top
Bottom

Modify? or Plugin? for WIDGET (bbPress) Recent Topics


  • Nino
    Participant

    @nino_py

    Hello to all ๐Ÿ™‚

    I have a question is it possible to modify by code or by plugin the Widget (bbPress) Recent Topics that way:

    For logged in users links are on.
    For all not logged in the links are off. They only see the text.

    Does anyone has a hint for me?

    Thanks and greetings

    Nino

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

  • Robin W
    Moderator

    @robin-w

    and to answer Nino’s Q

    If youโ€™re into coding, then yes

    the widgets code is held in

    bbpress/includes/common/widegets.php

    you could customise these and create them as new custom widgets

    For instance the topics widget starts on line 669, and line 811 does bbp_topic_permalink( $topic_id )

    You could add an if statement to create two different outputs logged in vs not logged in and alter not logged in to topic title.

    Not something I have time to do, but would be fun if you have the time


    Nino
    Participant

    @nino_py

    I think I found it at line 811:

    <a class="bbp-forum-title" href="<?php bbp_topic_permalink( $topic_id ); ?>"><?php bbp_topic_title( $topic_id ); ?></a>

    What do You mean (as I am not really firm in php code :-/ )? If I replace it by:

    <?php if ( is_user_logged_in() ) ?>
       //old code for logged in user
       <a class="bbp-forum-title" href="<?php bbp_topic_permalink( $topic_id ); ?>"><?php 
       bbp_topic_title( $topic_id ); ?></a>
    <?php else ?>
       //new code for NOT logged in user
       <a class="bbp-forum-title" href=""><?php bbp_topic_title( $topic_id ); ?></a>
    <?php endif ?>

    Robin W
    Moderator

    @robin-w

    ‘…as I am not really firm in php code ‘ – your coding skills don’t look at all bad to me ๐Ÿ™‚

    Without testing, that looks fine to me – give it a go.

    You could choose to just edit that file, but if you do, keep a note of what you changed, as bbpress updates will overwrite it – purists will say you should never alter core files, but as this is already a plugin, I am less fussy (expecting to be criticised for this!), but do know what you’ve changed.

    To do it “properly” you’d need to either

    create these as new widgets by copying the code to your functions file and renaming it.
    create this as a plugin.

    If you need help in how to rename come back, and I’ll make a list of what you need to change, but you’ll need to be a bit patient, as I have loads of queries os, and you’ll need to join a queue !

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