latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Show different content to non-logged-in users

Home Forums Community Forum Show different content to non-logged-in users

Tagged: ,

This topic contains 2 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 4 months ago.

Topic Author Topic
Posted: Wednesday Aug 29th, 2012 at 7:40 pm #23486
uywi
Username: thomasjterry

I’m already familiar with how to use shortcodes to show different content to Level 1 vs Level 0 members, but is there a way to distinguish between a Logged-In Level 0 member (a member who was previously Level 1 but their membership expired) versus a web user who is not logged to the site.

I want to show the not-logged-in user a “Please login” button, and show the Level 0 person a renewal form.

Is there any way to do this with shortcodes?

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Wednesday Aug 29th, 2012 at 8:14 pm #23488
cassel
Username: cassel

Yes you can. That is done with shortcodes and conditionals. For example, in s2Member > API/Scripting > Simple/Shortcode conditionals. The very first example does exactly what you are looking for:

[s2If is_user_logged_in()]
Content for anyone that is logged in, regardless of their Membership Level.
[/s2If] [s2If !is_user_logged_in()]
Some public content or invitation to log in. They’re NOT logged in.
A leading !exclamation means false.
[/s2If]

I use that on my own site. For example, the forum page is only accessible if you are logged in.
http://scrapbookcampus.com/forums/

If you were logged in, you would see the welcome paragraph and the forum itself.

Posted: Thursday Aug 30th, 2012 at 8:01 am #23564

Yes you can. That is done with shortcodes and conditionals. For example, in s2Member > API/Scripting > Simple/Shortcode conditionals.

That’s correct. :)

Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.