Advertisement:

Author Topic: Add Text To User Info Bit  (Read 795 times)

Offline njtweb

  • Sr. Member
  • ****
  • Posts: 900
Add Text To User Info Bit
« 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.

Code: [Select]
<font color="#ff0000>REGISTRATION NOT REQUIRED</font>
Thank you, any help is greatly appreciated.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,154
Re: Add Text To User Info Bit
« Reply #1 on: May 03, 2019, 01:06:58 PM »
index.template.php

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


Offline njtweb

  • Sr. Member
  • ****
  • Posts: 900
Re: Add Text To User Info Bit
« Reply #2 on: May 03, 2019, 01:51:13 PM »
index.template.php

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">
<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.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,154
Re: Add Text To User Info Bit
« Reply #3 on: May 03, 2019, 09:47:09 PM »

      ;)

Offline njtweb

  • Sr. Member
  • ****
  • Posts: 900
Re: Add Text To User Info Bit
« Reply #4 on: May 04, 2019, 07:52:50 AM »

Offline Mick.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,977
  • Gender: Male
    • idesignSMF on Facebook
    • @idesign360 on Twitter
    • idesignSMF.com
Re: Add Text To User Info Bit
« Reply #5 on: May 04, 2019, 08:01:24 AM »
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,

Code: [Select]
.notrequired {
  color: #ff0000;
 }

...and on the index.template just add...
Code: [Select]
<span class="notrequired">REGISTRATION NOT REQUIRED</span>

Offline @rjen

  • Full Member
  • ***
  • Posts: 465
  • Gender: Male
Re: Add Text To User Info Bit
« Reply #6 on: May 04, 2019, 09:13:45 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.

Code: [Select]
<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.0 with Tinyportal 1.6.3 at www.fjr-club.nl
Testing SMF 2.1 RC2 with Tinyportal 1.6.4 at http://test2.fjr-club.nl/

Offline njtweb

  • Sr. Member
  • ****
  • Posts: 900
Re: Add Text To User Info Bit
« Reply #7 on: May 04, 2019, 10:23:22 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.

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

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 9,154
Re: Add Text To User Info Bit
« Reply #8 on: May 04, 2019, 03:17:51 PM »