demonboy (@demonboy)

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 65 total)

  • demonboy
    Participant

    @demonboy

    Sorry, forgot the function and end part.

    function add_custom_role( $bbp_roles ) {
    	
    $bbp_roles['deckhand'] = array(
    'name' => 'Deckhand',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
    );
    	
    $bbp_roles['admiral'] = array(
    'name' => 'Admiral',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
    );
    	
    return $bbp_roles;
    }
    
    add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );

    And the more I think about it, the more I think this was either something I have over-written in the past, or a feature I had another website, not something your plugin has done. On another website I use the pro version of User Role Editor and I think that is how I am able to force custom forum roles. I think the code I posted above relates to this plugin.


    demonboy
    Participant

    @demonboy

    Hi Robin,

    My apologies, I’d said it was User Role Editor. It wasn’t, I used the Members plugin. Unfortunately, I can’t provide a link as everything is behind a login but here is my Members admin page. You can see the additional member roles I created.

    Members roles

    All that said, however, I am wondering if this is a theme update that caused this. Previously I’d themed my forum to display this user role, not bbp-author-role, so it is possible this was over-written by a theme update instead (my theme includes bbpress). Honestly, it’s been over four years since I styled my forum so I’m clutching at straws here, but is there any way your plugin could have over-written any custom code I wrote?

    I think if I add this to my child functions file I may be able to re-introduce the forum role:

    		$bbp_roles['oyster-owner'] = array(
    'name' => 'Oyster Owner',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
    );

    demonboy
    Participant

    @demonboy

    I’ve sorted it (excuse formatting):

    if (( $forum_id == 40088) ){
    ?>
    	<?php $args = array( 'post_type' => 'topic', 'posts_per_page' => 1, 'post_parent' => '40088' );
    				$loop = new WP_Query( $args );
    				while ( $loop->have_posts() ) : $loop->the_post();?>
    				<li class="fa-thumb"><div text-align="center"><a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon'));?><br>
    				<span class="fa-link"><?php bbp_topic_title(); ?></span></div></li>
    		<?php			
    				endwhile;
    		?>
           
    <?php
        }

    demonboy
    Participant

    @demonboy

    I should add that this appears in loop-single-forum.php where I am including a condition:

    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 40250) or ( $forum_id == 41369) ){
    ?>

    I’d like to then follow this with something that displays the latest topic permalink/title and topic author/avatar.


    demonboy
    Participant

    @demonboy

    Yep, that’s great. Thanks again, Robin.

    If anyone else is interested, in addition to the above code placed in functions.php, I amended loop-single-topic.php in my child theme thus:

    		<a class="bbp-topic-permalink" href="<?php bbp_topic_permalink(); ?>"><?php bbp_topic_title(); ?>
    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 41371) ){
    			?>
     - <?php echo bbp_get_topic_author(); ?></a>		
    <?php
        }
    
    else {?>		
    		</a>
    <?php
    }?>
    		<?php do_action( 'bbp_theme_after_topic_title' ); ?>
    
    		<?php bbp_topic_pagination(); ?>
    
    		<?php do_action( 'bbp_theme_before_topic_meta' ); ?>
    
    		<p class="bbp-topic-meta">
    
    			<?php do_action( 'bbp_theme_before_topic_started_by' ); ?>
    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 41371) ){
    			?>
    <?php
        }
    
    else {?>
    			<span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '14' ) ) ); ?></span>
    <?php
    }?>

    This selects a specific forum and within that forum it removes the ‘started by’ meta info that normally appears under the title. Instead it places the topic author’s display name (not user name) as an extension of the topic title, separated by a hyphen. The link to the author is removed and instead becomes part of the link to the topic.


    demonboy
    Participant

    @demonboy

    Brilliant! There’s no way I would have spotted that, at least not for a while. Thanks, Robin.


    demonboy
    Participant

    @demonboy

    Ha, good question. I tested again and it did it for all forums.


    demonboy
    Participant

    @demonboy

    Hi Robin,

    Using your prompt I hacked something that removes the action altogether and just uses the if statement. On the loop-single-forum.php file I started with this:

    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 40250) ){
    ?>
         <li class="bbp-forum-info-40250">  
    <?php
        }
    
    else {?>
    	<li class="bbp-forum-info">
    <?php
    }?>

    where I set the CSS selector ‘bbp-forum-info-40250’ width to 100%. At the end of the template I then added this:

    <?php $forum_id = bbp_get_forum_id(); 
        if (( $forum_id == 40250) ){
    ?>
           
    <?php
        }
    
    else {?>	
    	<li class="bbp-forum-topic-count"><?php bbp_forum_topic_count(); ?></li>
            rest of the normal template follows
    	</li>
    <?php
    }?>

    where nothing appears for forum id 40250 and the rest of the template displays as normal for all other forums. So now my first forum description is 100% width without topic counts/views/freshness, whilst the rest of the forums display as normal.

    If interested you can see the result here.


    demonboy
    Participant

    @demonboy

    Hi Robin. Yes, you have a good point. My functions.php file is filling up with these and it’s making no difference on load times. TBH I’m not sure how I would edit the above function to pull the correct forum ID as this one seems to deal with topic ID instead. Does it treat topic ID and forum ID as the same? As in, can I just change the ID number within this part:

    if (( $topic_id == 123)


    demonboy
    Participant

    @demonboy

    Hi @lylatylor,

    I went ahead and purchased the bbPress Notify (No-Spam) Digests add-on to the bbPress Notify (No-Spam) plugin by Vinny Alves. Didn’t want to pay for a plugin whilst I’m just testing my yet-to-be-launched community but since email updates are a central part of its function I wanted a plugin that was actively supported.


    demonboy
    Participant

    @demonboy

    I’m aware of BuddyPress Group Email Subscription but as I understand it I have to activate Groups in BP and ensure each forum participant is a member of a group.


    demonboy
    Participant

    @demonboy

    OK, the plugin works well, with a couple of caveats.

    The best thing about this plugin is that it is able to restrict the viewing of topics to topic archive based on user role, which is exactly what I wanted. This allows non-logged in users to see the forum archive, click into a forum, view the topic archive, but not click into a topic. Instead there’s a redirtect, which is perfect.

    I can also set different forums and topics to different user roles. A ‘bronze’ user can see/read/reply to all topics in forum1, but read-only on forum2, and so on.

    Couple of minor frustrations/issues:

    1. You can only set the viewing status if you create a topic within the WP back-end. It would be nice if the administrator could have the check-boxes inline within the forum edit pages on the front end.

    2. I realise there may be an issue where new topics, not started by me as the administrator, cannot have their viewing status set since forum users will not have access to the relevant checkboxes. It would be nice if there was a way of setting all new topics within a specific forum to inherit pre-defined viewing status.

    Fortunately for me the only topics I’m going to be hiding are the ones I create myself. All other topics created by my forum members fall into forums that are publicly viewable and will have read-only access to all.

    Hope this helps anyone who has the same topic archive issue I had.


    demonboy
    Participant

    @demonboy

    Hmmm, it seems that Thomas Zhu’s plugin, bbpress Member’s Only Pro plugin might do what I’m asking.

    # Restricts your bbPress topics to Logged in/Registered members only.
    # Restricts your bbPress replies to Logged in/Registered members only.
    # Restricts your bbPress forums based on user roles.
    # Restricts your bbPress topics based on user roles.

    It also allows different levels of access based on different bbpress user roles, which is something I am also after. I’ll report back on whether this does what I want it to do, in case there is anyone else out there who has the same issues as me.


    demonboy
    Participant

    @demonboy

    Scrap that. Doesn’t work. This is driving me nuts…


    demonboy
    Participant

    @demonboy

    OK, I think I have solved this by following this thread, except I had to do one thing the other way around…

    1. Scrap User Role Editor and install the Members plugin by Justin Tadlock
    2. Don’t put anything in your functions file
    3. In WordPress under Users/Roles, clone the Participant user role and give it a name and slug (in my case I am using ‘bosun’) and save the new role.
    4. Add this code to your functions file:

    function vip_add_custom_role( $bbp_roles ) {
    
    $bbp_roles['bosun'] = array(
    'name' => 'Bosun',
    'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
    );
    
    return $bbp_roles;
    }
    
    add_filter( 'bbp_get_dynamic_roles', 'vip_add_custom_role', 1 );

    … where bbp_roles and name is changed to your own name of the user role. This must be the same as the name/slug you inserted when cloning the participant user role.

    5. Now any forum user assigned this user role will display the correct role, rather that ‘participant’ ‘subscriber’ or ‘spectator’.

    The thing I had to do the other way around from the instructions in the other thread was to not put anything in the functions file and install the plugin first.

    Phew. Took me two days to get there!


    demonboy
    Participant

    @demonboy

    And, for the record, I tried Robin’s code too. This time the user was originally a ‘participant’. When adding Robin’s code and trying to save as my new forum user role, it reverts back to ‘participant’. Caching is turned off.


    demonboy
    Participant

    @demonboy

    Did anyone find a solution to this? I have am having the same issue and am using:

    function add_custom_role( $bbp_roles ) {
      $bbp_roles['my_custom_role'] = array( 
        'name' => 'Bosun',
        'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // same capabilities as participants
      );
    
      return $bbp_roles;
    }   
    add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );

    demonboy
    Participant

    @demonboy

    Thanks, Robin, and thank you for your (free) support on the bbpress forums. Appreciated.


    demonboy
    Participant

    @demonboy

    Hey Robin,

    Thanks for getting back to me. I’ve just this moment found a simple solution. What do you think of this:

    .logged-in #bbp-forum-40250 {
    	display: none;
    }

    demonboy
    Participant

    @demonboy

    Hi Milan, thanks for that. Funnily enough I’ve just left you a five-star rating on wordpress.org for your polls plugin!

    I saw your Thanks feature but am I right in saying it sends a personal message? I’m looking to display a Thanks button by the post which other users can simply click.


    demonboy
    Participant

    @demonboy

    Read the thread…


    demonboy
    Participant

    @demonboy

    Yep, my fault. On it…


    demonboy
    Participant

    @demonboy

    Hi again, Pascal.

    I’ve just tried the private groups plugin. I was expecting my private group to appear in the horizontal rows (as a user) rather than a vertical column. Have I set something up wrong?


    demonboy
    Participant

    @demonboy

    This is brilliant, Pascal. I hadn’t made the connection when I dloaded the plugin so I have left a rating and a comment on some minor improvements. I hope you don’t mind because I came across the plugin before I saw your reply. I need to look at bbp-private-groups and then I’ll amend my rating. Apologies and thanks, this is a great plugin.


    demonboy
    Participant

    @demonboy

    Wait, scrap that. I’d copied the code from the email alert, not the forum. Guess it picked up incorrect syntax this way. Copied from the forum and it works a treat.

    Thank you!

Viewing 25 replies - 1 through 25 (of 65 total)