Advertisement
verygoodplugins

Untitled

Feb 28th, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. function fasting_and_fitness( $user_id, $user_tags ) {
  2.  
  3.     $fasting_and_fitness_tag = wp_fusion()->user->get_tag_id( 'fasting system And fitness program' );
  4.  
  5.     if ( wpf_has_tag( 'fasting system', $user_id ) && wpf_has_tag( 'fitness program', $user_id ) && ! wpf_has_tag( $fasting_and_fitness_tag, $user_id ) ) {
  6.  
  7.         // Add the "fasting system And fitness program" tag if they have "fasting system" and "fitness program"
  8.  
  9.         wp_fusion()->user->apply_tags( array( $fasting_and_fitness_tag ), $user_id );
  10.  
  11.     } elseif ( wpf_has_tag( $fasting_and_fitness_tag, $user_id ) && ! wpf_has_tag( 'fasting system', $user_id ) && ! wpf_has_tag( 'fitness program', $user_id ) ) {
  12.  
  13.         // Remove the "fasting system And fitness program" tag if they don't have "fasting system" and "fitness program"
  14.  
  15.         wp_fusion()->user->remove_tags( array( $fasting_and_fitness_tag ), $user_id );
  16.  
  17.     }
  18.  
  19. }
  20.  
  21. add_action( 'wpf_tags_modified', 'fasting_and_fitness', 20, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement