Advertisement
verygoodplugins

Untitled

Nov 20th, 2018
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. function set_role_from_tags( $user_id, $user_tags ) {
  2.  
  3.     if( in_array( 'Compro Premium Gold' , $user_tags ) ) {
  4.  
  5.         $user = new WP_User( $user_id );
  6.         $user->add_role( 'premium_gold' );
  7.  
  8.         if( in_array( 'Usario Free', $user_tags ) ) {
  9.  
  10.             wp_fusion()->user->remove_tags( array( 'Usario Free' ), $user_id );
  11.  
  12.         }
  13.  
  14.     }
  15.  
  16. }
  17.  
  18. add_action( 'wpf_tags_applied', 'set_role_from_tags', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement