Skip to:
Content
Pages
Categories
Search
Top
Bottom

BUG: Follow count doesn’t update when a member is deleted from the site

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of rossagrant
    rossagrant
    Participant

    @rossagrant

    Anyone got any ideas on this?

    Avatar of abcde666
    abcde666
    Participant

    @erich73

    can this get fixed, please ?

    http://trac.buddypress.org/ticket/2476

    Many thanks.

    Avatar of Anton
    Anton
    Participant

    @antonrsa

    No response in 3 weeks so I guess it can’t be fixed

    @apeatling needs hooks for


    add_action( 'wpmu_delete_user'
    add_action( 'delete_user'
    add_action( 'make_spam_user'

    function follow_deleted( $user_id ) {
    global $wpdb, $bp;

    $wpdb->query( $wpdb->prepare( “DELETE FROM {$bp->follow->table_name} WHERE leader_id = %d”, user_id ) );
    $wpdb->query( $wpdb->prepare( “DELETE FROM {$bp->follow->table_name} WHERE follower_id = %d”, user_id ) );

    }

    add_action( ‘wpmu_delete_user’, ‘follow_deleted’ );
    add_action( ‘delete_user’, ‘follow_deleted’ );
    add_action( ‘make_spam_user’, ‘follow_deleted’ )

    @phartes, and where would I trigger this function…, somewhere in bp-core?

    Avatar of Andrew Tegenkamp
    Andrew Tegenkamp
    Participant

    @andrewteg

    @GooseNL, should just be able to add that into bp-custom.php or your theme’s functions.php file. It would only get called based on the actions which is when a user is deleted or made a spam user.

    Ah ok… i figured out what was going on, the $ sign was missing in front of the user_id. For all you quick copy’n’pasters (like myself), the correct code is as below:

    `
    function follow_deleted( $user_id ) {
    global $wpdb, $bp;

    $wpdb->query( $wpdb->prepare( “DELETE FROM {$bp->follow->table_name} WHERE leader_id = %d”, $user_id ) );
    $wpdb->query( $wpdb->prepare( “DELETE FROM {$bp->follow->table_name} WHERE follower_id = %d”, $user_id ) );

    }

    add_action( ‘wpmu_delete_user’, ‘follow_deleted’ );
    add_action( ‘delete_user’, ‘follow_deleted’ );
    add_action( ‘make_spam_user’, ‘follow_deleted’ );
    `

    Thanks guys, it made me one Happy Camper :-)

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.