Project

General

Profile

Bug #12275 » convert-bp-latest-update-to-array.php

Boone Gorges, 2020-01-09 02:40 PM

 
1
<?php
2

    
3
global $wpdb;
4

    
5
$updates = $wpdb->get_results( "SELECT * FROM {$wpdb->usermeta} WHERE meta_key = 'bp_latest_update' AND meta_value != ''" );
6

    
7
foreach ( $updates as $update ) {
8
	$unserialized = maybe_unserialize( $update->meta_value );
9
	if ( ! is_object( $unserialized ) ) {
10
		continue;
11
	}
12

    
13
	$array = (array) $unserialized;
14

    
15
	bp_update_user_meta( $update->user_id, 'bp_latest_update', $array );
16
}
(2-2/2)