Change Registration Disabled Error Messages

Started by peterinwa, November 11, 2008, 02:10:07 AM

Previous topic - Next topic

peterinwa

I want to disable registration, and change the error messages you get when you click on Registration with it disabled.

They are:

An Error Has Occurred!

Sorry, registration is currently disabled.


I want to replace the above with text directing them to click on back, and then my instructions (which are at the top of my forum).

I want to replace An Error Has Occurred! as well as the line that follows.

My instructions will ask them to send me an e-mail giving me a little info, then I'll register them.

I was going to do this another way, and remove the Registration links. But they'd probably go nuts looking for them!

Thanks! Peter
Here's my forum:  www.MySchnauzer.net/forums

Elmacik

#1
Go to /Themes/default/languages/Erros.english.php
Open it with a text editor and drop down to 125th line which is:
$txt['registration_disabled'] = 'Sorry, registration is currently disabled.';

Now you can change it to whatever you like. A little note: you have to escape the single quotes ( ' ) here with a backslash ( \ ). For example if you will say "don't", you have to type it as "don\'t".

You can also change the title (An Error Has Occured) Go to /Sources/Register.php

Code (Find) Select
if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
fatal_lang_error('registration_disabled', false);


Code (Replace) Select
if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
{
$context['error_title'] = 'Whatever title you want, type it here..';
fatal_lang_error('registration_disabled', false);
}


Do you see "Whatever title.." in the code? You will type your title there.
Home of Elmacik

peterinwa

Thanks for the help, but I'm having a problem.

I was able to change the message (Sorry, registration...) just fine. But there are two locations where I can change the title:

// Check if the administrator has it disabled.

and

// You can't register if it's disabled.

If I change the title in the second location, it doesn't show when you click on Registration. Though the registration message does show.

But changing the title in the first location causes the message to be blank.

Thanks again, and I have another question.

When I make changes like this, is it possible that future software updates will include whole files that replace my modifications?

Peter
Here's my forum:  www.MySchnauzer.net/forums

Elmacik

I think you didn't do the title change as I suggested. Other ways will probably affect all of the error pages.

Quote from: peterinwaWhen I make changes like this, is it possible that future software updates will include whole files that replace my modifications?

If you update your forum with patch files, it mostly won't brake your modifications down. But if you upgrade with full packages or if you upgrade to a very new version (like from 1.x to 2.x) then all your modeifications will be gone.. For example I updated my forum from 1.1.6 to 1.1.7 and all my modifications are still working without any problems. I updated with a little patch from the administration panel.
Home of Elmacik

peterinwa

But your instructions don't tell me where to change:

   if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
      fatal_lang_error('registration_disabled', false);

It appears in the file in two places?

I tried it in the first, second, and both.

I'll start from scratch and try again, but first please tell me which one to replace... or both.

Thanks.

Here's my forum:  www.MySchnauzer.net/forums

peterinwa

Here are the TWO locations in /Sources/Register.php I changed. I have also included the line that follows so you can see that I didn't mess anything up.

// Check if the administrator has it disabled.
if (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)
{
$context['error_title'] = 'Registration Instructions';
fatal_lang_error('registration_disabled', false);
}

// If this user is an admin - redirect them to the admin registration page.


// You can't register if it's disabled.
{
$context['error_title'] = 'Registration Instructions';
fatal_lang_error('registration_disabled', false);
}

foreach ($_POST as $key => $value)


The result of the above TWO edits is that the title does change, but it causes my change to /Themes/default/languages/Erros.english.php to not show at all. It is blank.

I have another question if I may. If someone could please explain... when I FTP the modified code, why do I see two files?

Register.php
Register.php~

Thanks!

Here's my forum:  www.MySchnauzer.net/forums

Elmacik

#6
You are right sorry. So we have just found a little bug in SMF 1.x :)
It is enough for you to change it for the first occurence only.

Then for the bug, you will need to do this code change; in /Sources/Errors.php file,

Code (Find) Select
// Log the error and set up the template.
if (!isset($context['error_title']))
{
$context['error_title'] = $txt[106];
$context['error_message'] = $log || (!empty($modSettings['enableErrorLogging']) && $modSettings['enableErrorLogging'] == 2) ? log_error($error) : $error;
}


Code (Replace) Select
// Log the error and set up the template.
if (!isset($context['error_title']))
$context['error_title'] = $txt[106];
$context['error_message'] = $log || (!empty($modSettings['enableErrorLogging']) && $modSettings['enableErrorLogging'] == 2) ? log_error($error) : $error;


As you will notice, only the curved braces should be removed. Then it will work for you.

By the way, .php~ files are just backups. You'd beeter keep them if you are not lacking of storage.
Home of Elmacik

peterinwa

#7
Works great! Thanks so much.

BTW, what brought this up is now explained in Titlewave of Spambot Attacks...

http://www.simplemachines.org/community/index.php?topic=273816.0

Peter

P.S.

If you want to see how this works, click on my website (in my signature, below) and then try to register!
Here's my forum:  www.MySchnauzer.net/forums

Father Luke

I know this topic is old, but I wanted to express thanks for this.

Much-oh headaches solved.
Thanks muchly.

- -
Okay,
Father Luke

bharat91

sir actuallly I want to change the message which comes  just after the registration when admin approval is mandatory, after registration it comes "thank you for registering you account will be active after admin approval ......." How to change this message

Elmacik

/Themes/default/languages/Login.english.php

$txt['approval_after_registration'] = 'Thank you for registering. The admin must approve your registration before you may begin to use your account, you will receive an email shortly advising you of the admins decision.';

You can also edit Errors.english.php and Profile.english.php to see various messages that are shown to unapproved users when they try to login. Just search for "approv" (not approve) in these files.
Home of Elmacik

Advertisement: