Advertisement:

Author Topic: [TIP/TRICK] Remove register button  (Read 9302 times)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,845
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #20 on: June 10, 2014, 05:20:23 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,152
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: [TIP/TRICK] Remove register button
« Reply #21 on: June 10, 2014, 05:24:58 PM »
*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

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,369
Re: [TIP/TRICK] Remove register button
« Reply #22 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.  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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,845
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #23 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,790
  • Master of BBC Abuse
Re: [TIP/TRICK] Remove register button
« Reply #24 on: June 10, 2014, 05:34:18 PM »
How about a really basic way of doing this, that requires only a minor CSS change?

Code: [Select]
#button_register {display: none;}
That will hide the button. Then just disable registration in admin. Sorted.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,845
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #25 on: June 10, 2014, 05:36:30 PM »
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 ;)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,790
  • Master of BBC Abuse
Re: [TIP/TRICK] Remove register button
« Reply #26 on: June 10, 2014, 05:39:29 PM »
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 ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,845
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #27 on: June 10, 2014, 05:46:06 PM »
* except when it doesn't work 100% properly and requires elevated file permissions
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,152
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: [TIP/TRICK] Remove register button
« Reply #28 on: June 10, 2014, 05:48:13 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 ;)

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.

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:
Code: [Select]
'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:
Code: [Select]
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
Code: [Select]
$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
Code: [Select]
$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

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,152
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: [TIP/TRICK] Remove register button
« Reply #29 on: June 10, 2014, 05:50:31 PM »
How about a really basic way of doing this, that requires only a minor CSS change?

Code: [Select]
#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

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,790
  • Master of BBC Abuse
Re: [TIP/TRICK] Remove register button
« Reply #30 on: June 10, 2014, 05:55:09 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.

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,152
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: [TIP/TRICK] Remove register button
« Reply #31 on: June 10, 2014, 05:58:36 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,845
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #32 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,790
  • Master of BBC Abuse
Re: [TIP/TRICK] Remove register button
« Reply #33 on: June 10, 2014, 06:03:34 PM »
Indeed 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.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,790
  • Master of BBC Abuse
Re: [TIP/TRICK] Remove register button
« Reply #34 on: June 10, 2014, 06:05:56 PM »

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,152
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
Re: [TIP/TRICK] Remove register button
« Reply #35 on: June 10, 2014, 06:08:11 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
Code: [Select]
$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

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: [TIP/TRICK] Remove register button
« Reply #36 on: June 11, 2014, 09:55:27 AM »
All that code is doing is saying as long as registration isn't disabled completely, and the forum isn't in maintenance mode.