Created
March 14, 2016 10:59
-
-
Save champsupertramp/191a95ae3212ceb8085d to your computer and use it in GitHub Desktop.
Ultimate Member - Follower Extensions - Auto-follow specific users on registration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('um_after_new_user_register','um_auto_follow_artists',10,2); | |
function um_auto_follow_artists( $user_id, $args ){ | |
global $ultimatemember, $um_followers; | |
$follow_users = array( | |
'rjtmusic', | |
'james-peacock', | |
'carl-thomson', | |
'jonathan-proud', | |
'stu-dawson', | |
'carly-mckee', | |
); | |
foreach( $follow_users as $username ){ | |
$follow_user = get_user_by( 'login', $username ); | |
$um_followers->api->add( $follow_user->ID, $user_id ); | |
} | |
} | |
?> |
Hello
Hi @emmyloaded,
IF you want the newly registered user to follow specific users by ID, you can try the following:
add_action('um_user_register','um_auto_follow_members',5,2); function um_auto_follow_members( $user_id, $args ){ $follow_users_IDs = array( 1, 33, 444, ); foreach( $follow_users_IDs as $follow_user_id ){ UM()->Followers_API()->api()->add( $follow_user_id, $user_id ); } }
$user_id
- this is the ID of the newly registered user
$follow_users_IDs
- these are the user IDs who will be followed by the newly registered user.Regards,
Please explain this better please.. I don’t understand to use this
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have tried it my follower is not increasing