Community Support Forums — WordPress® ( Users Helping Users ) — 2012-01-01T00:09:44-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=16301 2012-01-01T00:09:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=59374#p59374 <![CDATA[Re: Displaying User Role on the Site]]>
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:
<?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. :(

Statistics: Posted by s2pidkaspr — January 1st, 2012, 12:09 am


]]>
2011-12-30T00:46:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=59203#p59203 <![CDATA[Re: Displaying User Role on the Site]]>

Statistics: Posted by Cristián Lávaque — December 30th, 2011, 12:46 am


]]>
2011-12-29T17:25:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=59148#p59148 <![CDATA[Re: Displaying User Role on the Site]]>
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:
<?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.

Statistics: Posted by s2pidkaspr — December 29th, 2011, 5:25 pm


]]>
2011-12-28T18:47:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=59033#p59033 <![CDATA[Re: Displaying User Role on the Site]]>
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.

Statistics: Posted by s2pidkaspr — December 28th, 2011, 6:47 pm


]]>
2011-12-26T17:13:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58855#p58855 <![CDATA[Re: Displaying User Role on the Site]]>

Statistics: Posted by Cristián Lávaque — December 26th, 2011, 5:13 pm


]]>
2011-12-26T16:47:46-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58854#p58854 <![CDATA[Re: Displaying User Role on the Site]]>

Statistics: Posted by peeld — December 26th, 2011, 4:47 pm


]]>
2011-12-26T16:35:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58853#p58853 <![CDATA[Re: Displaying User Role on the Site]]>
AND, I placed the following code in entry.php and now every activity entry shows the OPs status. AWESOME. SO AWESOME.

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


YOU ROCK.
Thanks!
Happy Holidays!

Statistics: Posted by peeld — December 26th, 2011, 4:35 pm


]]>
2011-12-26T05:15:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58808#p58808 <![CDATA[Re: Displaying User Role on the Site]]>
Code:
<?php echo get_user_field('s2member_access_label', bp_get_activity_comment_user_id()); ?>

Statistics: Posted by Cristián Lávaque — December 26th, 2011, 5:15 am


]]>
2011-12-26T05:11:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58807#p58807 <![CDATA[Re: Displaying User Role on the Site]]>
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. :)

Statistics: Posted by Cristián Lávaque — December 26th, 2011, 5:11 am


]]>
2011-12-23T17:19:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58676#p58676 <![CDATA[Re: Displaying User Role on the Site]]>

Statistics: Posted by peeld — December 23rd, 2011, 5:19 pm


]]>
2011-12-23T17:03:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58672#p58672 <![CDATA[Re: Displaying User Role on the Site]]>

Statistics: Posted by s2pidkaspr — December 23rd, 2011, 5:03 pm


]]>
2011-12-23T16:58:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58671#p58671 <![CDATA[Re: Displaying User Role on the Site]]>
Code:
<?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' ); ?>

Statistics: Posted by peeld — December 23rd, 2011, 4:58 pm


]]>
2011-12-23T12:02:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58631#p58631 <![CDATA[Re: Displaying User Role on the Site]]> 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...

Statistics: Posted by s2pidkaspr — December 23rd, 2011, 12:02 pm


]]>
2011-12-23T03:05:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58605#p58605 <![CDATA[Re: Displaying User Role on the Site]]>
peeld wrote:
Maybe, but I doubt it - It shouldn't matter WHERE you put that code....it does work, in a manner of speaking; it doesn't break my site and it does return a value - it just returns the wrong value (the logged in user's role rather than the original poster's role).


Can you post inside code tags the contents of your file with the comments?

Statistics: Posted by Cristián Lávaque — December 23rd, 2011, 3:05 am


]]>
2011-12-23T03:00:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58604#p58604 <![CDATA[Re: Displaying User Role on the Site]]>
s2pidkaspr wrote:
Now, can you tell me, if how to write and add the code in there if I want another member to be named "Moderator?" and with multiple ID number? Is it possible too?


That's why I suggested the array for you, because you have more than one. One (e.g. Administrator) works fine with the condition I wrote for Daisy.

If you know a bit of PHP, you'll figure out how to do it for more than one person. Like I said, you can have an array where keys are the roles and values the labels, and use that.

