Community Support Forums — WordPress® ( Users Helping Users ) — 2011-06-14T17:02:55-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=6688 2011-06-14T17:02:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20733#p20733 <![CDATA[Re: Style comments depending on the s2member custom role]]>
Code:
<?php echo(get_user_field ("s2member_access_label", $comment->user_id));?>

So now I can style comments depending on the role.
Thanks.

Statistics: Posted by carblanco — June 14th, 2011, 5:02 pm


]]>
2011-06-14T00:25:01-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20660#p20660 <![CDATA[Re: Style comments depending on the s2member custom role]]> Thanks for the excellent question.

You can use this API Constant to get the current User's Membership Level Label.
This code snippet can go into a Post/Page editor for WordPress.
Code:
[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LABEL" /]

Also see this documentation:
viewtopic.php?f=40&t=9011&src_doc_v=110605#src_doc_S2MEMBER_CURRENT_USER_ACCESS_LABEL


Or use this API Constant to get the current User's Level #.
This code snippet can go into a Post/Page editor for WordPress.
Code:
[s2Get constant="S2MEMBER_CURRENT_USER_ACCESS_LEVEL" /]

Also see this documentation:
viewtopic.php?f=40&t=9011&src_doc_v=110605#src_doc_S2MEMBER_CURRENT_USER_ACCESS_LEVEL


Another VERY useful API function is: get_user_field()
viewtopic.php?f=40&t=9015&src_doc_v=110605#src_doc_get_user_field%28%29


Or, if you just need to map a specific User ID to a specific Membership Level #, you can do this.
Code:
<?php
$user_id 
= 123;
$user = new WP_User($user_id);
echo c_ws_plugin__s2member_user_access::user_access_level($user);
?>
For further details, please take a look at the User Access Package:
viewtopic.php?f=40&t=9477&src_doc_v=110605

Statistics: Posted by Jason Caldwell — June 14th, 2011, 12:25 am


]]>
2011-06-08T03:25:05-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20403#p20403 <![CDATA[Re: Style comments depending on the s2member custom role]]>
Code:
<?php } else if ( $user_meta->wp_capabilities == 'a:1:\{s:15:\"s2member_level2\";s:1:\"1\";\}' ){ ?>
?

Statistics: Posted by carblanco — June 8th, 2011, 3:25 am


]]>
2011-06-07T15:29:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20363#p20363 <![CDATA[Re: Style comments depending on the s2member custom role]]>
Before I had:
wp_capabilities->a:1:{s:15:"s2member_level3";s:1:"1";} and then wp_user_level->9
wp_capabilities->a:1:{s:15:"s2member_level2";s:1:"1";} and then wp_user_level->8
...
And instead of having "s2member_level3" I had the custom label "Enterprise". It seems like all the labels have been gone.

Why?

Statistics: Posted by carblanco — June 7th, 2011, 3:29 pm


]]>
2011-06-06T16:05:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20253#p20253 <![CDATA[Re: Style comments depending on the s2member custom role]]>

Statistics: Posted by Cristián Lávaque — June 6th, 2011, 4:05 pm


]]>
2011-06-06T05:26:46-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20211#p20211 <![CDATA[Re: Style comments depending on the s2member custom role]]>
Then I must to use something like
Code:
<?php $user_meta get_userdata$comment->user_id ); ?>
                <?php if ( $user_meta->wp_user_level == 10 ){ ?>
                Level4
                <?php } else if ( $user_meta->wp_user_level == ){ ?>
                Level3
                <?php } else if ( $user_meta->wp_user_level == ){ ?>
                Level2
                <?php } else if ( $user_meta->wp_user_level == ){ ?>
                Level1
                <?php } else if ( $user_meta->wp_user_level == ){ ?>
                Level0
                <?php ?>

Which is actually working ;-)

Thanks again.

Statistics: Posted by carblanco — June 6th, 2011, 5:26 am


]]>
2011-06-06T04:55:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20204#p20204 <![CDATA[Re: Style comments depending on the s2member custom role]]> http://codex.wordpress.org/Function_Ref ... t_userdata

Statistics: Posted by Cristián Lávaque — June 6th, 2011, 4:55 am


]]>
2011-06-06T04:00:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=20193#p20193 <![CDATA[Re: Style comments depending on the s2member custom role]]>
My question is more like that: viewtopic.php?f=4&t=6692&p=20088#p20088

I'm using something like
Code:
<?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>
just to put the role under the comment. But the problem is that with this code I'm showing the author post role instead of the commenter role.

How can I extract the s2member membership level of the commenter?

Statistics: Posted by carblanco — June 6th, 2011, 4:00 am


]]>
2011-06-04T09:51:07-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=16708#p16708 <![CDATA[Re: Style comments depending on the s2member custom role]]> WP Admin -> Settings -> Discussion -> Users must be registered and logged in to comment

For the other things you'd need to edit the comments template to add the role label and conditionals to change the style based on the role (you can add classes to use as selectors from the CSS file).

I hope that helps. :)

Statistics: Posted by Cristián Lávaque — June 4th, 2011, 9:51 am


]]>
2011-06-04T03:42:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=6688&p=16702#p16702 <![CDATA[Style comments depending on the s2member custom role]]>
Basically I need to put in each comment the role of that user. I mean, if someone comments I'd like to put their custom s2member role (level0, level1) under the name. For commenting the user have to be registered.

And some more sophisticated, style the comment depending on the role.

Can you help me?

Statistics: Posted by carblanco — June 4th, 2011, 3:42 am


]]>