News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How to make Guests see register/join on post

Started by tstark, March 15, 2010, 08:20:48 PM

Previous topic - Next topic

tstark

Hi, first post here... great software and I hope the support is just as good.

I was wondering where I could find a switch or modification (if it exists) to allow guests to see a "Register or Login" upon viewing a topic.  Either at the top or the bottom or both.

example..

--- Begin Topic
blah blah blah blah blah blah blah blah blah blah..
--- End Topic

then it would say something like this.

"You must Register to post or comment on this topic"

something along those lines would be nice.. and the reason for this is because alot of my traffic is from search engines, and links, that link directly to a post and I would like the guest user to at least see a register/login at the bottom of the post once they are done reading it.


thanks in advance.

Mick.


Mick.


aED


manis99

Cool. So u r almost done. Gud work.

But it would be grt if it hide links too and show link to register.

Mick.

What im trying to figure out is,   hiding the link once logged in.   

Heres the button:
'registertopost' => array('text' => 'registertopost', 'image' => 'register.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=register'),

I have tried several formulas to remove the link once logged in the code above but i still see it:

'show' => if ($user_info['is_guest']),

'show' => $user_info['is_guest'],

if (!$context['user']['is_guest']

sAce

            'show' => $user_info['is_guest'],

this should have worked

Mick.

Quote from: S-Ace on March 15, 2010, 11:03:09 PM
            'show' => $user_info['is_guest'],

this should have worked

Thats the problem.  No matter where i put it... before,middle or after, i still see it once logged.

sAce


Mick.

Quote from: S-Ace on March 15, 2010, 11:12:46 PM
where is the button located ?

default display.template.php


find:


'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),


add before:
'register' => array('text' => 'register', 'image' => 'register.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=register'),

sAce

Code (find on top) Select
global $context, $settings, $options, $txt, $scripturl, $modSettings;
Code ( replace with) Select
global $context, $settings, $options, $txt, $scripturl, $user_info, $modSettings;

Mick.

Quote from: S-Ace on March 15, 2010, 11:22:52 PM
Code (find on top) Select
global $context, $settings, $options, $txt, $scripturl, $modSettings;
Code ( replace with) Select
global $context, $settings, $options, $txt, $scripturl, $user_info, $modSettings;


eh,...I already have that added on.

Here's what i got so far:
'register' => array('show' => $user_info['is_guest'], 'text' => 'register', 'image' => 'register.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=register'),

But i still see it after logged in.

sAce

'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
);
if ($user_info['is_guest'])
$normal_buttons['register'] = array('text' => 'register', 'image' => 'register.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=register');


works, i tested :P

Mick.

I see what you did.   Its like starting over with:
$normal_buttons

I saw that but never crossed my mind.   Thanx Ace.



Mick.

@ tstark

Demo: http://www.bluedevilcustoms.com/devsite/index.php?topic=1.msg1#msg1


Open: Themes/default/Display.template.php

Find:
global $context, $settings, $options, $txt, $scripturl, $modSettings;

and replace with:
global $context, $settings, $options, $txt, $scripturl,  $user_info, $modSettings;



Find:
'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
);


Add after:
if ($user_info['is_guest'])
      $normal_buttons['register'] = array('text' => 'registertopost', 'image' => 'register.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=register',

   );




Open:
default/languages/Modifications.english.php

Find:
?>

Add before:
$txt['registertopost'] = 'Register to comment on this topic';

Open:
default/languages/Modifications.english-utf8.php

Find:
?>

Add before:
$txt['registertopost'] = 'Register to comment on this topic';

tstark

WOW.

That was fast! .. You guys are great.

Am I the only person who finds this feature useful?

Thanks again!

Mick.

Quote from: tstark on March 16, 2010, 12:50:37 PM
WOW.

That was fast! .. You guys are great.

Am I the only person who finds this feature useful?

Thanks again!

Yep,.....and i made it as a mod too. ;)

sAce


tstark

Quote from: BlueDevil on March 16, 2010, 12:53:01 PM

Yep,.....and i made it as a mod too. ;)

Nice man! .. So forgive me, but because I modified the files, when I do an upgrade I will lose this data correct? ..

If you have a mod, can you post it and let me know, so I can subscribe to it's changes for future updates of the forum software.

Thanks again dude, you rock.

Advertisement: