Advertisement
verygoodplugins

Untitled

Dec 30th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1.                 // Logger
  2.                 wp_fusion()->logger->handle( 'info', $user_id, 'Removing Ultimate Member role <strong>' . $label . '</strong> from linked tag <strong>' . wp_fusion()->user->get_tag_label( $tag_id ) . '</strong>', array( 'source' => 'ultimate-member' ) );
  3.  
  4.                 $user->remove_role( $slug );
  5.  
  6.                 if ( empty( $user->roles ) ) {
  7.  
  8.                     // We don't want to leave someone with no role so we'll assign the UM default role
  9.  
  10.                     $default_role = UM()->options()->get( 'register_role' );
  11.  
  12.                     if ( empty( $default_role ) ) {
  13.                         $default_role = get_option( 'default_role' );
  14.                     }
  15.  
  16.                     wp_fusion()->logger->handle( 'info', $user_id, 'User was left with no role so assigning default role <strong>' . $default_role . '</strong>.', array( 'source' => 'ultimate-member' ) );
  17.  
  18.                     um_fetch_user( $user_id );
  19.                     UM()->roles()->set_role( $user_id, $default_role );
  20.  
  21.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement