FunForum
XMB Contributor
   
Posts: 3831
Registered: 6-23-2002
Location: Death Star battle station, Dutch Devision
Member Is Offline
Mood: Passed CCNP4 Case Study
|
|
[Add-on] [1.9.5 Nexus] Aimed @ Hack Authors: Registration Query; Class
This class can be used to update the members table. Targetted is this at hacks/modifications that add fields to the xmb_members table.
Do you write XMB hacks which require a modification of the members table?
Do you get frustrated by the people who mess up the hack-instructions when altering the query and breaking their registrationpage when doing so?
Then this class could be your solution.
Instead of the following instructions: | Code: |
Find:
----------------------------------------------------------------
$db->query("INSERT INTO $table_members
----------------------------------------------------------------
Add on that line BEFORE ) VALUES:
----------------------------------------------------------------
, FieldName
----------------------------------------------------------------
Add on that line BEFORE )");
----------------------------------------------------------------
, '$Var'
----------------------------------------------------------------
| You can now use this:
| Code: | Find:
----------------------------------------------------------------
/* And now starts the room for mods to fill their fields...
----------------------------------------------------------------
Add Below:
----------------------------------------------------------------
$_MR->AddField('FieldName', $Var);
---------------------------------------------------------------- |
You will still have to sanitize the variables ofcourse. So if you make use of the checkInput() function for example, keep doing this.
You can make use of this class to make your hacks easier to install. Refer in your instructions to this class so your member can install it.
Once these instructions are followed, the class has been installed and is ready for use.
Then you can use the $_MR->AddField(); like this;
$_MR->AddField('TestCount', '8');
$_MR->AddField('CustomTheme', '1|1');
$_MR->AddField('Something', $myStuff);
The order of which these are placed in the member.php don't matter.
Hope someone understands what I'm trying to tell here 
http://209.124.83.52/xmb/XMB_1.9.5/1.9.5_Release_MemberRegClass/
Disclaimer:
The author of this message is not responsible for nausea, puking, blindness, aggression or other medical or mental problems as a result of reading
this message.
|
|
|
Adam
XMB Contributor
   
Posts: 972
Registered: 6-28-2003
Member Is Offline
Mood: Sick Of XMB Changes.
|
|
Great idea, but will add extra queries to the DB.
Signature edited upon request of management, who disapprove of the PayPal button.
If you wish to get in touch and I am inactive here, please contact me at XMB Services . com
|
|
|
FunForum
XMB Contributor
   
Posts: 3831
Registered: 6-23-2002
Location: Death Star battle station, Dutch Devision
Member Is Offline
Mood: Passed CCNP4 Case Study
|
|
Indeed it will.
The response I gave myself to that when I thought about it:
How many new members does the avarage board get per day?
Lets say 9 members a day. Normally 9 queries are needed to create the users, now it will be 18.
If you read 1 thread less a day (which equals to 19 queries), you won't notice the difference
Disclaimer:
The author of this message is not responsible for nausea, puking, blindness, aggression or other medical or mental problems as a result of reading
this message.
|
|
|
JamieC
Experienced
   
Posts: 1679
Registered: 8-27-2005
Location: United Kingdom
Member Is Offline
Mood: Tired
|
|
I've wrote a version of this which doesn't add any extra queries (which resulted in a lot of code to replace certain elements of the given query).
I'll write a quick brief on how it works.
First of all the query needs to be removed from within the $db->query() function and converted to a string.
The class can then be initiated with the query:
| Code: |
$reg = new createFields($query);
|
Fields can then be added or removed as appropriate:
| Code: |
$reg->addValue('field1', 'value1'); // Add field with the name 'field1' and value 'value1'.
$reg->addValue('field2', 150);
$reg->addValue('field3', 'value2');
$reg->rollbackThis('field3'); // Remove previously added 'field3'.
|
Obviously rollbackThis() would be run in conjunction with an if statement. For example a field could be added by default and a check ran later to
match a certain condition and remove the field.
Once all the fields have been added the query can be run though $reg->commitThis();
Before I go making it all pretty with instructions and everything is this still a common problem? It's not worth the hassle if people are capable of
following the instructions as they are...
|
|
|
Mouser
|
Thread Opened 9-7-2010 at 06:52 PM |
Mouser
XMB Contributor
     
Posts: 1152
Registered: 4-14-2008
Member Is Offline
Mood: On vacation till early October 2010
|
|
As requested by John...
I did an attempt to re-create the hack FunForum created a few years ago. For archiving purposes.
I have not tested it as I don't have a test board available at this moment. But it looks ok to go 
Attachment: 1.9.5_Release_MemberRegClass_(remake).txt (6kB)
This file has been downloaded 4 times
Mouser @ On vacation till early October 2010
|
|
|