-
-
Save webpolk/db79a452eb2ad73a9669 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-site.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($initiator_user_id, $friend_user_id); | |
$follow->save(); | |
if($is_confirmed == 1){ | |
$follow = new BP_Follow($friend_user_id, $initiator_user_id); | |
$follow->save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment