Protected Content Shortcodes Logic
-
Hi Guys,
I wonder if you could help me out with this, I just can’t get my head around the logic behind the protected content with the shortcodes.
Basically I have got the following scenario :
User Roles :
VISITOR ( visitor, not logged in, no role )
SUPERVISOR ( supervisor )
MANAGER ( manager )There is a contact page featuring the contact details. The following function is calling the print of the details :
<?php $order = array('company', 'address_1', 'address_2', 'city', 'postcode', 'state', 'country'); $result = array(); foreach($order as $elem){ if($user_meta[$elem][0] != "") $result[] = $user_meta[$elem][0]; } echo implode(', ', $result); ?>And this is what is supposed to happen :
VISITOR cannot see any contact details, just a note that says “Sign In or Register to view contact details”
SUPERVISOR can only see his own contact details and other supervisors contact details, but cannot see managers contact details.
MANAGER can see everybodys contact details including his own.
I’m not a php expert and trying to learn on this project. I’ve tried different variations with if(current_user_is), current_user_can, if user is logged in etc., + putting in the membership shortcodes [level-supervisor], [level-manager], but I just can’t make this thing work properly.
Would you be please able to show me the exact code to set this up ??
Many Thanks
The topic ‘Protected Content Shortcodes Logic’ is closed to new replies.