Statistics: Posted by Cristián Lávaque — December 23rd, 2011, 3:00 am


]]>
2011-12-22T21:58:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58598#p58598 <![CDATA[Re: Displaying User Role on the Site]]>
well, have you tried different code approach on this topic? hmmm..may i see your page that has a comment section?

Statistics: Posted by s2pidkaspr — December 22nd, 2011, 9:58 pm


]]>
2011-12-22T20:38:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58589#p58589 <![CDATA[Re: Displaying User Role on the Site]]>
Daisy

Statistics: Posted by peeld — December 22nd, 2011, 8:38 pm


]]>
2011-12-22T18:28:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58572#p58572 <![CDATA[Re: Displaying User Role on the Site]]> you still there?


@peeld
probably it depends on what kind of theme you are using, because my comment section have been customed and its not even on entry.php and comments.php, i'm using different file path for my comments.

Statistics: Posted by s2pidkaspr — December 22nd, 2011, 6:28 pm


]]>
2011-12-21T14:50:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58415#p58415 <![CDATA[Re: Displaying User Role on the Site]]>

Ace, you still here? My offer to pay for this is still out there, haven't heard from you...

Statistics: Posted by peeld — December 21st, 2011, 2:50 pm


]]>
2011-12-21T11:50:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58407#p58407 <![CDATA[Re: Displaying User Role on the Site]]>
This code

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


Works better than what you told me to edit some codes and put arrays on. This code is exactly what i'm looking for. Works fine now. Thanks :)

Now, can you tell me, if how to write and add the code in there if I want another member to be named "Moderator?" and with multiple ID number? Is it possible too?

Statistics: Posted by s2pidkaspr — December 21st, 2011, 11:50 am


]]>
2011-12-21T04:37:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58373#p58373 <![CDATA[Re: Displaying User Role on the Site]]>
peeld wrote:
That's why I'm asking you - did just that one line of code do the trick for you, or was there more code you had to put elsewhere, like in your s2-hacks file?


Code:
<?php echo $comment_author_access_label = get_user_field('s2member_access_label', ($comment->user_id)); ?>


That line of code in the comments loop should do it. Actually it doesn't even need the variable definition since it's being echoed and not used later. I only wrote that as an example earlier. You can do this:

Code:
<?php echo get_user_field('s2member_access_label', $comment->user_id); ?>


If you want to distinguish the admin from the rest, you could do something like this (change the 1 for your actual user ID):

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


I hope that helps. :)

Statistics: Posted by Cristián Lávaque — December 21st, 2011, 4:37 am


]]>
2011-12-21T04:24:32-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58372#p58372 <![CDATA[Re: Displaying User Role on the Site]]>
s2pidkaspr wrote:
Wow! It works now Christian. Thanks!
However, that code didn't worked itself, but the idea is.


Of course, you had to use the actual variable with the user ID in your code. I just wrote that variable to make it descriptive of what it should be. I'm glad you figured it out and got it working.

s2pidkaspr wrote:
But just to make it more detailed, i want users to know who is commenting, it may be a staff or just a regular/upgraded member. You get what i mean? So i'm hoping to use "s2member_access_role" instead for that. If ever its not possible to do what i want, then i think i'm going to stick using "s2member_access_label" which works fine to me.


For that you'd need to customize your code a little bit more... You could work with roles and then use an array to show the label you want for each, or check if the role has 's2member' in it and if so get the label.

s2pidkaspr wrote:
Again, thank you Christian and more power to s2member. :) Great support!


Thanks for the kudos! Glad to help. :)

Statistics: Posted by Cristián Lávaque — December 21st, 2011, 4:24 am


]]>
2011-12-20T22:49:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58346#p58346 <![CDATA[Re: Displaying User Role on the Site]]> http://classroom.daisypeel.com

Statistics: Posted by peeld — December 20th, 2011, 10:49 pm


]]>
2011-12-20T22:14:50-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58344#p58344 <![CDATA[Re: Displaying User Role on the Site]]> Statistics: Posted by s2pidkaspr — December 20th, 2011, 10:14 pm


]]>
2011-12-20T22:01:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=16301&p=58342#p58342 <![CDATA[Re: Displaying User Role on the Site]]> Statistics: Posted by peeld — December 20th, 2011, 10:01 pm


]]>