Advertisement
verygoodplugins

Untitled

Sep 18th, 2016
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. add_action( 'ld_added_group_access', 'my_add_group_access', 10, 2 );
  2.  
  3. function my_add_group_access( $user_id, $group_id ) {
  4.  
  5.     $settings = get_post_meta( $group_id, 'wpf-settings-learndash', true );
  6.  
  7.     if(empty($settings) || empty($settings['tag_link']))
  8.         return;
  9.  
  10.     wp_fusion()->user->apply_tags( $settings['tag_link'], $user_id );
  11.  
  12. }
  13.  
  14. add_action( 'ld_removed_group_access', 'my_remove_group_access', 10, 2 );
  15.  
  16. function my_remove_group_access( $user_id, $group_id ) {
  17.  
  18.     $settings = get_post_meta( $group_id, 'wpf-settings-learndash', true );
  19.  
  20.     if(empty($settings) || empty($settings['tag_link']))
  21.         return;
  22.  
  23.     wp_fusion()->user->remove_tags( $settings['tag_link'], $user_id );
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement