[wp-trac] [WordPress Trac] #41601: wp_update_user creates an error
WordPress Trac
noreply at wordpress.org
Thu Aug 10 11:16:40 UTC 2017
#41601: wp_update_user creates an error
--------------------------+-----------------------------
Reporter: iamklaus | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.8.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
See my code below. When I use wp_upadte_user within the hook
"after_setup_theme", it throws an error:
{{{
[Thu Aug 10 13:08:45.503396 2017] [proxy_fcgi:error] [pid 9452] [client
10.130.52.246:56561] AH01071: Got error 'PHP message: WordPress-Datenbank-
Fehler You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near 'WHERE user_id = 6 AND blog_id = 1' at line 1 f\xc3\xbcr Abfrage
'''SELECT COUNT(id) FROM WHERE user_id = 6 AND blog_id = 1''' von require
('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-
config.php'), require_once('wp-settings.php'),
do_action('after_setup_theme'), WP_Hook->do_action,
WP_Hook->apply_filters, ad_sso_login, wp_update_user, wp_insert_user,
do_action('profile_update'), WP_Hook->do_action, WP_Hook->apply_filters,
bp_blogs_add_user_to_blog, bp_blogs_record_blog, BP_Blogs_Blog->save,
BP_Blogs_Blog->exists\nPHP message: WordPress-Datenbank-Fehler You have an
error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near '( user_id,
blog_id ) VALUES ( 6, 1 )' at line 1 f\xc3\xbcr Abfrage INSERT INTO (
user_id, blog_id ) VALUES ( 6, 1 ) von require('wp-blog-header.php'),
require_once('wp-load.php'), require_once('wp-config.php'), require_once
('wp-settings.php'), do_action('after_setup_theme'), WP_Hook->do_action,
WP_Hook->apply_filters, ad_sso_login, wp_update_user, wp_insert_user,
do_action('profile_update'), WP_Hook->do_action, WP_Hook->apply_filters,
bp_blogs_add_user_to_blog, bp_blogs_record_blog, BP_Blogs_Blog->save\n',
referer: http://intranetdev.rehau.org/
}}}
The sql functions being executed by this functions are missing the
database table name.
Here is the code I am using inside the functions.php from my plugin:
{{{#!php
<?php
add_action('after_setup_theme', 'ad_sso_login');
function ad_sso_login () {
$user_id = 6;
$website = 'http://wordpress.org';
$user_id = wp_update_user( array( 'ID' => $user_id, 'user_url' =>
$website ) );
if ( is_wp_error( $user_id ) ) {
echo "There was an error, probably that user doesn't exist.";
} else {
echo "Success!";
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41601>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list