woocommerce - How do is show product by user role in wordpress? -


i have created 4 different user roles(administrator, designer, blogger, team) in wordpress different privileges. each user can post own product , requirement have created 4 pages show products according user role.

example: supposed logged administrator , add product.after logout when click on administrator page want show product have posted administrator. administrator if logged designer after logout @ designer page should show products posted designer. same process other user roles.

that's pretty easy in wordpress. check code.

$current_user = wp_get_current_user(); if($current_user->roles[0]=='administrator'){ //admin code }elseif($current_user->roles[0]=='designer'){ //designer code } elseif($current_user->roles[0]=='blogger'){ //blogger code } elseif($current_user->roles[0]=='team'){ //team code } 

Comments

Popular posts from this blog

How to show in django cms breadcrumbs full path? -

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -