I used these lines of code for the WP E-Commerce-Role-Discount Plugin but also in my template to customize the page for special users.
I have a role”haet_rolediscount_premium_customer” and a function “isPremiumCustomer()” in my themes functions.php
You can customize the function for any role, but you have to use the slug, not the displayname.
function isPremiumCustomer(){ global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if($user_role=='haet_rolediscount_premium_customer') return true; return false; }
Anywhere else in your theme you can check for the role with the following line of code:
if( isPremiumCustomer() ){ ... }
Use this to extend a few features for the WP E-Commerce-Role-Discount Plugin or change the function t fit your needs
I used these lines of code for the WP E-Commerce-Role-Discount Plugin but also in my template to customize the page for special users.
I have a role”haet_rolediscount_premium_customer” and a function “isPremiumCustomer()” in my themes functions.php
You can customize the function for any role, but you have to use the slug, not the displayname.
function isPremiumCustomer(){ global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if($user_role=='haet_rolediscount_premium_customer') return true; return false; }
Anywhere else in your theme you can check for the role with the following line of code:
if( isPremiumCustomer() ){ ... }
Use this to extend a few features for the WP E-Commerce-Role-Discount Plugin or change the function t fit your needs