miniBB Support Forums | 18 years on The Web
miniBB ® 

miniBB

®
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Bugs miniBB Support Forums / Bugs /   
 

Premoderation: settings not saved, users not added to the list [SOLVED: PHP 7.x issue]

 
Author marsbar
Associated Member
#1 | Posted: 16 Jul 2020 01:56 
G'day, Paul.

My pre-moderation setup does not seem to be working properly: the problem may have begun in January this year and has been going on undetected until now.

My configurations:
a) apply pre-moderation rules to all new accounts and pre-defined users
b) display approved posts by dates when they were first created

However, this seems to be what has been happening (since around January): new accounts are not automatically added to the pre-moderated users list. (I have been adding users to the list manually.)

Also, each time I return to the Pre-moderation panel via the Admin panel, I see that the configuration menus show only the plugin's default, not my custom selections. For example: I see "pre-moderation is disabled" instead of "pre-moderation enabled for new accounts and pre-define users". So I would make my preferred selection again and then save the changes. And then when I return, I see the settings reverted. So I am left wondering whether my changes have indeed been saved, partially saved or not saved? :(

Hope I am making sense; if not, I am happy to email a couple of screenshots to you via ghappa. I just do not want to directly email you without first seeking permission.

I am running the latest version miniBB, and Pre-moderation module.

Please keep well and stay safe.
marsbar

Author Paul
Lead Developer
#2 | Posted: 16 Jul 2020 19:17 | Edited: Paul 
marsbar:
new accounts are not automatically added to the pre-moderated users list

I've just checked it with my local installation (and you could also test on the miniBB demo), and I'm pretty sure the new profiles are automatically added to the Premoderated list, when having configuration similar to yours.

Try to check the code in bb_plugins2.php, which is in response for this automatic addition. If you have Profiles Checker or Favorites add-ons installed, their code should be pasted after the code for Premoderation in this file. Else the Premoderation code should be the last before the closing ?>. Also make sure you have the proper code from the original installation package and most recent release of this add-on.

marsbar:
I see that the configuration menus show only the plugin's default, not my custom selections.

This indicates that the values are not saved to Database, and again, this is the reason to re-analyze the installation of this add-on step-by-step manually, following its README guides. I suppose, the problem is in some older or outdated file.

Your provider's server could restore some scripts of files if they are suddenly lost in the system, and the older copy could be taken - that's why it's always good to have a local copy of all fresh files for such a case.

If you fail on doing it yourself, you know my email address - drop me FTP infos and I'll take a look.

Author marsbar
Associated Member
#3 | Posted: 17 Jul 2020 15:28 
Hi, Paul!

Thanks for your prompt reply and troubleshooting tips: I have checked, uninstalled, reinstalled the add-on; but unfortunately, problems persist. I need to trouble you to take a look under the hood to see what is going on. You can expect to hear from me by email soon.

Happy Friday and good weekend to you--
marsbar

Author Paul
Lead Developer
#4 | Posted: 17 Jul 2020 18:48 | Edited: Paul 
I've got FTP infos, analyzed what's happening and found some bugs.

As about this issue:

marsbar:
each time I return to the Pre-moderation panel via the Admin panel, I see that the configuration menus show only the plugin's default, not my custom selections

Obviously it was happening because values were properly saved to a database, but were not probably read from there. It is related to PHP 7 issues; specifically, to the indirect variables (variable variables) evaluation method, which has been changed comparing to older PHP versions.

As I see, you are exactly about running PHP 7.x and probably upgrading to the newer PHP version happened in January, since then you are experiencing this trouble.

So, the simple thing to change was in addon_premod_setup.php and it's about the following:

$$row[0]=(int)$row[1];

must be changed to (note curly braces):

${$row[0]}=(int)$row[1];

Regarding PHP dev.team advices, it is always recommended placing curly braces to avoid ambiguity; but the script contained a code which in PHP7 worked differently. Adding curly braces helped. Note: you have caching enabled on your server, that means, to see the updated Premoderation Settings form when you return to it, perform the hard-refresh in the browser (f.e. holding Shift+Refresh links at the time on the keyboard).

Many miniBB scripts contain variable variables, but they all are mostly about plain variables and not arrays, that's why they still work in PHP7. But you've caught an "exclusive case" with this issue :) in the future development I will definitely add curly braces where they must be present.

I already have updated default add-on package with this code, and you have your updated file on server. Thanks for pointing me to this issue, as it appears truly important to hold on for PHP7 compatibility.

As about this issue:

marsbar:
new accounts are not automatically added to the pre-moderated users list

It's been related to the bug in your version of bb_plugins2.php. Obviously you have installed the "Last Visit" add-on, but removed it later, 'cause I wasn't able to find any reference to its field in database, or related codes in bb_plugins.php. But the code part in bb_plugins2.php has been left and it was causing the script from executing registration-related add-ons, 'cause the code stopped at some point (missing configuration variable) and didn't even go to the Premoderation code below. You would be able to catch the nature of the issue, if you would simply try to register a new account :)

By now I've disabled the unnecessary code, tried out the Registration process and I'm absolutely sure it works among the adding the new account to the Premoderated users. Please check on your side.

Author marsbar
Associated Member
#5 | Posted: 18 Jul 2020 16:05 
Hi, Paul.

Thank you so much for fixing my premoderation add-on installation. Thanks also writing up such detailed explanation of the problems to help everyone understand and learn!

Paul:
I've disabled the unnecessary code, tried out the Registration process and I'm absolutely sure it works among the adding the new account to the Premoderated users. Please check on your side.

Thanks, Paul; and I confirm the add-on is working as expected again! :)

Gratefully,
marsbar

Author Paul
Lead Developer
#6 | Posted: 19 Jul 2020 21:17 
marsbar:
I confirm the add-on is working as expected again! :)

Nice to know, and thanks for confirming!

Bugs miniBB Support Forums / Bugs /
 Premoderation: settings not saved, users not added to the list [SOLVED: PHP 7.x issue]
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


 ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
 ⇑