Skip to content

Followers Actions

Available Actions

All follower-related actions are documented in the User Actions page:

fluent_community/followed_user

Fires when a user follows another user.

View Documentation →


fluent_community/before_unfollowing_user

Fires before a user unfollows another user.

View Documentation →


Quick Examples

Track Follower Count

php
add_action('fluent_community/followed_user', function($followedUser, $followerUser) {
    $follower_count = get_user_meta($followedUser->ID, 'follower_count', true) ?: 0;
    update_user_meta($followedUser->ID, 'follower_count', $follower_count + 1);
}, 10, 2);

Notify on New Follower

php
add_action('fluent_community/followed_user', function($followedUser, $followerUser) {
    wp_mail(
        $followedUser->user_email,
        'New Follower',
        sprintf('%s is now following you!', $followerUser->display_name)
    );
}, 10, 2);

Award Badge for Follower Milestones

php
add_action('fluent_community/followed_user', function($followedUser, $followerUser) {
    $follower_count = get_user_meta($followedUser->ID, 'follower_count', true) ?: 0;
    
    $milestones = [10 => 'popular', 50 => 'influencer', 100 => 'celebrity'];
    
    foreach ($milestones as $count => $badge) {
        if ($follower_count === $count) {
            $badges = get_user_meta($followedUser->ID, 'community_badges', true) ?: [];
            $badges[] = $badge;
            update_user_meta($followedUser->ID, 'community_badges', $badges);
            
            do_action('fluent_community/notify_user', $followedUser->ID, [
                'type' => 'badge_earned',
                'badge' => $badge
            ]);
        }
    }
}, 10, 2);

See Also

Fluent Community developer documentation