Solved

changing role using s2member conditional shortcode

Posted on 2011-09-16
3
603 Views
Last Modified: 2012-05-12
I'm trying to use the following conditional inside a page but it seems the php code is still being executed inside the shortcode when admin hits the page:

[s2If current_user_is_not(administrator)]
[s2If current_user_is(s2member_level0)]
<?php $user = new WP_User(wp_get_current_user()->ID);
$user->set_role("s2member_level1"); ?>
[/s2If]
[/s2If]

does it look correct? I do have php execution plugin installed on the server.

If admin hits the page and that code executes, then admin role gets downgraded to level 1 which is not what I want.

Any suggestions?
0
Comment
Question by:COwebmaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 500 total points
ID: 36554184
According to the WP documentation there's a problem in nesting same type of short codes.
http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes

I'm not familiar with the s2member plugin, maybe you an combine the two conditions using AND operator?
0
 

Author Comment

by:COwebmaster
ID: 36554955
I tried that but is still downgrades the admin to level 1
0
 

Author Closing Comment

by:COwebmaster
ID: 36570601
Thanks!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question