コード例 #1
0
/**
 * When a user is deleted, we need to clean up the database and remove all the
 * profile data from each table. Also we need to clean anything up in the
 * usermeta table that this component uses.
 *
 * @package BuddyPress XProfile
 * @param int $user_id The ID of the deleted user
 */
function xprofile_remove_data($user_id)
{
    BP_XProfile_ProfileData::delete_data_for_user($user_id);
}
コード例 #2
0
/**
 * When a user is deleted, we need to clean up the database and remove all the
 * profile data from each table. Also we need to clean anything up in the usermeta table
 * that this component uses.
 *
 * @package BuddyPress XProfile
 * @param $user_id The ID of the deleted user
 * @uses get_user_meta() Get a user meta value based on meta key from nxt_usermeta
 * @uses delete_user_meta() Delete user meta value based on meta key from nxt_usermeta
 * @uses delete_data_for_user() Removes all profile data from the xprofile tables for the user
 */
function xprofile_remove_data($user_id)
{
    BP_XProfile_ProfileData::delete_data_for_user($user_id);
    // delete any avatar files.
    @unlink(get_user_meta($user_id, 'bp_core_avatar_v1_path', true));
    @unlink(get_user_meta($user_id, 'bp_core_avatar_v2_path', true));
    // unset the usermeta for avatars from the usermeta table.
    delete_user_meta($user_id, 'bp_core_avatar_v1');
    delete_user_meta($user_id, 'bp_core_avatar_v1_path');
    delete_user_meta($user_id, 'bp_core_avatar_v2');
    delete_user_meta($user_id, 'bp_core_avatar_v2_path');
}