Support » Plugin: Groups » No Group ID when User Joins or Leaves

  • Resolved Zabelator

    (@zabelator)


    I am trying to set up records for when users join and leave groups. The actions for:

    • groups_created_user_group
    • groups_deleted_user_group

    return a user ID, but I am not getting the Group ID.

    
    function left_group_record( $user_id, $group_id ) {
    	
    	$meta_key = "left_group";	
    	$meta_value = $group_id;
    	$unique = true;	
    	add_user_meta( $user_id, $meta_key, $meta_value, $unique );
    }
    add_action( 'groups_deleted_user_group','left_group_record');
    
    • This topic was modified 8 months ago by  Zabelator.
Viewing 1 replies (of 1 total)
  • Plugin Author Kento

    (@proaktion)

    When you add the action, you must indicate the number of parameters, otherwise it just assumes one, i.e. :

    add_action( 'groups_deleted_user_group', 'left_group_record', 10, 2 );

Viewing 1 replies (of 1 total)
  • The topic ‘No Group ID when User Joins or Leaves’ is closed to new replies.