Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is it possible to remove topic-author, but keep reply-authors


  • Jerry
    Participant

    @jerrysc

    I am using themes and modifying bbpress.css. I figured out how to remove the roles of people making posts. I want to remove the topic authors only, but keep all authors of replies. Here are the changes I made to bbpress.css, which was to put “dislay: none;” under the forum and topic authors, but that has not worked.

    #bbpress-forums div.bbp-forum-author,
    #bbpress-forums div.bbp-topic-author {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author {
    	float: left;
    	text-align: center;
    	width: 115px;
    }
    
    #bbpress-forums div.bbp-forum-author img.avatar,
    #bbpress-forums div.bbp-topic-author img.avatar {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author img.avatar {
    	border: none;
    	max-width: 80px;
    	padding: 0;
    	margin: 12px auto 0 auto;
    	float: none;
    }
    
    #bbpress-forums div.bbp-forum-author a.bbp-author-name,
    #bbpress-forums div.bbp-topic-author a.bbp-author-name {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author a.bbp-author-name {
    	margin: 0 12px;
    	word-break: break-word;
    	display: inline-block;
    }
    
    #bbpress-forums div.bbp-topic-author a.bbp-author-name {
      display: none;
    }
    #bbpress-forums div.bbp-reply-author a.bbp-author-name {
    	clear: left;
    	display: block;
    }
    
    #bbpress-forums div.bbp-forum-author .bbp-author-role,
    #bbpress-forums div.bbp-topic-author .bbp-author-role,
    #bbpress-forums div.bbp-reply-author .bbp-author-role {
      display: none;
    //	font-size: 11px;
    //	font-style: italic;
    }
    
    #bbpress-forums li.bbp-header .bbp-search-author,
    #bbpress-forums li.bbp-footer .bbp-search-author,
    #bbpress-forums li.bbp-header .bbp-forum-author,
    #bbpress-forums li.bbp-footer .bbp-forum-author,
    #bbpress-forums li.bbp-header .bbp-topic-author,
    #bbpress-forums li.bbp-footer .bbp-topic-author {
      display: none;
    }

    The only way I have found to remove the topic author is to insert “display: none;” under the topic-reply authors, but that removes the topic-reply authors as well, which I don’t want to do. Perhaps I need to get into a php file to do this? If so, can someone direct me to the correct file? Thanks.

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

  • Jerry
    Participant

    @jerrysc

    If anyone is able to give me a hand on this, one note. I’ve tried modifying content-single-topic-lead.php as per the codex. That did not work. My next route is to try modifying something within buddypress, which I have installed. Perhaps something in there is preventing these changes within bbpress? Grasping at straws at this point.


    Robin W
    Moderator

    @robin-w

    ok, quick and messy way (based on some code I did elsewhere)

    create a directory in your theme root called bbpress

    wp-content/themes/%your-theme-name%/bbpress

    copy

    wp-content/plugins/bbpress/templates/default/bbpress

    loop-replies.php
    and
    loop-single-reply.php

    into this directory

    bbpress will now use these files instead

    in loop-replies change from line 40 to

    <li class="bbp-body">
    
    		<?php if ( bbp_thread_replies() ) : ?>
    
    			<?php bbp_list_replies(); ?>
    			
    			
    		<?php else : ?>
    			<?php global $countr ;
    			$countr=0 ; ?>
    		
    			<?php while ( bbp_replies() ) : bbp_the_reply(); ?>
    			
    			<?php 
    			$countr ++ ; 
    			
    			<?php bbp_get_template_part( 'loop', 'single-reply' ); ?>
    
    			<?php endwhile; ?>
    
    

    This is basically just putting a count into this, so that we can see that the topic is count 0

    then in loop-single-reply change line 45 to read

    <?php if ($countr !=0) bbp_reply_author_link( array( ‘sep’ => ‘<br />’, ‘show_role’ => true ) ); ?>

    I’ve not tested this, but you should be able to get it to work.


    Jerry
    Participant

    @jerrysc

    Hi Robin, thanks for your help so far. I had already made the theme folder and have been working with that for some time now, so I had no trouble following your suggestion.

    Unfortunately this is not quite working, but I think you have me on the right path. First, I had to move the global $countr; at the beginning of the file to prevent a parse error. Now, this code removes the topic author, which is great. But…, it also removes the reply authors.
    I want to keep the reply authors. Any suggestions?

    Here is my code in loop-replies.php:

    	<li class="bbp-body">
          
    		<?php if ( bbp_thread_replies() ) : ?>
    
    			<?php bbp_list_replies(); ?>
    
    		<?php else : ?>
        <?php 
          $countr=0; ?>
    
    			<?php while ( bbp_replies() ) : bbp_the_reply(); $countr ++;   ?>
    
    				<?php bbp_get_template_part( 'loop', 'single-reply' ); ?>
    
    			<?php endwhile; ?>
    
    		<?php endif; ?>
    
    	</li><!-- .bbp-body -->

    Robin W
    Moderator

    @robin-w

    so you’ve put

    <?php if ($countr !=0) bbp_reply_author_link( array( ‘sep’ => ‘<br />’, ‘show_role’ => true ) ); ?>
    

    on the loop single reply – yes?

    Try adding a line before that

    <?php echo ‘countr is ‘ . $countr ; ?>

    that should then show what the value is somewhere on the page (bottom left of each topic/reply would be my bet), so you can see what’s happening !

    If it’s not coming through you might need to declare it before using it in replies

    eg new line before line 45 saying

    <?php global $countr ; ?>


    Jerry
    Participant

    @jerrysc

    Okay, got it working! Thanks much for your help. One note: I had to change “if ($countr !=0)” to “if ($countr > 1)” to get the result I wanted. Evidently, bbpress is considering the first topic author as the first reply author. Strange, but whatever; it now works. Thanks again!


    Robin W
    Moderator

    @robin-w

    great – glad you’re fixed !

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