1
caskater
Update to Registration Keys
  • 2005/6/25 4:08

  • caskater

  • Just popping in

  • Posts: 9

  • Since: 2004/12/6


Hey everyone, I know its been a while since I last updated the popular Registration Keys module, so I thought you might all want a 2.0.11 compatible version (unless you figured out how to make it compatible yourself). I have not added any new features at this time but I have gotten a couple good suggestions. So thank you to those who have taken the time to write me.

You can find the latest version of Registration Keys, 2.0.1 at
http://www.jeuxstudios.com/regkeys/downloads/regkeys-2.0.1.zip
I have also uploaded the previous versions of RegKeys for those of you whom are still using older versions of Xoops. They can be found at:
Registration Keys 2.0RC1
Registration Keys 1.0.2

Thanks for all that have supported the module.

Jean-Philippe

2
Chappy
Re: Update to Registration Keys
  • 2005/6/25 7:21

  • Chappy

  • Friend of XOOPS

  • Posts: 456

  • Since: 2002/12/14


Does this have the same functionality as the visual registration check?

Thanks!
MMM...It tastes like chicken! ...

3
caskater
Re: Update to Registration Keys
  • 2005/6/26 6:15

  • caskater

  • Just popping in

  • Posts: 9

  • Since: 2004/12/6


No it is not the same as a visual registration check. Its purpose is to be able to limit registration to only those whom you want and/or to place them in appropriate groups you choose. Visual registration check just ensures nobody can spam the registration process. This can act as a solution for the problem if you require all registrants to enter in a registration key, since it would take an incredibly long time for someone to brute force hack a 20 character key. However, the difference is that the user must know the registration key beforehand. Its uses are meant for situations such as customer service, organizations, etc.

4
dtnagle
Re: Update to Registration Keys
  • 2005/7/3 2:40

  • dtnagle

  • Just popping in

  • Posts: 1

  • Since: 2005/5/2 1


I cant seem to get this to work. I get redirected back to the Registration Keys Main page whenever I select one of the links

Thanks

5
ramjet
Re: Update to Registration Keys - UPDATED for 2.2... :-)
  • 2005/9/19 18:25

  • ramjet

  • Just popping in

  • Posts: 14

  • Since: 2005/9/10


Ok, I must say that Registration Keys was exactly what I was looking for, except I use 2.2.2... So @ 3 AM I started to incorporate it into 2.2.2 Now, do not curse my crude code - all I can say is it can be cleaned up, but it works...

Sudo Legal Stuff->Disclaimer:
Although this works flawlessly on my install, I do not imply this will for for everyone. Nor is it implied that this will not totally trash your running site - all code must be tested and deemed safe by your own testing and judgement. I will not be held responsible for any damage done using this code.

Here is the "hack":

1. All files except for register.php and registerform.php (in the registration keys download) need to be incorporated as required (do not overwrite, add the commented portions into your own files - they are not the same)
2. After all is included create your registration keys (Misc. Tools->Registration Keys), jot down the one for the default registration type (registered user).
3. I had to add a $_Get[] statement into Modules->System->Admin->Regkeys->main.php in order to get the admin pages working properly (one server required it - one did not, so I figured I would mention it):
if (isset($_GET['op'])) {
$op = trim($_GET['op']);
}
if (isset($_GET['type'])) {
$type = trim($_GET['type']);
}
if (isset($_GET['key_id'])) {
$key_id = trim($_GET['key_id']);
}
4. Create a new field in "Modules->Profile->Fields" called "user_regkey" - with a default set to #2 above and ensure that it is on the registration page and that it is required. (this portion takes care of all the the coding that was in registerform.php).
5. Do the following in {Xoops Root}->Modules->Profile->register.php:

------------- Find This -----------------------
if ($xoopsModuleConfig['display_disclaimer'] != 0 && $xoopsModuleConfig['disclaimer'] != '') {
if (empty($agree_disc)) {
$stop .= _PROFILE_MA_UNEEDAGREE.'
';
}
}
----------- End Find This ---------------------

