Allow some multisite illegal username characters

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: Allow some multisite illegal username characters

Re: Allow some multisite illegal username characters

by axew3 » Tue Apr 02, 2024 9:27 pm

Ah wow... just realized that instead to include an external config file, would be sufficient to get the connection values stored as WP option, using $wpdb default/direct wp query call and NOT using the wp get_option function (that return an empty string).
So in case that the global var $w3all_config_db will result to be empty, required db connection values will be retrieved by the query.
Will be fixed on 2.8.3

Re: Allow some multisite illegal username characters

by axew3 » Tue Apr 02, 2024 9:00 pm

Finally have come out again ... ok

So, just tested, and i cannot reproduce into my mums localhost, but yes into a site i follow, so the query that fail based into your report is this:

Code: Select all

    $phpbb_user_data = $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");
the problem is that you could check and change the query to be this instead:

Code: Select all

    $phpbb_user_data = $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");
but the result will not change, you'll get anyway
Fatal error: Uncaught Error: Call to a member function get_results() on string
the reason of this, i discovered into another mums installation, is that at some point, and for different functions, the value of the var $w3all_config_db become empty, so the

Code: Select all

private static function w3all_db_connect(){
on file
class.wp.w3all-phpbb.php lead to the subsequent
Error: Call to a member function get_results() on string

To fix the issue, into a site i follow, i had to do this:
on file
class.wp.w3all-phpbb.php
into function

Code: Select all

private static function w3all_db_connect(){

Code: Select all

else
     {
       $w3all_config_db["dbhost"] = empty($w3all_config_db["dbport"]) ? $w3all_config_db["dbhost"] : $w3all_config_db["dbhost"] . ':' . $w3all_config_db["dbport"];
       $w3all_phpbb_connection = new wpdb($w3all_config_db["dbuser"], $w3all_config_db["dbpasswd"], $w3all_config_db["dbname"], $w3all_config_db["dbhost"]);
      }
change into:

Code: Select all

else
     {
       $w3all_config_db["dbhost"] = empty($w3all_config_db["dbport"]) ? $w3all_config_db["dbhost"] : $w3all_config_db["dbhost"] . ':' . $w3all_config_db["dbport"];
       $w3all_phpbb_connection = new wpdb('yourUserName', 'yourdbpasswd', 'yourdbname', 'yourHost');
       // yourHost could be yourHost:3306 if port required
      }
The use of a CONSTANT in place of the global var $w3all_config_db should not fix the issue.
As you can see on the same function, the code on it already provide the switch to include a custom config.php, which was the way i solved the issue last time (same result of the above suggested, but in that case vars are coming so from an included custom phpBB config.php).
Think that the CONSTANT array will not fix because if not wrong, the call to get_option that should contain db connection values, return an empty val!
[EDITED]

Re: Allow some multisite illegal username characters

by pennymachines » Tue Apr 02, 2024 3:51 pm

Many thanks - working great now. Sorry about my late response!

On the subject of php warnings, there's still one small issue which I flagged before.

If I try to delete a user through network admin I get an error and delete fails. I have to deactivate your plugin to delete users.
I just noticed this also applies to deleting subsites.

Here's the error I got:

Code: Select all

Fatal error: Uncaught Error: Call to a member function get_results() on string in /home/www/mysite.com/wordpress/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php:1992 Stack trace: #0 /home/www/mysite.com/wordpress/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php(2039): WP_w3all_phpbb::wp_w3all_get_phpbb_user_info_by_email() #1 /home/www/mysite.com/wordpress/wp-content/plugins/wp-w3all-phpbb-integration/wp_w3all.php(1529): WP_w3all_phpbb::wp_w3all_phpbb_delete_user_signup() #2 /home/www/mysite.com/wordpress/wp-includes/class-wp-hook.php(326): w3all_remove_user_from_blog() #3 /home/www/mysite.com/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #4 /home/www/mysite.com/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #5 /home/www/mysite.com/wordpress/wp-includes/ms-functions.php(246): do_action() #6 /home/www/mysite.com/wordpress/wp-includes/ms-site.php(814): remove_user_from_blog() #7 /home/www/mysite.com/wordpress/wp-includes/class-wp-hook.php(324): wp_uninitialize_site() #8 /home/www/mysite.com/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #9 /home/www/mysite.com/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #10 /home/www/mysite.com/wordpress/wp-includes/ms-site.php(261): do_action() #11 /home/www/mysite.com/wordpress/wp-admin/includes/ms.php(98): wp_delete_site() #12 /home/www/mysite.com/wordpress/wp-admin/network/sites.php(146): wpmu_delete_blog() #13 {main} thrown in /home/www/mysite.com/wordpress/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php on line 1992
Again, by deactivating wp.w3all, I was able to delete the subsite.

Re: Allow some multisite illegal username characters

by axew3 » Thu Mar 14, 2024 6:53 pm

Ok resolved, you was right! it was a problem on db vars when not still set, so throwing Php warnings, until the connection values where not set.
It has been now resolved, download 2.8.1 please!
As ever, thank you for the report David

ps old versions are here but i do not advice to use, just update to 2.8.1 instead to fix your reported issue
https://wordpress.org/plugins/wp-w3all- ... /advanced/

Re: Allow some multisite illegal username characters

by pennymachines » Thu Mar 14, 2024 5:35 pm

I'm afraid I think the problem must lie with w3all phpBB.

My reasons for thinking this:

I made no changes to my DB, username, password or port params.

The error appeared immediately after updating to w3all phpBB Version 2.8.0

The error goes away when I deactivate w3all phpBB.

All other plugins are working and updating.

Something else I noticed... When the plugin is activated some users get logged out of phpBB after they visit the Wordpress areas.

Perhaps as a test you could link me to the previous w3all phpBB version. If that still works, we can be more positive the problem is with the update.

Re: Allow some multisite illegal username characters

by axew3 » Tue Mar 12, 2024 8:58 pm

Hello check that some info is maybe changed for your DB connection, like the port param required by the host or something else?
Should be no reason to get the message if the connection values are correct also because nothing changed about it since long time!

Top