News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Add Text To User Info Bit

Started by njtweb, May 03, 2019, 08:00:51 AM

Previous topic - Next topic

njtweb

I know this spot isn't called user info bit, I just don't know what the technical name is for this area.

Per the attached image. I need to put "REGISTRATION NOT REQUIRED" in red before the "Guest/Member" detail area. I post all of my articles on social media and it's inevitable I will get at least one a-hole a day who will complain, "I can't read this article, it's making me register, this is spam". As you can see I already have it in a top block on my TinyPortal front page but that's not good enough. Guests see the login/register area as soon as they click a link on their phones. They won't go any further.

Can somebody advise which template file I need to edit, (presumably index) and where exactly in the code so I don't screw it up?

I just want to add the following HTML.

<font color="#ff0000>REGISTRATION NOT REQUIRED</font>

Thank you, any help is greatly appreciated.

Sir Osis of Liver

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">
<span style="color: #ff0000;">REGISTRATION NOT REQUIRED</span><br />', 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>';


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

njtweb

Quote from: Sir Osis of Liver on May 03, 2019, 01:06:58 PM
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">
<span style="color: #ff0000;">REGISTRATION NOT REQUIRED</span><br />', 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 I could buy you a beer, I most certainly would. Than you sir, very much appreciated.

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters


Mick.

No need to inject css styles directly to the page. Instead use a class and serve it from the css file. That's what is for.

Your theme's CSS file at the very end add,

.notrequired {
  color: #ff0000;
}


...and on the index.template just add...
<span class="notrequired">REGISTRATION NOT REQUIRED</span>

@rjen

Quote from: njtweb on May 03, 2019, 08:00:51 AM
I know this spot isn't called user info bit, I just don't know what the technical name is for this area.

Per the attached image. I need to put "REGISTRATION NOT REQUIRED" in red before the "Guest/Member" detail area. I post all of my articles on social media and it's inevitable I will get at least one a-hole a day who will complain, "I can't read this article, it's making me register, this is spam". As you can see I already have it in a top block on my TinyPortal front page but that's not good enough. Guests see the login/register area as soon as they click a link on their phones. They won't go any further.

Can somebody advise which template file I need to edit, (presumably index) and where exactly in the code so I don't screw it up?

I just want to add the following HTML.

<font color="#ff0000>REGISTRATION NOT REQUIRED</font>

Thank you, any help is greatly appreciated.

I know you have guest postings allowed and you are keeping your forum open and accessible to guests, so why do you even still show the Quick login area?
You do know that you can just suppress the complete Quick login block?
This way people can still register and login via the menu options, but your social media visitors will not be confronted with a login box at all.. seems the best way to deal with this...

Admin > Configuration > Features and Options > Layout
Show a quick login on every page > remove the tickbox...




Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

njtweb

Quote from: @rjen on May 04, 2019, 09:13:45 AM
Quote from: njtweb on May 03, 2019, 08:00:51 AM
I know this spot isn't called user info bit, I just don't know what the technical name is for this area.

Per the attached image. I need to put "REGISTRATION NOT REQUIRED" in red before the "Guest/Member" detail area. I post all of my articles on social media and it's inevitable I will get at least one a-hole a day who will complain, "I can't read this article, it's making me register, this is spam". As you can see I already have it in a top block on my TinyPortal front page but that's not good enough. Guests see the login/register area as soon as they click a link on their phones. They won't go any further.

Can somebody advise which template file I need to edit, (presumably index) and where exactly in the code so I don't screw it up?

I just want to add the following HTML.

<font color="#ff0000>REGISTRATION NOT REQUIRED</font>

Thank you, any help is greatly appreciated.

I know you have guest postings allowed and you are keeping your forum open and accessible to guests, so why do you even still show the Quick login area?
You do know that you can just suppress the complete Quick login block?
This way people can still register and login via the menu options, but your social media visitors will not be confronted with a login box at all.. seems the best way to deal with this...

Admin > Configuration > Features and Options > Layout
Show a quick login on every page > remove the tickbox...

Did not know that. I learn something new every day. I'll see how that goes for a bit. Thanks rjen!

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: