Multisite User delete error

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Multisite User delete error

Post by pennymachines »

Sorry to start a new topic, but couldn't reply in the original one because it's locked.

I just updated to 2.5.4 but am still getting an error when I try to delete a user in multisite:

Code: Select all

Fatal error: Uncaught Error: Call to a member function get_results() on string in /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:1785 Stack trace: #0 /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(1864): WP_w3all_phpbb::wp_w3all_get_phpbb_user_info('valeriats') #1 /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php(1143): WP_w3all_phpbb::wp_w3all_phpbb_delete_user_signup(3783) #2 /home/www/mysite.com/myfolder/wp-includes/class-wp-hook.php(309): w3all_wpmu_delete_user(3783) #3 /home/www/mysite.com/myfolder/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home/www/mysite.com/myfolder/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #5 /home/www/mysite.com/myfolder/wp-admin/includes/ms.php(173): do_action('wpmu_delete_use...', 3783, Object(WP_User)) #6 /home/www/mysite.com/myfolder/wp-admi in /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 1785

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

I tested with no errors (again just now) both subsite and main deletion.
I will try to reverse how it can come out your side due to some plugin?
Let see the error stack again...

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

OK, tried again, but I'm afraid I'm still getting:

Code: Select all

Fatal error: Uncaught Error: Call to a member function get_results() on string in /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:1788 Stack trace: #0 /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(1871): WP_w3all_phpbb::wp_w3all_get_phpbb_user_info('spammer@gm...') #1 /home/www/mysite.com/myfolder/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php(1143): WP_w3all_phpbb::wp_w3all_phpbb_delete_user_signup(3849) #2 /home/www/mysite.com/myfolder/wp-includes/class-wp-hook.php(309): w3all_wpmu_delete_user(3849) #3 /home/www/mysite.com/myfolder/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home/www/mysite.com/myfolder/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #5 /home/www/mysite.com/myfolder/wp-admin/includes/ms.php(173): do_action('wpmu_delete_use...', 3849, Object(WP_User)) #6 /home/www/mysite.com/myfolde in /home/www/mysite.com/myfolder/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 1788

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

Very strange because function's stack as you report, should be clean.
At moment i have try any possibility and all work as expected. Except the code review, it has been tested into any default WP install with no error. I am sorry, it is really not clear how you can get this.

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

Hi,
I just updated to 2.5.5 but am still getting the same critical error.
Just wondering if you had a chance to look into it.

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

The problem David is that i cannot reproduce it, but i will try again

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

Hi,
Is there anything useful I can do to diagnose the issue?
I tried disabling all activated plugins (except WordPress w3all phpBB integration) from my network admin, but the problem remained.
Currently the only way I can delete users via network admin is to network deactivate WordPress w3all phpBB integration.
Cheers.

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

Yes! Hello David, could you replace the file and try it?
class.wp.w3all-phpbb.zip
(34.26 KiB) Downloaded 9 times
may the problem was an unescaped value i realized now looking on code, in case it is a problem in certain php?... let know please

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

i am quite sure the problem has been resolved David, the file class.wp.w3all-phpbb.php
has been patched also into repository to fix this:
https://plugins.trac.wordpress.org/expo ... -phpbb.php
fix function wp_w3all_phpbb_delete_user_signup into class.wp.w3all-phpbb.php for an unescaped var on query
to update and fix before 2.6.0 just dwonload class.wp.w3all-phpbb.php and replace the file into:
/wp-content/plugins/wp-w3all-phpbb-integration/

it was not leading to an error into php7.4/8 where i am testing, but i am quite sure (i remember this) it is causing instead the issue into some other server configuration.

ps. explained the problem was on this line (note '$user->user_email'):

Code: Select all

  $w3all_phpbb_connection->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_type = '1' WHERE LOWER(user_email) = '$user->user_email'");
that to be correctly parsed require to be like this instead ( '".$user->user_email."' ):

Code: Select all

  $w3all_phpbb_connection->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_type = '1' WHERE LOWER(user_email) = '".$user->user_email."'");
i am sorry David that to see the light on this, you had to re-mark again and again.

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

Hi Alessio,,
I'm sorry if I'm missing something, but I modified class.wp.w3all-phpbb.php as originally instructed and when that failed, overwrote the file with the latest versions, cleared cache, checked and double checked, but still get the fatal error:

Code: Select all

Fatal error: Uncaught Error: Call to a member function get_results() on string in /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:1805 Stack trace: #0 /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(1854): WP_w3all_phpbb::wp_w3all_get_phpbb_user_info_by_email('dyer@medicalfac...') #1 /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php(1138): WP_w3all_phpbb::wp_w3all_phpbb_delete_user_signup(3342) #2 /home/www/mysite.com/WP/wp-includes/class-wp-hook.php(309): w3all_wpmu_delete_user(3342) #3 /home/www/mysite.com/WP/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home/www/mysite.com/WP/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #5 /home/www/mysite.com/WP/wp-admin/includes/ms.php(173): do_action('wpmu_delete_use...', 3342, Object(WP_User)) #6 /home/www/mysite.com. in /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 1805
To be clear, this is what I have in class.wp.w3all-phpbb.php:

Code: Select all

    if ( isset($phpbb_user_data[0]->user_type) && $phpbb_user_data[0]->user_type == 1 ) {
      $res = $w3all_phpbb_connection->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_type = '0' WHERE LOWER(user_email) = '".$user->user_email."'");
     }
    // keep separated
    if( $user->user_pass != $phpbb_user_data[0]->user_password ) {
       $res = $w3all_phpbb_connection->query("UPDATE ".$w3all_config["table_prefix"]."users SET user_password = '".$user->user_pass."' WHERE LOWER(user_email) = '".$user->user_email."'");
     }
     
My server is running php 7.4

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

so send me via pm or post here the edited file, so i can see at this line what it is wrong! ( i loosed all connection data after my ftp program uninstall, if i had, i already downloaded myself to check, assuming you experience this at pennymachine)

p.s why you did not updated to last 2.5.9? Have you try to save all plugins files (maybe) and do an update to latest?
It should work fine into any configuration and frontend plugins
You say you modified the file, but to achieve what? Let know!

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

axew3 wrote:
Wed Mar 09, 2022 6:06 pm
so send me via pm or post here the edited file, so i can see at this line what it is wrong! ( i loosed all connection data after my ftp program uninstall, if i had, i already downloaded myself to check, assuming you experience this at pennymachine)
There is no means to attach files in PM here, so I've uploaded it here:
axew3 wrote:
Wed Mar 09, 2022 6:06 pm
p.s why you did not updated to last 2.5.9? Have you try to save all plugins files (maybe) and do an update to latest?
I did update to Version 2.5.9 as soon as it was available and tested, but the problem remained.
axew3 wrote:
Wed Mar 09, 2022 6:06 pm
You say you modified the file, but to achieve what? Let know!
I modified it originally back in January following the instructions you gave here.

It has been updated since then with newer versions (currently Version 2.5.9).

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

So, the unique problem that can cause the issue (string error on query) is the fact that a var (with email value) is passed on query without being correctly parsed.
something like this return the error you report:

Code: Select all

'$user->user_email'
while

Code: Select all

'".$user->user_email."'
or

Code: Select all

$user_email = $user_email;
'$user_email'
are ok.

little changed the two code functions, to avoid, i think, any possible fail, and also improve the by_email function to execute the search as LOWER value. Here we go, i am sure (like the fact i had already fixed these... really i already fixed last time but i find out the code has been like reverted sometime for some reason.....!) ... let see now ... all strings correctly escaped

https://plugins.trac.wordpress.org/expo ... -phpbb.php

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

I'm afraid I'm still getting the error with the new version of class.wp.w3all-phpbb.php

Code: Select all

