Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Must check if user exists. #56

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions WP_Auth0.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,15 +686,12 @@ function get_currentauth0userinfo() {
global $wpdb;

get_currentuserinfo();
if ($current_user instanceof WP_User && $current_user->ID > 0 ) {
if ($current_user instanceof WP_User && $current_user->ID > 0) {
$sql = 'SELECT auth0_obj
FROM ' . $wpdb->auth0_user .'
WHERE wp_id = %d';
$result = $wpdb->get_row($wpdb->prepare($sql, $current_user->ID));
if (is_null($result) || $result instanceof WP_Error ) {

self::insertAuth0Error('get_currentauth0userinfo',$result);

return null;
}
$currentauth0_user = unserialize($result->auth0_obj);
Expand Down
2 changes: 1 addition & 1 deletion lib/WP_Auth0_Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function create_user( $userinfo ){
}

$username = $userinfo->nickname;
if (empty($username)) {
if (empty($username) || username_exists($username)) {
$username = $email;
}
// Create the user data array for updating first- and lastname
Expand Down