Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OERu
register-enrol
Commits
55f7cab5
Commit
55f7cab5
authored
May 04, 2019
by
Dave Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated to 0.9.1, fixed argument mismatch in edit_profile
parent
5ec6d9a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
includes/ore_app.php
includes/ore_app.php
+17
-4
register-enrol.php
register-enrol.php
+2
-2
No files found.
includes/ore_app.php
View file @
55f7cab5
...
...
@@ -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
;
}
...
...
register-enrol.php
View file @
55f7cab5
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment