Created
September 2, 2013 06:36
-
-
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
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
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