Advertisement:

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

Offline Ninja ZX-10RR

  • SMF Hero
  • ******
  • Posts: 2,152
  • Gender: Male
  • Sniper Legends
    • Flavio93Zena on Facebook
    • Virtual Interactive Games Entertainment Forum
[TIP/TRICK] Remove register button
« on: June 10, 2014, 01:36:14 PM »
Question: How can I remove the registration button and prevent user from registering?


Open /Sources/Subs.php and find:
Code: [Select]
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],

Replace with:
Code: [Select]
'href' => $scripturl . '?action=register',
'show' => false,



Open root/index.php and find:
Code: [Select]
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn'))))

Replace with:
Code: [Select]
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', /*'register', 'register2',*/ 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn'))))



Again in index.php find:
Code: [Select]
'register' => array('Register.php', 'Register'),
'register2' => array('Register.php', 'Register2'),

Replace with:
Code: [Select]
/*'register' => array('Register.php', 'Register'),
'register2' => array('Register.php', 'Register2'),*/



Open the login.template.php of your theme and find:
Code: [Select]
', $txt['login_below'], ' <a href="', $scripturl, '?action=register">', $txt['register_an_account'], '</a> ', sprintf($txt['login_with_forum'],
Replace with:
Code: [Select]
', $txt['login_below'], /* '<a href="', $scripturl, '?action=register">', $txt['register_an_account'], '</a> ', */ sprintf($txt['login_with_forum'],



Important:  you will also need to disable the registration process by going in Admin-->Registration-->Settings-->Method of registration employed for new members and set "Registration Disabled"

And that's it ;) it can be useful if you want your forum to be private or even if you have too many users etc...

For further reference please check out this topic --> http://www.simplemachines.org/community/index.php?topic=523689.0





Special thanks to mashby, Illori and Krash, Herman's Mixen and as always Arantor for helping me in writing this.



« Last Edit: June 10, 2014, 05:16:38 PM by Flavio93Zena »
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 #1 on: June 10, 2014, 01:38:20 PM »
#request move as indicated in tips and tricks board.
#request deletion of this message after that ;)
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 Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,617
Re: [TIP/TRICK] Remove register button
« Reply #2 on: June 10, 2014, 01:49:07 PM »
that is not the only location where
Code: [Select]
'show' => $user_info['is_guest'], is found in that file the first location would be for the log in button.

also without disabling registration, you are not stopping them from registering

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,479
Re: [TIP/TRICK] Remove register button
« Reply #3 on: June 10, 2014, 03:22:12 PM »
Yep, bots don't need the button, they link directly to registration -

Code: [Select]

http://www.forum.com/index.php?action=register


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 #4 on: June 10, 2014, 03:23:47 PM »
Yeah, exactly as Krash. is saying, removing the button will not prevent registrations. It will just stop real people from knowing it's there (and people who don't know SMF)

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 #5 on: June 10, 2014, 03:24:36 PM »
Updated and edited ;)
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,479
Re: [TIP/TRICK] Remove register button
« Reply #6 on: June 10, 2014, 03:33:52 PM »
There's also a register link in the header login, for those themes that have one (i.e., Curve), which you would want to remove for consistency.

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 #7 on: June 10, 2014, 03:40:18 PM »
There's also a register link in the header login, for those themes that have one (i.e., Curve), which you would want to remove for consistency.
Doesn't it get deactivated in the same way by disabling the function from the admin settings? If not can you please tell me how to disable that so I can add it because I can't find where it is? After that *hopefully  O:)* everything will be correct :)
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 Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 51,617
Re: [TIP/TRICK] Remove register button
« Reply #8 on: June 10, 2014, 03:42:39 PM »
i doubt it gets disabled automatically. you would find it in index.template.php

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 #9 on: June 10, 2014, 03:48:08 PM »
I think I found it and you are referring to this one:
Code: [Select]
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
elseif (!empty($context['show_login_bar']))
{
echo '
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
<form id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<div class="info">', sprintf($txt['welcome_guest'], $txt['guest_title']), '</div>
<input type="text" name="user" size="10" class="input_text" />
<input type="password" name="passwrd" size="10" class="input_password" />
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
<input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
<div class="info">', $txt['quick_login_dec'], '</div>';

if (!empty($modSettings['enableOpenID']))
echo '
<br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';

echo '
<input type="hidden" name="hash_passwrd" value="" />
</form>';
}
Still it refers to a login bar but I don't want to disable the whole bar putting */ stuff /* because I would disable the whole bar. How could I do it then leaving the login untouched but removing the register thing only?
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,479
Re: [TIP/TRICK] Remove register button
« Reply #10 on: June 10, 2014, 03:52:28 PM »
Disabling registration does not remove the buttons/links.  User gets an error message that registration is disabled.  The header login is in index.template.php, and pulls the link text from index.english.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>.';


That's from Curve, it can vary with theme.

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 #11 on: June 10, 2014, 04:08:30 PM »
Soooo if I am correct even if I am noob at coding... Could this one be ok?
Code: [Select]
$txt['welcome_guest'] = 'Welcome, <strong>%1$s</strong>. Please <a href="' . $scripturl . '?action=login">login</a>;
$txt['login_or_register'] = 'Please <a href="' . $scripturl . '?action=login">login</a>;
(uhm I think I should leave the "register" in the txt because it would not be able to call it properly.. Correct me if I'm wrong)

And shall I edit only this one in languages or more? And for each language? D:
Tried the index.template.php but couldn't find more than what I already wrote before.
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 Herman's Mixen

  • SMF Hero
  • ******
  • Posts: 7,257
    • HermanMixen on Facebook
    • @Hermans_Mixen on Twitter
    • Herman's Mixen
Re: [TIP/TRICK] Remove register button
« Reply #12 on: June 10, 2014, 04:14:08 PM »
index.php

Code: [Select]
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', /*'register', 'register2',*/ 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn'))))

remove the "register" and "register2" from that line

also in the array of actions disable it so it can not be executed...

Code: [Select]
/*'register' => array('Register.php', 'Register'),
'register2' => array('Register.php', 'Register2'),*/
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,479
Re: [TIP/TRICK] Remove register button
« Reply #13 on: June 10, 2014, 04:22:34 PM »
That should work.  All you're doing is removing the register link from the text string.  Yes, you would have to change it in any other languages that are installed.  There's also a register link in the login window that guests see if guest access is disabled.  That's in login.template.php in kick_guest template =

Code: [Select]

', $txt['login_below'], ' <a href="', $scripturl, '?action=register">', $txt['register_an_account'], '</a> ', sprintf($txt['login_with_forum'], $context['forum_name_html_safe']), '


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #14 on: June 10, 2014, 04:26:18 PM »
If registration is actually disabled from the admin panel, all the effort of faffing with index.php to remove guestAccess and removing the actions is suddenly irrelevant.

Oh, and if you use Tapatalk too. That has all kinds of 'eh, don't care about SMF's settings or rules' in it.
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 #15 on: June 10, 2014, 05:07:53 PM »
If registration is actually disabled from the admin panel, all the effort of faffing with index.php to remove guestAccess and removing the actions is suddenly irrelevant.
Actually yes but I believe that any human being can understand this already :) People wanting to disable totally the guest access might be experienced users as they want their forum to be private-only so probably they would like to know how to totally delete that function that's why we are trying to get rid of all of those ;)

Oh, and if you use Tapatalk too. That has all kinds of 'eh, don't care about SMF's settings or rules' in it.
Did you have any doubt about it? It's Tapatalk xD




Anyway, updated :) check it (once again) if you don't mind ;)
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,982
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #16 on: June 10, 2014, 05:09:12 PM »
But that's the point... if it's already disabled in the admin panel, you don't need to remove the declaration of the action, because it'll stop when it gets to the action itself.
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 #17 on: June 10, 2014, 05:12:53 PM »
I know it will not work anyhow even if people *will* be able to see it but the fact is that admins wanting their forum to be private-only for ever wouldn't like it to appear anyway as it's not possible. Why showing up an option if it doesn't work? It would be my point if I was admin of such a forum.

And besides thank you everyone huh! I couldn't do this all by myself, now I understand why noone had ever made this :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 Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: [TIP/TRICK] Remove register button
« Reply #18 on: June 10, 2014, 05:14:11 PM »
Just removing the reference in index.php like that only means the difference between an error message and a login box anyway ;)
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 #19 on: June 10, 2014, 05:18:52 PM »
Yeah indeed but *I* don't want the registration box xD login box is ok but no the registration one :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