Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: sonnyh on July 08, 2019, 08:15:09 AM

Title: Disable self registration
Post by: sonnyh on July 08, 2019, 08:15:09 AM
Hi,
I have the self register turned off.
Is there a way to remove the "Register" button?
If not is there a way to change the message that pops up when register is selected?
Title: Re: Disable self registration
Post by: GigaWatt on July 08, 2019, 08:35:44 AM
You can disable registrations all together ;).

Admin --> Members --> Registration --> Settings --> Method of registration employed for new members: Registration Disabled
Title: Re: Disable self registration
Post by: Illori on July 08, 2019, 08:49:19 AM
Quote from: GigaWatt on July 08, 2019, 08:35:44 AM
You can disable registrations all together ;).

Admin --> Members --> Registration --> Settings --> Method of registration employed for new members: Registration Disabled

they said they have done that already, that does not remove the registration button.
Title: Re: Disable self registration
Post by: GigaWatt on July 08, 2019, 08:57:53 AM
Then the OP would have to do manual edits :-\.

PS: Why doesn't the Registration button disappear when registrations are disabled? Seems logical to make it appear and disappear based on whether the forum's admin wants registrations enabled or disabled. 
Title: Re: Disable self registration
Post by: Kindred on July 08, 2019, 09:17:31 AM
note: not fully tested...


Code (in Subs.php -- search for) Select

'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),



Code (replace with) Select

'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'] && ($modSettings['registration_method'] <> 3),
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),

Title: Re: Disable self registration
Post by: Sir Osis of Liver on July 08, 2019, 12:24:13 PM
Quote from: GigaWatt on July 08, 2019, 08:57:53 AM
Why doesn't the Registration button disappear when registrations are disabled? Seems logical to make it appear and disappear based on whether the forum's admin wants registrations enabled or disabled. 

This has been done in 2.1, and I think it's a bad idea, especially if there's no contact link on the forum.  People visiting a forum they're interested in for first time expect to see some means or instructions for registering.  If there's nothing, it leaves them floundering with no way to join the forum, and no explanation why they can't.  We sometimes see posts here from people who are unable to join forums, and have no way of contacting a forum admin.

I think it's a bad idea. >:(
Title: Re: Disable self registration
Post by: Illori on July 08, 2019, 12:42:25 PM
usually those that cant register and come here, cannot complete registration due to a question they cannot answer not because the registration is disabled.
Title: Re: Disable self registration
Post by: Sir Osis of Liver on July 08, 2019, 12:50:20 PM
There are various reasons why people come here with registration questions, most commonly that they can't register and there's no way to contact an admin.  But that kind of misses the point.  Running a public forum with no registration or contact link is a good way to discourage visitors from ever returning.  In 2.0 there's at least a message that registration is disabled, it's better than giving them nothing.  I've restored the button and message on my RC2 work install, it's not a big deal and provides a basic courtesy to visitors.

Title: Re: Disable self registration
Post by: GigaWatt on July 08, 2019, 08:28:56 PM
You have a point there Sir Osis of Liver... but... if it's a private forum and the owner doesn't want anyone to register or contact him/her, IMO that's a valid reason to have the Registration button disabled. He/she might not want visitors returning... in the admin's eyes, maybe discouraging visitors to visit the site is a good thing ;).
Title: Re: Disable self registration
Post by: sonnyh on July 08, 2019, 09:14:15 PM
Thank you for the replies.
This is, in fact, a private forum, where registration is done by the admin based on certain required vetting.

The code provided by "Kindred" was helpful and did remove one of the registration buttons on the guest page.
Thank you Kindred.

There is one other are on the right of the guest page that says " Welcome, Guest. Please login or register" which I would also like to get rid of.

I would appreciate any suggestions.

Again, thank you for all the replies.

Best,
Sonny
Title: Re: Disable self registration
Post by: Sir Osis of Liver on July 08, 2019, 09:52:42 PM
You can edit the text here -

/Themes/default/languages/index.english.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>.';



  or remove it here -

index.template.php



// 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>';


Title: Re: Disable self registration
Post by: Sir Osis of Liver on July 08, 2019, 10:01:55 PM
Quote from: GigaWatt on July 08, 2019, 08:28:56 PM
if it's a private forum and the owner doesn't want anyone to register or contact him/her, IMO that's a valid reason to have the Registration button disabled. He/she might not want visitors returning... in the admin's eyes, maybe discouraging visitors to visit the site is a good thing ;).

My two production forums are private, invitation only.  Registration is disabled on my family forum, admin approval on my support forum.  I don't have any problem with the registration button, have never had a bot register or spammer post on either forum.  If visitors or spiders are seeing the forum, it's unavoidable, but has no effect on the forum or my members.  It's just not a problem.
Title: Re: Disable self registration
Post by: Aleksi "Lex" Kilpinen on July 08, 2019, 11:28:29 PM
Quote from: Sir Osis of Liver on July 08, 2019, 12:24:13 PM
Quote from: GigaWatt on July 08, 2019, 08:57:53 AM
Why doesn't the Registration button disappear when registrations are disabled? Seems logical to make it appear and disappear based on whether the forum's admin wants registrations enabled or disabled. 

This has been done in 2.1, and I think it's a bad idea, especially if there's no contact link on the forum.  People visiting a forum they're interested in for first time expect to see some means or instructions for registering.  If there's nothing, it leaves them floundering with no way to join the forum, and no explanation why they can't.  We sometimes see posts here from people who are unable to join forums, and have no way of contacting a forum admin.

I think it's a bad idea. >:(

Going off topic, but I agree with you. I believe the original idea to keep the button and offer an explanation was done just because of this. It can be confusing to find a forum that you don't know how to register to, or are unsure if you even can.
Title: Re: Disable self registration
Post by: sonnyh on July 09, 2019, 08:47:40 AM
Thanks to Sir Osis of Liver for location of "Welcome Guest line"

Thank you all for the help and discussion regarding this issue.

Best,
Sonny
Title: Re: Disable self registration
Post by: Mareid on August 07, 2019, 04:49:51 PM
I want to do the same thing, disable the "Register" button.  What I've done is provided a forum called "Click HERE to register or retrieve a lost password/user ID" and within that forum are just two posts, one telling potential registrants to send an email to [email protected], and the other saying how to retrieve a lost password.  Still, my unsophisticated potential users are confused and click the "Register" button in the menu above, which leads to more confusion when they get the "Registrations are disabled" message.  I'd also like to get rid of the search box (not shown in the screenshot) in the upper right corner, but I can live with that.



(https://manasotaweaversguild.com/screenshot.png)

Kindred's code worked great!