News:

Wondering if this will always be free?  See why free is better.

Main Menu

[TIP/TRICK] Remove register button

Started by Ninja ZX-10RR, June 10, 2014, 01:36:14 PM

Previous topic - Next topic

Arantor

And you changing index.php won't magically fix that... ;) All the other changes, sure, but the changes to index.php won't do that.

Ninja ZX-10RR

*yells at the code thinking it's too complicated but asks kindly xD*
Then any clue on what else should I be doing to get totally rid of that bloody thingy before my patience goes away and I just say "do you want to do that? well delete everything and it will work  :P" just kidding, seriously is there anything else that I should say?
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Sir Osis of Liver

FWIW, I run two private forums, and disabling registration works fine for me.  Really isn't any reason to remove the register buttons/links, because users get a message that registration is disabled.  The referenced thread that originated this idea is a completely different situation, where users register elsewhere on the website, and the SMF register buttons/links are not functional.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

You need to change Subs.php to remove the menu button. You need to change the index.{language}.php file to remove the link to it. You also need to edit the login template.

Antechinus

How about a really basic way of doing this, that requires only a minor CSS change?

#button_register {display: none;}

That will hide the button. Then just disable registration in admin. Sorted.

Arantor

Except for the places it won't ;) Like the link that shows up to guests that says "Welcome guest! Please login or register" or the login page ;)

Antechinus

Yeah but you could just edit language strings to handle those.* The thread is about the "register button". :P

*Which you can do via the admin interface, without needing to access any PHP files directly.

* Antechinus is trying to make things n00b-friendly here ;)

Arantor

* except when it doesn't work 100% properly and requires elevated file permissions

Ninja ZX-10RR

Quote from: Krash. on June 10, 2014, 05:26:09 PM
FWIW, I run two private forums, and disabling registration works fine for me.  Really isn't any reason to remove the register buttons/links, because users get a message that registration is disabled.
Well actually I would like it to disappear if it was to me. It sounds like as if I went to a dealership and I see a good car I ask for the price and the guy tells me no you can't buy it. And not because it would be a show car or something, just because I "can't" and well I don't like it. There is no possibility to do a thing? To hell with it I don't show it either ;)

Quote from: Krash. on June 10, 2014, 05:26:09 PM
The referenced thread that originated this idea is a completely different situation, where users register elsewhere on the website, and the SMF register buttons/links are not functional.
Indeed now because I slightly deviated from what I was thinking about.

Quote from: Arantor on June 10, 2014, 05:26:26 PM
You need to change Subs.php to remove the menu button. You need to change the index.{language}.php file to remove the link to it. You also need to edit the login template.
I'm about to cry but I don't give up, I want to learn something.
Then I found lots of stuff in the first file but I don't think I should be deleting everything but at least this, let's start:
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
and set it like "/* stuff */"

Here as well:
elseif ($context['current_action'] == 'register2')
$current_action = 'register';
here again "/* stuff */"? Hope these ones works good. Let's continue.

Let's see the index.{language}.php
$txt['welcome_guest'] = 'Welcome, <strong>%1$s</strong>. Please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a>.';
$txt['login_or_register'] = 'Please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a>.';

Replace with
$txt['welcome_guest'] = 'Welcome, <strong>%1$s</strong>. Please <a href="' . $scripturl . '?action=login">login</a> /* or <a href="' . $scripturl . '?action=register">register</a>.' */ ;
$txt['login_or_register'] = 'Please <a href="' . $scripturl . '?action=login">login</a> /* or <a href="' . $scripturl . '?action=register">register</a>.' */ ;
?
Again I hope I'm right here as well.

And the 3rd file isn't already done in the first message of this topic atm?

*hopes he is correct, scared while waiting for his answer telling him he screwed up everything xD*
P.s. added 4 replies while posting this .-.
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Ninja ZX-10RR

Quote from: Antechinus on June 10, 2014, 05:34:18 PM
How about a really basic way of doing this, that requires only a minor CSS change?

#button_register {display: none;}
Gotcha for this I'm gonna add it anyway.

EDIT: Except for the fact that I can't find it? I think that maybe it's because I start to be a bit tired Idk.. Pointing me there like a newb?  :-[
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Antechinus

Quote from: Arantor on June 10, 2014, 05:46:06 PM
* except when it doesn't work 100% properly and requires elevated file permissions

Well ok then, so perhaps they have to use another admin page and do a basic chmod. They should know how to do that anyway (or will have to learn, anyway). My basic point is that although you can go through the entire codebase and completely remove all references to the register function, it's not necessary to do that to get a result that will satisfy most admins. It's more the sort of thing that appeals to devs. The average admin can use a much simpler method.

Ninja ZX-10RR

Quote from: Antechinus on June 10, 2014, 05:55:09 PM
Well ok then, so perhaps they have to use another admin page and do a basic chmod. They should know how to do that anyway (or will have to learn, anyway). My basic point is that although you can go through the entire codebase and completely remove all references to the register function, it's not necessary to do that to get a result that will satisfy most admins. It's more the sort of thing that appeals to devs. The average admin can use a much simpler method.
Indeed it started to sound as if we were developing a whole mod here not just a tip xD
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Arantor


Antechinus

Quote from: Flavio93Zena on June 10, 2014, 05:58:36 PMIndeed it started to sound as if we were developing a whole mod here not just a tip xD

There are only three language strings that need editing in "General Strings". Those should take care of most of the publicly visible stuff. There may be one or two other strings that a really fussy admin might want to edit.


Ninja ZX-10RR

Quote from: Arantor on June 10, 2014, 06:02:00 PM
That got me thinking... http://custom.simplemachines.org/mods/index.php?mod=3618 was what I found.
Yep but it somehow puts registration mode into a so-called maintenance mode.
Grabbed directly from the mod's code
$modSettings['registration_method'] != 3 && !$context['in_maintenance']) and things like that so it's pretty much different I would say *wew* :P
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Matthew K.

All that code is doing is saying as long as registration isn't disabled completely, and the forum isn't in maintenance mode.

Advertisement: