Advertisement
verygoodplugins

Untitled

Nov 12th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. function remove_previous_download_tags( $user_id, $tags ) {
  2.  
  3.     // If Level 2 is applied, remove Level 1
  4.  
  5.     if ( in_array( 'Level 2', $tags ) ) {
  6.  
  7.         $remove = array( 'Level 1' );
  8.  
  9.         wp_fusion()->user->remove_tags( $remove, $user_id );
  10.  
  11.     }
  12.  
  13.     // If both Level 2 and Foo were applied at the same time, remove both Level 1 and Bar
  14.  
  15.     if ( in_array( 'Level 2', $tags ) && in_array( 'Foo', $tags ) ) {
  16.  
  17.         $remove = array( 'Level 1', 'Bar' );
  18.  
  19.         wp_fusion()->user->remove_tags( $remove, $user_id );
  20.  
  21.     }
  22.  
  23. }
  24.  
  25. add_action( 'wpf_tags_applied', 'remove_previous_download_tags', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement