Notifications
Clear all

[Closed] A strange WP Foro bug - it deactivates additional groups.

6 Posts
2 Users
0 Reactions
347 Views
Posts: 7
Topic starter
(@igor-lohman)
Active Member
Joined: 1 year ago

Hello!

I drew attention to the following problem.

For clarity I attached 3 screenshots.

I have created a script that automatically activates additional WP Foro groups for the user.

It works 100%, because if you refresh the User Profile page, the activated groups are saved. Secondly, the user really gets access to the forum depending on the group. That is, everything is fine here and everything works.

But the number of users in the "WP Foro" - "User groups" section always shows "0", despite the fact that users are actually in groups.

The current number of users in the "WP Foro" - "User groups" section is updated only if you forcibly click the "Update information" button in the User Profile.

It feels like WP Foro has a conflict with the cache or something else, which for some reason makes it important for WP Foro to click the "Update information" button in the User Profile.

The main problem is that if you enable synchronization in WP Foro OR in the "Overview" section click "Synchronize profiles" OR "Delete cached user data" OR "Delete all caches" - all active additional groups are deactivated.

This happens because in the WP Foro section User groups are everywhere by zeros.

The feeling is that the indicators in this section have a higher priority than the information in the user Profile. This is strange.

That is, WP Foro does not care that in fact everything is active in the Profile. WP Foro for some reason it is important that the "Update information" button in the Profile is pressed. There are a lot of problems because of this.

Imagine - my script automatically activates groups for hundreds of users. And they all work. Each user gets access to his forum according to certain rules.

But WP Foro deactivates these additional groups if you enable synchronization or click the buttons in the "Overview" section, which I mentioned above.

Therefore, I have a question - is it possible that this is some kind of bug?

Why does WP Foro work like this and why doesn't it care that groups are actually active? Why would I click "Update information" in the Profile that everything worked.

It is not possible to automate when there is such a bug.

This is a problem because I can't log in to an account with hundreds of users and press this button for everyone.

I would look for the problem in the script if it didn't work. But it works because groups are activated, access is granted and information is saved after the Profile page is reloaded.

But wpForo doesn't take this into account for some reason.

Sincerely, Igor.

5 Replies
Posts: 7
Topic starter
(@igor-lohman)
Active Member
Joined: 1 year ago

Screenshot 2:

Posts: 7
Topic starter
(@igor-lohman)
Active Member
Joined: 1 year ago

Screenshot 3:

BlackRaz
Posts: 406
Admin
(@blackraz)
Contributor
Joined: 8 years ago

Hi @igor-lohman ,

If your script has completed all the necessary tasks and you have verified that all required information has been correctly modified in the database, and there are no additional flags or data that need to be added or removed from the database, you can proceed with purging the MySQL cache to ensure accurate results when using the "SELECT COUNT(*)" SQL query.

The "SELECT COUNT()" query might be cached by MySQL, and this caching behavior can be influenced by the MySQL version and my.ini (MySQL configuration) settings. After running your script, it's a good practice to perform a cache purge to ensure that any cached data related to the "SELECT COUNT()" query is cleared, and the subsequent queries provide up-to-date results.

You can purge the MySQL cache by running the following command:

FLUSH TABLES;
1 Reply
(@igor-lohman)
Joined: 1 year ago

Active Member
Posts: 7

@blackraz Thanks for the reply. Very valuable.

I had to tell you first how the script works.

Perhaps this will be useful to you and your customers.

SELECT COUNT( ) does not appear anywhere in the script.

The script compares the names of roles and the names of WP Foro groups.

As soon as the user has a new role, the script automatically activates the WP Foro group with the same name.

This is an unusual and very convenient solution, in my opinion.

There remains only the problem that I described above - the number of participants in the WP Foro admin panel is not updated, despite the fact that the user is actually in the group.

Because of this, I can't use the cache cleanup functions in the "Overview" section.

I have a feeling that the script is missing some one simple line, such as SELECT COUNT( ).

I have a suggestion for you.

There are only 30 lines in my script.

I can post it here for free and you can use this idea to your advantage. Perhaps your other customers will want such a feature.

This is much more profitable than buying wpForo WooCommerce Memberships Integration + WooCommerce Membership plugin.

I just need help in making WP Foro correctly show the number of participants in groups - just like in the User Profile.

That is, there is probably some feature of WP Foro.

Please write whether this option is possible.

BlackRaz
Posts: 406
Admin
(@blackraz)
Contributor
Joined: 8 years ago

"I want to know if you had sent the "FLUSH TABLES;" command to the MySQL database and if it did not solve the problem?"