Page 4 of 4

Re: Displaying User Role on the Site

PostPosted: December 23rd, 2011, 4:58 pm
by peeld
Code: Select all
<?php

/**
* BuddyPress - Activity Stream Comment
*
* This template is used by bp_activity_comments() functions to show
* each activity.
*
* @package BuddyPress
* @subpackage bp-default
*/

?>

<?php do_action( 'bp_before_activity_comment' ); ?>

<li id="acomment-<?php bp_activity_comment_id(); ?>">
   <div class="acomment-avatar">
      <a href="<?php bp_activity_comment_user_link(); ?>">
         <?php bp_activity_avatar( 'type=thumb&user_id=' . bp_get_activity_comment_user_id() ); ?>
      </a>
   </div>

   <div class="acomment-meta">
      
      <?php
      /* translators: 1: user profile link, 2: user name, 3: activity permalink, 3: activity timestamp */
      printf( __( '<a href="%1$s">%2$s</a> replied <a href="%3$s" class="activity-time-since"><span class="time-since">%4$s (VIEW)</span></a>', 'cc' ), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_thread_permalink(), bp_get_activity_comment_date_recorded() );
      ?>
       &middot;
      <?php if ( is_user_logged_in() && bp_activity_can_comment_reply( bp_activity_current_comment() ) ) : ?>

         <a href="#acomment-<?php bp_activity_comment_id(); ?>" class="acomment-reply bp-primary-action" id="acomment-reply-<?php bp_activity_id() ?>-from-<?php bp_activity_comment_id() ?>"><?php _e( 'Reply', 'cc' ); ?></a>

      <?php endif; ?>
       &middot;
      <?php if ( bp_activity_user_can_delete() ) : ?>

         <a href="<?php bp_activity_comment_delete_link(); ?>" class="delete acomment-delete confirm bp-secondary-action" rel="nofollow"><?php _e( 'Delete', 'cc' ); ?></a>

      <?php endif; ?>
      
   </div>

   <div class="acomment-content"><?php bp_activity_comment_content(); ?></div>

   <div class="acomment-options">

      

   </div>

   <?php bp_activity_recurse_comments( bp_activity_current_comment() ); ?>
</li>

<?php do_action( 'bp_after_activity_comment' ); ?>

Re: Displaying User Role on the Site

PostPosted: December 23rd, 2011, 5:03 pm
by s2pidkaspr
oh no wonder, you are using buddypress...lol :P

Re: Displaying User Role on the Site

PostPosted: December 23rd, 2011, 5:19 pm
by peeld
Yep :)

Re: Displaying User Role on the Site

PostPosted: December 26th, 2011, 5:11 am
by Cristián Lávaque
s2pidkaspr wrote:@christian
i see, but to confirm it, you are saying that's possible correct? if so then, ok...i'll try to figure that out...hey thanks again :) i really appreciate the help support...


Cool. :)

Re: Displaying User Role on the Site

PostPosted: December 26th, 2011, 5:15 am
by Cristián Lávaque
Thanks Daisy. Could you try this?

Code: Select all
<?php echo get_user_field('s2member_access_label', bp_get_activity_comment_user_id()); ?>


Re: Displaying User Role on the Site

PostPosted: December 26th, 2011, 4:35 pm
by peeld
So, GREAT news, it WORKS when placed in comments.php - now activity replies show the s2member role for the person who posted the activity. WOO HOO!

AND, I placed the following code in entry.php and now every activity entry shows the OPs status. AWESOME. SO AWESOME.

Code: Select all
<?php echo get_user_field('s2member_access_label', bp_get_activity_user_id()); ?>


YOU ROCK.
Thanks!
Happy Holidays!

Re: Displaying User Role on the Site

PostPosted: December 26th, 2011, 4:47 pm
by peeld
Now to figure out what to put in the group forums to pull the forum posters id :)

Re: Displaying User Role on the Site

PostPosted: December 26th, 2011, 5:13 pm
by Cristián Lávaque
You're very welcome, Daisy. Happy Holidays to you too. :)

Re: Displaying User Role on the Site

PostPosted: December 28th, 2011, 6:47 pm
by s2pidkaspr
peeld wrote:Now to figure out what to put in the group forums to pull the forum posters id :)


you know what, i'm thinking of this too. Is it possible? I have phpbb as forum.

Re: Displaying User Role on the Site

PostPosted: December 29th, 2011, 5:25 pm
by s2pidkaspr
@christian

It's funny but i have been trying to tweak the code you gave me without using any arrays to show some individual commentors to show as other name roles than others.
So I tried doing this code

Code: Select all
<?php echo ($comment->user_id == 1 ? 'Administrator' : ($comment->user_id == 43 ? 'Moderator' : get_user_field('s2member_access_label', $comment->user_id))); ?>


And it turns out it works fine. Haha. Your idea is really great! :) Thanks.

Re: Displaying User Role on the Site

PostPosted: December 30th, 2011, 12:46 am
by Cristián Lávaque
Glad it worked for you. :)

Re: Displaying User Role on the Site

PostPosted: January 1st, 2012, 12:09 am
by s2pidkaspr
@christian

thanks..though im still trying to tweak something, because im wondering how to show it for multiple id's?
like for example if i have 2 administrator and 4 moderators using that code.

I tried

Code: Select all
<?php echo ($comment->user_id == 1 ? 'Administrator' : ($comment->user_id == 43&&37 ? 'Moderator' : get_user_field('s2member_access_label', $comment->user_id))); ?>


notice i added "&&" between user id 43 and 37 on moderator. Hoping to show "Moderator" status role on comments for those user id. Hoping to say "43 and 37" as moderator. =/ I failed though. :(