- This topic has 3 replies, 2 voices, and was last updated 10 years, 11 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Using member ids in theme
Hello,
I love your plugin, but I was wondering is I can use the member id’s to show content in the wordpess theme itself?
Here is an example of what I mean. (sorry
<?php
$user_id = get_current_user_id();
$group = Groups_Group::read_by_name( 'member' );
if ( Groups_User_Group::read( $user_id, $group->group_id ) ) :
?>
content for members here
<?php else: ?>
content for nonmember here
<?php endif;?>
if you are looking for wordpress member id then you can use this approach. but this is not going to give you simple membership user id (which is different from wordpress user id). to get simple membership user id, you can do this:
$auth = BAuth::get_instance();
if ($auth->is_logged_in()){
$member_id = $auth->get('member_id');
// content for members
}
else{
// content for non-members
}
Thank you so much! this is just what i need!
I do have a little problem tough, i get a error.
syntax error, unexpected '&'
and it is in this line:
if ($auth->is_logged_in()):
edit: something strange must have happened.. My mail client changes the -> to “&”