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.

Accessing S2 Member Data in a Post/Page/Widge

Home Forums Community Forum Accessing S2 Member Data in a Post/Page/Widge

This topic contains 3 replies, has 2 voices. Last updated by  Eduan 4 years, 5 months ago.

Topic Author Topic
Posted: Wednesday Jul 25th, 2012 at 5:00 am #20177

I’m stumbled on various forum posts and some articles here a S2Member concerning accessing S2Member variables within posts, pages, and widgets. And of course i have some questions:

(1) Some articles recommend the Exec-PHP plugin. I installed the plugin (I’m still in design and test mode) and it seems to be working. But I notice it’s not “officially” tested beyond WP 2.8. Do you still recommend this plugin, or do you have other alternatives you prefer? Now that I know I can embed PHP code in a post/page, I don’t think I could live without it.

(2) In a couple of forum posts I noticed code like [S2If …. ] …. [S2EndIf]. And of course there are functions being used such as current_user_can() and current_user_is(). This is very cool indeed. Where can I get a list of the statements and functions that work inside HTML this way?

(3) In some cases i merely want to do something like display the member’s first name as in “Welcome back Bruce!”. I can do this with the Exec-PHP plugin. Is there a way to do this without needing the plugin? Maybe the S2 statements noted in #2?

(4) I learned we can have different pages display at login based on the number of logins and the membership level. Can we do a similar thing based on days? For example, at 30 days a member_level1 will be directed to an upgrade page, or at 90 days a member_level3 will be directed to a survey. I would want to base the “days” as “days within the given membership level” rather than since the initial signup.

As I mentioned, I’m still in design and testing mode, so I’m willing to try just about anything. Every day I’m finding new things that I can do with S2Member.

Thanks in advance.

Bruce,

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Wednesday Jul 25th, 2012 at 11:50 am #20209
Eduan
Username: Eduan
Moderator

Hello Bruce,

(1) Some articles recommend the Exec-PHP plugin. I installed the plugin (I’m still in design and test mode) and it seems to be working. But I notice it’s not “officially” tested beyond WP 2.8. Do you still recommend this plugin, or do you have other alternatives you prefer? Now that I know I can embed PHP code in a post/page, I don’t think I could live without it.

I do sometimes doubt this myself, most plugins that work like this are very old, although I’m pretty sure it shouldn’t matter, since it probably just checks for the PHP tags and just tells WordPress to treat that as PHP.

(2) In a couple of forum posts I noticed code like [S2If …. ] …. [S2EndIf]. And of course there are functions being used such as current_user_can() and current_user_is(). This is very cool indeed. Where can I get a list of the statements and functions that work inside HTML this way?

Yes you can, you can find them under Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals and Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals, here’s an article about them:
Knowledge Base » s2Member® Conditionals

(3) In some cases i merely want to do something like display the member’s first name as in “Welcome back Bruce!”. I can do this with the Exec-PHP plugin. Is there a way to do this without needing the plugin? Maybe the S2 statements noted in #2?

You can find a under Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants.

(4) I learned we can have different pages display at login based on the number of logins and the membership level. Can we do a similar thing based on days? For example, at 30 days a member_level1 will be directed to an upgrade page, or at 90 days a member_level3 will be directed to a survey. I would want to base the “days” as “days within the given membership level” rather than since the initial signup.

I believe you will be able to do this with the documentation under Dashboard -› s2Member® -› API / Scripting -› Content Dripping, here’s an article about it:
Knowledge Base » Introduction to Content Dripping in s2Member®

Hope this helps. :)

Posted: Wednesday Jul 25th, 2012 at 6:10 pm #20232

Thanks for the detailed response.

As for Exec-PHP, if enough developers are using the plugin without issues then I tend to relax a bit. Executing PHP code should be built into WordPress. I’ve been doing WordPress for a couple of years but i tend to shy away from plugins in favor of code. But this is one plugin that has already earned it’s place in my toolkit.

I’ll be studying your links. Thanks for pointing me in the right direction.

Bruce,

Posted: Wednesday Jul 25th, 2012 at 8:17 pm #20242
Eduan
Username: Eduan
Moderator

Yes I understand your point, I usually try to try it myself instead of using reviews, of course reviews give me an idea if something is better or not.

Glad I was able to help. :)

Viewing 3 replies - 1 through 3 (of 3 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.