Fatal error: Uncaught Error: Call to a member function get_results() on string in /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:1805 Stack trace: #0 /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(1853): WP_w3all_phpbb::wp_w3all_get_phpbb_user_info_by_email(NULL) #1 /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php(1138): WP_w3all_phpbb::wp_w3all_phpbb_delete_user_signup(2904) #2 /home/www/mysite.com/WP/wp-includes/class-wp-hook.php(309): w3all_wpmu_delete_user(2904) #3 /home/www/mysite.com/WP/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home/www/mysite.com/WP/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #5 /home/www/mysite.com/WP/wp-admin/includes/ms.php(173): do_action('wpmu_delete_use...', 2904, Object(WP_User)) #6 /home/www/mysite.com/WP/wp-ad in /home/www/mysite.com/WP/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 1805

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

I have try it anyway, without any error. But i will follow just this night and tomorrow on testing as doing 2.6.0 release
By the way, the function
wp_w3all_get_phpbb_user_info_by_email
has been updated because like last time

i had updated it to be this:

Code: Select all

public static function wp_w3all_get_phpbb_user_info_by_email($email){

 global $w3all_config,$w3all_phpbb_connection;
   
   $email = sanitize_email($email);
    if( !is_email($email) ) {
     return false;
    }
   
   $email = strtolower($email);
 
    $phpbb_user = $w3all_phpbb_connection->get_results("SELECT *
    FROM ". $w3all_config["table_prefix"] ."groups
    JOIN ". $w3all_config["table_prefix"] ."users ON LOWER(". $w3all_config["table_prefix"] ."users.user_email) = '$email'
    AND ". $w3all_config["table_prefix"] ."users.group_id = ". $w3all_config["table_prefix"] ."groups.group_id");

 return $phpbb_user;

}
while i have found into repository file, this code (which anyway into my test work fine):

Code: Select all

public static function wp_w3all_get_phpbb_user_info_by_email($email){

 global $w3all_config,$w3all_phpbb_connection;
 
    $phpbb_user = $w3all_phpbb_connection->get_results("SELECT *
    FROM ". $w3all_config["table_prefix"] ."groups
    JOIN ". $w3all_config["table_prefix"] ."users ON LOWER(". $w3all_config["table_prefix"] ."users.user_email) = '".$email."'
    AND ". $w3all_config["table_prefix"] ."users.group_id = ". $w3all_config["table_prefix"] ."groups.group_id");

 return $phpbb_user;

}
so i start to think there is something that is going wrong somewhere, i double checked it now (class.wp.w3all-phpbb.php):

https://plugins.trac.wordpress.org/expo ... -phpbb.php

it has been updated. With this, i assume it is impossible to get the error now, but let see the entire stack, let know please

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

Good news! No error. :D
Thank you so much for all your work on this.

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

wow, finally, you know when you report some bug i go into panic now :shock:
i will follow to optimize all the stack and functions, i've seen some that are REALLY still asking to be CLEANED UP!

2.6.0 is coming David
It will fix several things about avatars, add widget online users and phpBB stats and several more improvements!

pennymachines
User www
User www
Posts: 73
Joined: Mon Feb 06, 2017 9:51 pm

Re: Multisite User delete error

Post by pennymachines »

Sorry to report with Version 2.6.1 the problem is back:

Code: Select all

Fatal error: Uncaught Error: Call to a member function get_results() on string in /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:1758 Stack trace: #0 /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(1805): WP_w3all_phpbb::wp_w3all_get_phpbb_user_info_by_email('adrien_dulac166...') #1 /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php(1132): WP_w3all_phpbb::wp_w3all_phpbb_delete_user_signup(3898) #2 /home/www/mysite.com/wp/wp-includes/class-wp-hook.php(309): w3all_wpmu_delete_user(3898) #3 /home/www/mysite.com/wp/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #4 /home/www/mysite.com/wp/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #5 /home/www/mysite.com/wp/wp-admin/includes/ms.php(173): do_action('wpmu_delete_use...', 3898, Object(WP_User)) #6 /home/www/mysite.co in /home/www/mysite.com/wp/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 1758

User avatar
axew3
w3all User
w3all User
Posts: 2497
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Multisite User delete error

Post by axew3 »

Very strange David because this function did not changed since 2.5.9 (the function wp_w3all_get_phpbb_user_info_by_email logged at line 1758 as error) how is possible that it return error to you? It is actually so strange

Post Reply