PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Displaying User Role on the Site

s2Member Plugin. A Membership plugin for WordPress®.

Re: Displaying User Role on the Site

Postby peeld » December 23rd, 2011, 4:58 pm

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' ); ?>
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Displaying User Role on the Site

Postby s2pidkaspr » December 23rd, 2011, 5:03 pm

oh no wonder, you are using buddypress...lol :P
User avatar
s2pidkaspr
Registered User
Registered User
 
Posts: 48
Joined: August 6, 2011

Re: Displaying User Role on the Site

Postby peeld » December 23rd, 2011, 5:19 pm

Yep :)
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Displaying User Role on the Site

Postby Cristián Lávaque » December 26th, 2011, 5:11 am

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. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Displaying User Role on the Site

Postby Cristián Lávaque » December 26th, 2011, 5:15 am

Thanks Daisy. Could you try this?

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

Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Displaying User Role on the Site

Postby peeld » December 26th, 2011, 4:35 pm

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!
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Displaying User Role on the Site

Postby peeld » December 26th, 2011, 4:47 pm

Now to figure out what to put in the group forums to pull the forum posters id :)
User avatar
peeld
Registered User
Registered User
 
Posts: 97
Joined: August 24, 2011

Re: Displaying User Role on the Site

Postby Cristián Lávaque » December 26th, 2011, 5:13 pm

You're very welcome, Daisy. Happy Holidays to you too. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Displaying User Role on the Site

Postby s2pidkaspr » December 28th, 2011, 6:47 pm

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.
User avatar
s2pidkaspr
Registered User
Registered User
 
Posts: 48
Joined: August 6, 2011

Re: Displaying User Role on the Site

Postby s2pidkaspr » December 29th, 2011, 5:25 pm

@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.
User avatar
s2pidkaspr
Registered User
Registered User
 
Posts: 48
Joined: August 6, 2011

Re: Displaying User Role on the Site

Postby Cristián Lávaque » December 30th, 2011, 12:46 am

Glad it worked for you. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Displaying User Role on the Site

Postby s2pidkaspr » January 1st, 2012, 12:09 am

@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. :(
User avatar
s2pidkaspr
Registered User
Registered User
 
Posts: 48
Joined: August 6, 2011

Previous

Return to s2Member Plugin

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron