Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Can I use is_user_logged_in to manage content for different roles?

Example:

If subscribevr user is logged in.... show content.... else show "you are not logged in"

and on anonther page

if contributor user is logged in.... show content.... else show "must be logged in or be a contributor so view this content"

Does anybody know a good code I can solve this with?

share|improve this question
add comment

2 Answers 2

This thread at wordpress.org - http://wordpress.org/support/topic/content-shown-based-on-user-role - suggests using the 'current_user_can' function

This thread - http://wordpress.org/support/topic/display-a-custom-image-only-if-user-role-is-contributor - suggests you can use it like 'current_user_can('contributor')' for different roles.

I haven't tried it but it sounds like it should work.

share|improve this answer
add comment

Also, this plugin might do the job: http://wordpress.org/extend/plugins/role-scoper/

(Had to add a 2nd answer as I'm a new user and only allowed to add 2 links within my answer)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.