--------- Add This After Above Code -----------
// Registration Keys Module add-in
// Author: Jean-Philippe Steinmetz
// Modded By: Rodger Cravens
global $xoopsDB;
$xoopsDB =& Database::getInstance();
$str_regkey = $newuser->getVar('user_regkey');
$result = $xoopsDB->query("SELECT status,groups FROM ".$xoopsDB->prefix('regkeys')." WHERE code='".$str_regkey."'");
$rkfound = false;
if(count($result) == 1) { // registration key found
list($rkstatus,$rkgroups) = $xoopsDB->fetchRow($result);
if($rkstatus) { // check to see if key is enabled
$rkfound = true;
}
}
if (!$rkfound) { // check if reg key is required and if not found
if($str_regkey == '') { // Check if any key was entered.
$stop .= _US_UNEEDREGKEY;
} else {
$stop .= _US_BADREGKEY;
}
}
// End Module add-in
------- End Add This After Above Code ---------

------------- Find This -----------------------
if (!$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid)) {
echo _PROFILE_MA_REGISTERNG;
break;
}
----------- End Find This ---------------------

----------- Replace With This Code ------------
------ OR Comment Out For Easy Roll Back ------
// Registration Keys Module alteration
// Author: Jean-Philippe Steinmetz
// Modded By: Rodger Cravens

mysql_connect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS) or die("Unable to connect to host $server");
mysql_select_db("XOOPS_DB_NAME") or die("Unable to select database $db");

$i = "0";
$query1 = "SELECT * FROM ".$xoopsDB->prefix('user_profile')." WHERE profileid = '".$newid."'";
$result = mysql_query($query1);
$userkey = mysql_result($result,$i,"user_regkey");
$query2 = "SELECT groups FROM ".$xoopsDB->prefix('regkeys')." WHERE code = '$userkey'";
$result = mysql_query($query2);
$usergroup = mysql_result($result,$i,"groups");
$lt = ltrim($usergroup,"[]");
$reg_groups = trim(rtrim($lt,"])"));

// the following adds them to the entered group, or on fail adds them to the XOOPS default group

if(!$member_handler->addUserToGroup($reg_groups,$newid))
{
$member_handler->addUserToGroup(XOOPS_GROUP_USERS, $newid);
}
// End alteration
--------- End Replace With This Code ----------

6
fallenturtle
Re: Update to Registration Keys - UPDATED for 2.2... :-)

I'm trying to figure out how to mod RegKeys 2.0.1 to work correctly with XOOPS 2.0.13.1. I first tried just running it following 2.0.1's install thinking that there weren't any major changes between XOOPS 2.0.11 and 2.0.13 but it turned out I must have been wrong because the admin section wouldn't work. I tracked down the problem of $type not being defined and found your mod in the forums. The changes in #3 allowed me to actually get into the RegKeys and setup some keys, which I have. But now when I try to register someone with that key, or any key for that matter, it tells me that

Fatal errorCall to a member function getVar() on a non-object in /home/httpd/html/spfas/xoops/register.php on line 145


and in the PHP debug info:

Notice [PHP]: Undefined variablenewuser in file register.php line 145


line 45 is:

$str_regkey $newuser->getVar('user_regkey');


So I'm thinking the problem is with defining "newuser" but I'm completely lost now.

I had to figure out how to make your changes in my version of XOOPS (pre "profile" module) and I think I figured the changes out right. But I'm not sure.

Any help would be welcomed!

Thanks.

7
Peekay
Re: Update to Registration Keys - UPDATED for 2.2... :-)
  • 2005/9/29 23:54

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Ramjet's 2.2 hack looks great, but I too will be interested if a 2.0.13 or 2.0.13.1 fix materialises from the developer.

AFAIK, there are only 2 modules that perform the task of group assignment on registration - this one and 'Registration Codes'. That module also requires an update (I have requested already in this thread.)

For anyone with a permissions based site these are invaluable utilities. I hope the development of RegKeys is continued.

Unless I missed something though, I don't think there was a XOOPS 2.0.11. The releases went from 2.0.10 to 2.0.12.
A thread is for life. Not just for Christmas.

Login

Who's Online

487 user(s) are online (163 user(s) are browsing Support Forums)


Members: 0


Guests: 487


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits