php if statement need help
-
howdy everyone,
im working on a my accounts page for a subscription based website and i would like to display the user role. only problem is im using the s2member plugin and the user roles come up as something like this, ” s2member_level1.” within wordpress they all have nice labels such as 3 month subscription which = s2member_level1 … and 6 month subscription which = s2member_level2 … and so on. Ive got the code made up to pull up the user role and echo 3 month subscription when the current users role is set to s2memberlevel1. only problem is i need to have it display a 6 month subscription and a 1 year subscription accordingly. having a little trouble… i would greatly appreciate the help if someone could help me fix my code. i think its close
<?php
global $wp_roles;foreach ( $wp_roles->role_names as $role => $name ) :
if ( current_user_can( $role ) )
if ( $role = "s2member_level1 " ) ;{
echo "3 Month Subscription
";if ( $role = "s2member_level2 " ) {
echo "6 Month Subscription
";if ( $role = "s2member_level3 " ) {
echo "1 Year Subscription
";}
}}endforeach;
?>
- The topic ‘php if statement need help’ is closed to new replies.