-
-
Save jwenerd/71d22393a4d377fbfd21 to your computer and use it in GitHub Desktop.
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 | |
// This script will convert | |
// all confirmed buddy press friends to mutual followers | |
// if their friendship is not confirmed then the | |
// requestor of the friendship becomes a follower | |
// of the requestee | |
$_SERVER['HTTP_HOST'] = 'your-sit.come'; | |
ob_start(); | |
include('/var/www/wordpressmu/wp-load.php'); //replace with your path to wordpress wp-load.php | |
ob_end_clean(); | |
global $wpdb; | |
$sql = "SELECT * FROM wp_bp_friends"; // may need to repalce with your proper table prefix | |
$rows = $wpdb->get_results($sql, ARRAY_A); | |
foreach($rows as $row){ | |
// print_r($row); | |
extract($row); | |
$follow = new BP_Follow(); | |
$follow->bp_follow($initiator_user_id, $friend_user_id); | |
$follow->save(); | |
if($is_confirmed == 1){ | |
$follow = new BP_Follow(); | |
$follow->bp_follow($friend_user_id, $initiator_user_id ); | |
$follow->save(); | |
} | |
} |
I'd also like to know where to put this code. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can anyone tell me where to paste this code so that my buddypress friends can be converted to followers