Home › Forums › Community Forum › PHP not working on Login Welcome Page
This topic contains 11 replies, has 3 voices. Last updated by Colin Kells 3 years, 12 months ago.
Topic Author | Topic |
---|---|
Posted: Tuesday Jan 8th, 2013 at 1:35 pm #36592 | |
|
|
Unable to get PHP working on Login Welcome page, [s2 — works ok. Some premium content for Level 1 Members. [/s2If] [s2If current_user_is(s2member_level0)] Some content for Free Subscribers. [/s2If] [s2If !current_user_can(access_s2member_level0)] Some public content. [/s2If]
Problem is that neither of the PHP conditions show, seems like PHP is not working. PHP exec is enabled for each user level.
|
List Of Topic Replies
Author | Replies |
---|---|
Author | Replies |
Posted: Wednesday Jan 9th, 2013 at 7:06 am #36727 | |
|
|
Did you post the PHP code in the text tab? Don’t switch to the visual tab or the code won’t work. Now, if you have the PHP execution plugin correctly installed, PHP should execute… You can also try other PHP exec plugins. |
|
Posted: Wednesday Jan 9th, 2013 at 1:10 pm #36794 | |
|
|
Hi Cristian Code was inserted in TEXT mode. I have added the line below and the ws_table works fine.
|
|
Posted: Saturday Jan 12th, 2013 at 8:06 am #37124 | |
|
|
I see. That’s odd then, those conditions should be fine… Could you try this conditional taken from the documentation examples? [hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals -> Example 3[/hilite] [hilite pre_code]Some premium content for Level 4 Members. Some premium content for Level 3 Members. Some premium content for Level 2 Members. Some premium content for Level 1 Members. Some content for Free Subscribers. Some public content. [/hilite] [hilite mono]"s2member_leveln"[/hilite] is the WP role, which you can see with a plugin like User Role Editor. |
|
Posted: Saturday Jan 12th, 2013 at 3:37 pm #37173 | |
|
|
Ok I have changed from “Role Manager” to “User Role Editor” this does seem a lot better to use. Have reset S2 member levels and labels. Removed test users and created new users. Using the following code
Login using s2member level0 – I get displayed Login using s2member level1 – I also get displayed This is the problem its seeing all logons as Free Subs. I’ll look throught the articles that you have included in your reply. |
|
Posted: Saturday Jan 12th, 2013 at 3:51 pm #37176 | |
|
|
If I use the following code from your article.
And use the following S2 [s2If current_user_is(subscriber)] Logon as Subsriber both PHP and S2 return Logon as Level 1 |
|
Posted: Sunday Jan 13th, 2013 at 4:15 am #37226 | |
![]() |
|
Thanks for the heads up on this thread :-)I’m reviewing this thread, and I will reply shortly for you :-) |
|
Posted: Sunday Jan 13th, 2013 at 9:20 am #37240 | |
![]() |
|
Investigation completed – thanks for your patience.I just ran the same test you did, together with the shortcode conditionals as well.
If I login as a Free Subscriber, I get:
If I login as a Level #1 Member, I get:
In short, I’ve been unable to reproduce this on a clean WordPress installation. It sounds to me like your Roles/Capabilities might have become corrupted in some way. Or, I suppose it’s possible that you have another theme/plugin conflicting with s2Member in some way? Possible solutions.
Please let us know if problems persist :-) |
|
Posted: Sunday Jan 13th, 2013 at 2:04 pm #37284 | |
|
|
Hi Jason Thank you for your reply and help. I have tried the Rest Roles several times. Can you please confirm that you ran the tests on the S2 protected login page and that this was done on Word Press 3.5 ? The following piece of code works fine and returns the correct condition for the Level 1 member ID
Which to me looks like a problem in the if(current_user_is(“s2member_level1”)). The function http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_current_user_is%28%29 “Since: |
|
Posted: Sunday Jan 13th, 2013 at 2:13 pm #37286 | |
![]() |
|
Thanks for the follow-up :-)
Yes, my test was run against WordPress v3.5 and WordPress v3.6 alpha.
This is referring to the s2Member version number, which was (in the beginning) based on traditional version numbers instead of the dated format we use now. The last time this s2Member function changed was about 2 years ago. Please let me know if you find out anything more,
|
|
Posted: Sunday Jan 13th, 2013 at 4:06 pm #37303 | |
|
|
Hi I have changed the Theme to a WP default theme and still have the same challenge. I have noted in the settings of Exec PHP that its reffering to users permitted on articles and not pages. What pluggin does S2 Member suggest for PHP and User Role Edit? After this I’ll try fresh installed WP and S2 on another site
|
|
Posted: Sunday Jan 13th, 2013 at 4:57 pm #37307 | |
|
|
Work around solution. There really is something wrong with if(current_user_is(“s2member_level[1-4]″)) on my site. |
This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.