[buddypress-trac] [BuddyPress Trac] #7582: wp_update_user creates an error

buddypress-trac noreply at wordpress.org
Fri Aug 11 11:12:02 UTC 2017


#7582: wp_update_user creates an error
--------------------------+-----------------------------
 Reporter:  iamklaus      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 See my code below. Having buddypress activated, calling the function
 wp_update_user within the hook "after_setup_theme" throws an error:

 ''[Thu Aug 10 16:31:55.944041 2017] [proxy_fcgi:error] [pid 10778] [client
 10.130.37.117:64185] AH01071: Got error 'PHP message: WordPress database
 error 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 = 1706 AND blog_id = 1' at line 1 for query SELECT
 COUNT(id) FROM WHERE user_id = 1706 AND blog_id = 1 made by 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, logmeintothesystem,
 ad_sso_register_user_wrapper, ad_sso_register_user, 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
 database error 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 ( 1706, 1 )' at line 1 for query INSERT
 INTO ( user_id, blog_id ) VALUES ( 1706, 1 ) made by 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,
 logmeintothesystem, ad_sso_register_user_wrapper, ad_sso_register_user,
 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'
 [Thu Aug 10 16:32:03.102375 2017] [proxy_fcgi:error] [pid 10804] [client
 10.70.36.82:57000] AH01071: Got error 'PHP message: WordPress database
 error 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 = 385 AND blog_id = 1' at line 1 for query SELECT
 COUNT(id) FROM WHERE user_id = 385 AND blog_id = 1 made by 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, logmeintothesystem,
 ad_sso_register_user_wrapper, ad_sso_register_user, 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
 database error 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 ( 385, 1 )' at line 1 for query INSERT
 INTO ( user_id, blog_id ) VALUES ( 385, 1 ) made by 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,
 logmeintothesystem, ad_sso_register_user_wrapper, ad_sso_register_user,
 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'
 ''
 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
 <?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://buddypress.trac.wordpress.org/ticket/7582>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list