This is a good question. I took a look at the code. As far as I can tell, you can safely use this column as a “when did the user join the group” value for most cases. It’s set when:
* A user joins a group
* A user accepts or declines an invite to join a group
* When a user creates a group
Promoting/demoting a user to moderator/administrator/regular member doesn’t change the value.
Note that this column isn’t indexed. This is only a consideration if for whatever reason you need to write your own SQL queries, which you shouldn’t need to. If you can’t find a core function that gets the data you need, it would be great if you can let me know here or on https://buddypress.trac.wordpress.org/ and we can add one.
I don’t know of any core functions off the top of my head… It’s been a while since I’ve used WPDB but will take a look.
date_modified field contain the data of the latest group join ( ie: if the member join and leave then he join again a group, this field contain this date).
check the code of function groups_join_group( $group_id, $user_id = 0 )
Here a small code that can help you to fetch the join date
global $bp;
$user_id = 2; //user id
$group_id = 1; // your group id
$join_date_sql = $wpdb->prepare( "SELECT date_modified FROM {$bp->groups->table_name_members} WHERE is_confirmed = 1 AND is_banned = 0 AND user_id = %d AND group_id= %d", $user_id, $group_id );
$join_date = $wpdb->get_var( $join_date_sql );
I just found this function
<?php bp_group_member_joined_since(); ?
It does exactly what I need.
Thanks for the help.