Ravens PHP Scripts

Ducks Fix Groups Script Released
Date: Sunday, May 31, 2009 @ 11:16:12 CEST
Topic: Code Hacks

Hi all thought I would let you know that during the preparation of PNC 4.5 we worked on some improvements to group management. As such during that improvement process we thought what about all those users that may have messed up groups from what was once a poorly messed system?

Two places for creating groups was bound to be a cause for issues for many users especially since if you created them in PHPbb it was only one way. As well users joining via phpbb was one way. Well as of PNC 4.5 that is no longer a concern but fixing the already messed up groups and users could be.

So I did a quick and dirty script to mesh up the groups. It may not be elegant but it gets the Job done. I even tested it on a live site where I had a bunch of groups that were so messed up it is not funny. Forums Permissions were out of whack and everything. So far she's done a good job and have had no complaints.

While this Script is available in the PNC 4.5 package (so upgrading users can fix their groups) I have decided to release it as a stand-alone script for other users of other versions of nuke that may wish to use it. It hasn't been tested on anything but PNC 3.2, PNC 4.4 and PNC 4.5 but I don't see any reason it shouldn't work on any version of nuke that uses the $db sql layer. As always though it is recommended to back up your tables first. And of course once finished don't leave the file in your root!

The tables you'll need to back up are:


What does the FixGroups Script do?

This Script is intended to Merge phpBB Groups and NSN Groups ensuring Groups are identical in Both sets of Tables.

BB Groups are considered Priority and all NSN groups are first updated to reflect them after that any NSN groups remaining not existing in phpBB groups are then created in phpBB Groups.

Finally Users are merged and cleaned up as well. All orphan users are deleted from Groups Users tables and any duplicate named groups are deleted as well as any references to those groups within the Modules. Blocks or NSN Downloads groups are removed (if group no longer exists). Blank Usernames are updated to reflect Correct Users and where Moderators are unset or incorrect they are set to the default of user_id "2" you may change this to the user ID you wish at the top of the file.

Single User Groups fix in bbgroups has been added to this file. Your User tale is scanned and any users not having a single user group in bbgroups is added. Based on original fix file titled fixgroups.php modified to work with this script. Don't know who original Author was of that one (nothing included in the file) so sorry for missing credit.

You May Choose to Delete All or Approve All Pending BBusers upon running of the Script.

You may download the file from here:

Ducks FixGroups Script

Please let me know if you have any issues when using this script.


This article comes from Ravens PHP Scripts

The URL for this story is: