New & In Need of Help

I have been scouring Xoops information for the perfect module and I think Reg Codes is it. The only problem is that I am completely confused about what I need to do to make it work on my Xoops site. If someone could point me in the right direction, I would be very appreciative.

My goal...

I need to have users go into certain groups upon registration. I only have two groups (so far), but it is extremely important that only those necessary go into those groups.

The problem...

I know Reg Codes will do this for me, but I cannot find a download for the module anywhere. Also, do I need Formulize in order for Reg Codes to work?

Comments

Re: New & In Need of Help

Hello, thanks for your interest in Reg Codes.

Yes, Reg Codes will do what you need, and yes you need Formulize in order for it to work (Reg Codes requires that you make a custom registration form, which you need Formulize for).

There are detailed setup instructions in the readme file for Reg Codes, read it *carefully*. There are several steps!

You can get all the modules here:

http://www.freeformsolutions.ca/en/formulize-downloads

The download links were broken last week but are fixed up now. Sorry for the inconvenience.

--Julian

Re: New & In Need of Help

Thank you!

I am having a problem, though. Things were working fine and one person was able to register without any problems, but now when someone tries to register, it starts to save, then they are redirected to a screen that says "Could not register new user".

After the first person had registered, I needed to make some changes in the names of the additional fields I added to the registration form. I went through and checked the form, checked to see that any required fields were marked, but even when the form is completely filled out, users cannot register.

When I test the registration process, I can register with the test code I set up. I wasn't able to register with the code I created for another member, so I deleted the code and re-created the same code with a new expiration date. All worked fine. So I created the code again exactly the same (after deleting the test account) and asked the user to try to register again, but she was unable to.

Any ideas of what the problem might be?

Re: New & In Need of Help

Hello,

In some XOOPS systems (well, in all XOOPS systems by default), users who are behind a firewall that blocks the referrer information from the http requests, cannot save information in any form, in any module. This is often caused by Norton personal firewall software or other local firewall/security software, and not by corporate firewalls.

The error message you are reporting, "Could not register new user", only happens when the writing of the user to the database is not successful. So if some users can save, and others cannot, then it suggests there is something about their local configuration that is screwing things up, and a firewall is the most likely cause.

You can disable this referrer check in XOOPS pretty easily, open up the class/xoopssecurity.php file and change this code:

function checkReferer($docheck=1)
    {
       

to this:

function checkReferer($docheck=1)
    {
        return true;

Basically, just add "return true;" to the top of that function.

In ImpressCMS, depending on your operating system and version of PHP, you may run into a problem registering users, which you can fix a different way. It seems to be a fairly obscure issue though, and I believe you're using XOOPS?

Alternatively, you can ask your users to add your site to the list of sites in their firewall that it will send referrer information to. This can be pretty tough to do for some users.

Does this solve your problem?

--Julian

Re: New & In Need of Help

That seems to have made it work, but when the user registers, an error is shown on the confirmation page before being re-directed to the home page...

I registered through the Reg Codes/Formulize mod and am taken to the standard "Your account has been created and you are now being redirected to the home page". Right about that notice is an error that says "Error: The data you entered could not be added to the database". Then I am taken back to the home page and am logged in.

The data is added to the database and user is registered. The user is also placed in the appropriate groups. I know the quick fix for this is to just removed the error text, but I would much rather make it work properly so the text doesn't 'want' to show.

PS
Yes, I am using XOOPS.

Re: New & In Need of Help

This is curious, but clearly something isn't working for you. What version of XOOPS are you using? And what versions of Formulize and Reg Codes?

Basically, what is happening is the account is being created, but the custom profile information is not being saved. This error message is thrown up by Formulize when the XOOPS security token check fails. Because of the way the XOOPS security token system works, as soon as the token is checked, it is cleared, and further checks fail. Formulize checks when it saves data, and normally that's fine, because no other modules are writing data at the same time.

But the account creation system is perhaps checking this itself before Formulize writes the custom profile data. This would be a change in XOOPS 2.0.18 perhaps? I'm just theorizing.

Let us know the exact version numbers and we can suggest some debug code to add to your files to identify exactly where/what is going on.

--Julian

Re: New & In Need of Help

Xoops: 2.0.16

Reg Codes: 2.3

Formulize 2.3

Re: New & In Need of Help

Hmmm, that's a very well tested combination of releases so I'm a little stumped...here's some ideas:

It would be useful to know if the problem happens when you try to fill in any form, not just make an account. Create another form in Formulize and try to make entries in it. If you get the same error, that almost certainly points to a general problem validating the security tokens. But if that is the case, then a lot of other operations should fail too, separate from forms.

The basic problem is that the XOOPS security token check is failing. That can happen for two reasons that I know of:

1. The check has already been made before Formulize is making it.

2. The check actually fails because XOOPS thinks you should not have access to the form to submit data.

Number 2 can happen because you have a software firewall that is blocking the referrer information from being sent to the website. So that's one question...do you have a software firewall in place? (Norton Internet Security for instance)

You can test whether the referrer information is the issue by removing the referrer check in the code like this:

Open up the class/xoopssecurity.php file and change this code:

function checkReferer($docheck=1)
    {
       

to this:

function checkReferer($docheck=1)
    {
        return true;

Basically, just add "return true;" to the top of that function.

If you do that and then go through the new account creation process and do not get the error message, then that was the problem.

Another way around this would be to disable the security token check in Formulize, which you can do in the include/readform.php file in the Formulize module. Find this code:

$cururl = getCurrentURL();
if(isset($GLOBALS['xoopsSecurity'])) { // avoid security check for versions of XOOPS that don't have that feature
if (!$GLOBALS['xoopsSecurity']->check() AND (!strstr($cururl, "modules/wfdownloads") AND !strstr($cururl, "modules/smartdownload"))) {
print "<b>Error: the data you submitted could not be saved in the database.</b>";
return;
}
}

Just comment that block of code by putting /* and */ at the top and bottom, like this:

/*
$cururl = getCurrentURL();
if(isset($GLOBALS['xoopsSecurity'])) { // avoid security check for versions of XOOPS that don't have that feature
if (!$GLOBALS['xoopsSecurity']->check() AND (!strstr($cururl, "modules/wfdownloads") AND !strstr($cururl, "modules/smartdownload"))) {
print "<b>Error: the data you submitted could not be saved in the database.</b>";
return;
}
}
*/

If you do that, you certainly will not get that error message again! However you are removing one barrier against certain kinds of attacks on your website.

The security system stores the token in your session, so if there is a problem in general with the website knowing who you are and keeping your session from pageload to pageload, that would cause this problem too.

Sorry we don't have more definitive information. It's difficult to be more precise without access to your live site. Let us know how it goes.

--Julian