Skip to content

Instantly share code, notes, and snippets.

@faishal
Created September 2, 2013 06:36
Show Gist options
  • Save faishal/6409816 to your computer and use it in GitHub Desktop.
Save faishal/6409816 to your computer and use it in GitHub Desktop.
User latest update Fix. add this code in theme/plugin and then call yoursite.com/?bp_latest_update_fix=true
if( ! function_exists ("bp_latest_update_fix" )){
function bp_latest_update_fix () {
global $wpdb;
$sql = "select * from $wpdb->usermeta where meta_key like 'bp_latest_update'";
$results = $wpdb->get_results ( $sql );
foreach ( $results as $row ) {
if ( $meta_value = maybe_unserialize ( $row->meta_value ) ) {
if ( is_array ( $meta_value ) ) {
if ( isset ( $meta_value[ "content" ] ) && strpos ( $meta_value[ "content" ], "update_txt" ) !== false ) {
$data_up = json_decode ( $meta_value[ "content" ] );
if ( isset ( $data_up->update_txt ) ) {
$meta_value[ "content" ] = urldecode ( $data_up->update_txt );
update_user_meta ( $row->user_id, 'bp_latest_update', $meta_value );
}
}
}
}
}
}
}
if ( isset ( $_REQUEST[ "bp_latest_update_fix" ] ) ) {
bp_latest_update_fix ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment