Forums

[resolved] [Plugin: Extended User Profile] Quick patch for WordPress 2.9.2 (and possibly lower) (1 post)

  1. Simon Fransson
    Member
    Posted 2 years ago #

    After upgrading to WordPress 2.9.2 Extended User Profile was unable to save any extended profile information. This is because the plugin can't retrieve the user id of the user edited. A quick modification to the eup_save() function solves this issue. Instead of using the global (maybe now even inexistent $user_ID) we'll use the id-argument supplied by the profile_update hook.

    //======================================
    // Description: Hack to save the metadata in $wpdb->usermeta ( Called in wp-admin/users.php and wp-admin/profile.php )
    function eup_save($id){
    global $wpdb, $user_ID;
    
    	if (empty($id) || !$id) {
    		if (preg_match('&profile.php&', $_SERVER['REQUEST_URI'])) {
    			$id = $user_ID;
    		}
    		elseif($_GET['user_id']) {
    			$id = $_GET['user_id'];
    		}
    	}
    
    	foreach($_POST as $key => $value) {
    		if (preg_match('&eup_&', $key) && $key != 'eup_value' && $key != 'eup_meta' && $value) {
    			$profile[$key] = $value;
    		}
    	}
    
    	update_usermeta($id, 'eup_profile', $profile);
    }

    http://wordpress.org/extend/plugins/extended-user-profile/

Topic Closed

This topic has been closed to new replies.

About this Topic