?
Solved

changing role using s2member conditional shortcode

Posted on 2011-09-16
3
Medium Priority
?
625 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 2000 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
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…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

771 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