Commit 55f7cab5 authored by Dave Lane's avatar Dave Lane

updated to 0.9.1, fixed argument mismatch in edit_profile

parent 5ec6d9a4
......@@ -572,7 +572,8 @@ class OREMain extends OREBase {
return $errors;
// if not, proceed with creating the user!
} else {
return $this->edit_existing_user($user_id, $first, $last, $display, $exiting_email, $email, $country, $user);
$username = $user->data->user_login;
return $this->edit_existing_user($user_id, $username, $first, $last, $display, $exiting_email, $email, $country, $user);
}
}
}
......@@ -711,11 +712,11 @@ class OREMain extends OREBase {
unset($current->data->user_pass);
} else {
if (!($current = get_userdata($user_id))){
//$this->log('There is no user associated with user_id: '.$user_id);
$this->log('There is no user associated with user_id: '.$user_id);
return false;
}
}
//$this->log('current user: '.print_r($current, true));
$this->log('current user: '.print_r($current, true));
// initialise this with the default values
//$user = $this->data;
$user = array();
......@@ -727,6 +728,7 @@ class OREMain extends OREBase {
$user['email'] = $current->data->user_email;
$user['display_name'] = $current->data->display_name;
$user['country'] = $this->get_country($user_id);
//$this->log('user up to this point: '.print_r($user, true));
$user['country_name'] = $this->get_country_name($user['country']);
$user['profile_url'] = $this->get_profile_url($user_id);
$user['avatar_url'] = explode('?', get_avatar_url($user_id,
......@@ -773,6 +775,7 @@ class OREMain extends OREBase {
public function set_country($id, $val) { return $this->set_meta($id, 'usercountry', $val); }
public function get_country_name($country_code) {
global $country_selector;
$this->log("country code = ".print_r($country_code, true));
if ($country_name = $country_selector[$country_code]['default']) { return $country_name; }
return false;
}
......@@ -785,11 +788,21 @@ class OREMain extends OREBase {
}
// returns gets meta value if set, otherwise returns null
public function get_meta($id, $key) {
if ($val = get_user_meta($id, $key, true)) { return $val; }
if ($val = get_user_meta($id, $key, true)) {
if ($val instanceof WP_User) {
delete_user_meta($id, $key, $val);
return null;
}
//$this->log('getting meta for user '.$id.' and key '.$key.', resulting in '.$val);
return $val;
}
return null;
}
// returns true if value is set, false otherwise
public function set_meta($id, $key, $val) {
if ($val instanceof WP_User) {
return false;
}
if (update_user_meta($id, $key, $val)) { return true; }
return false;
}
......
......@@ -8,7 +8,7 @@ Plugin URI: https://github.com/oeru/register-enrol
Description: Provides a widget that helps a user figure out the valid URL for
their personal course blog feed. Parts are adapted from Login with Ajax by
Markus Sykes - http://wordpress.org/extend/plugins/login-with-ajax/
Version: 0.9.0
Version: 0.9.1
Author: Dave Lane
Author URI: https://oeru.org, http://WikiEducator.org/User:Davelane
License: GPLv3 or later
......@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
define( 'ORE_VERSION', '0.9.0' );
define( 'ORE_VERSION', '0.9.1' );
// plugin computer name
define('ORE_NAME', 'ORE');
// current version
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment