News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Register at post View v.1.1

Started by Mick., April 17, 2010, 09:31:01 AM

Previous topic - Next topic

Clickout

can i use this mod for smf 2.0 ?

Mick.


Eclipse16V

I worked with:
SMF 2 in German

Shop:
SID Giessen


ApplianceJunk

Could a button be placed on the BoardIndex.template.php too?

I have been trying to get one to display there by looking at the code you created for the other buttons, but I'm not having much luck.

Mick.

@AJ

You used the $user_info at the top of the BoardIndex.template.php?

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



Add the code above either before or after...

if ($context['user']['is_logged'])
{
echo '
<div id="posting_icons" class="floatleft">';

// Mark read button.
$mark_read_button = array(
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
);

echo '
<ul class="reset">
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_none.png" alt="" /> ', $txt['old_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
</ul>
</div>';

ApplianceJunk

QuoteYou used the $user_info at the top of the BoardIndex.template.php?

In BoardIndex.template.php I found this around line 15.

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

and changed it to this.

global $context, $settings, $options, $txt, $scripturl, $user_info, $modSettings;

Then I found this...

if ($context['user']['is_logged'])
{
echo '
<div id="posting_icons" class="floatleft">';

// Mark read button.
$mark_read_button = array(
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
);

echo '
<ul class="reset">
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_none.png" alt="" /> ', $txt['old_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
</ul>
</div>';



and added this above it..

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


so I end up with....


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

if ($context['user']['is_logged'])
{
echo '
<div id="posting_icons" class="floatleft">';

// Mark read button.
$mark_read_button = array(
'markread' => array('text' => 'mark_as_read', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
);

echo '
<ul class="reset">
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_none.png" alt="" /> ', $txt['old_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
</ul>
</div>';


and as a guest on my test site and the rest of your mod installed and don't see the extra button.

What did I do wrong?

Thanks,


Mick.

Forget my previous post.  Lets make it simple for us.  ;)

Find:
template_info_center();

Add before...
if ($context['user']['is_guest'])
{
// Register at post view mod
echo'
                <div class="buttonlist">
                        <ul>
                             <li><a rel="nofollow" href="' ,$scripturl , '?action=register"><span>', $txt['registertocreate'], '</span></a></li>
                        </ul>
                </div><br />';
}

ApplianceJunk

That works, but puts it as shown in the attachment.
I would like to have it placed towards the top and bottom right side instead.

Thanks,

Mick.

Quote from: ApplianceJunk on February 05, 2013, 08:05:59 AM
That works, but puts it as shown in the attachment.
I would like to have it placed towards the top and bottom right side instead.

Thanks,
gimmie a few ;)

Mick.

The css
.buttonlist_reg ul
{
z-index: 100;
padding: 5px;
margin: 0 0.2em 5px 0;
}
.buttonlist_reg ul li
{
margin: 0;
padding: 0;
list-style: none;
float: right;
}
.buttonlist_reg ul li a
{
display: block;
font-size: 0.8em;
color: #000;
background: #e8e8e8 url(../images/theme/menu_gfx.png) no-repeat 0 -60px;
padding: 0 0 0 8px;
margin-left: 12px;
text-transform: uppercase;
cursor: pointer;
}
.buttonlist_reg ul li a:hover
{
background: url(../images/theme/menu_gfx.png) no-repeat 0 0;
color: #fff;
text-decoration: none;
}
.buttonlist_reg ul li a span
{
background: url(../images/theme/menu_gfx.png) no-repeat 100% -60px;
display: block;
height: 19px;
line-height: 19px;
padding: 0 8px 0 0;
}
.buttonlist_reg ul li a:hover span
{
background: #fff url(../images/theme/menu_gfx.png) no-repeat 100% 0;
}


The code:
if ($context['user']['is_guest'])
{
// Register at post view mod
echo'
                <div class="buttonlist_reg">
                    <ul>
                        <li><a rel="nofollow" href="' ,$scripturl , '?action=register"><span> ', $txt['registertocreate'], '</span></a></li>
                    </ul>
                </div>
                <br />';
}


Add before:
echo '
<div id="boardindex_table">
<table class="table_list">';


and add before...
template_info_center();

ApplianceJunk

That works great. Just one thing and I'm sorry if I'm being anal about this...

Could the bottom button be moved up so it's in the same location the "Mark All Messages As Read" is?

I have attached screenshots of how it looks to me.

Thanks,

Mick.

Try this...

Find:
if ($context['user']['is_logged'])
{
echo '
<div id="posting_icons" class="floatleft">';

// Mark read button.



Add before...
if ($context['user']['is_guest'])
{
// Register at post view mod
echo'
                <div class="buttonlist_reg">
                    <ul>
                        <li><a rel="nofollow" href="' ,$scripturl , '?action=register"><span> ', $txt['registertocreate'], '</span></a></li>
                    </ul>
                </div>
                <br />';
}

ApplianceJunk

That moved it up, but it also ended up moving the post icons on the right side down.


Mick.

lol try this...

find:

   if ($context['user']['is_logged'])
{
echo '
<div id="posting_icons" class="floatleft">';

// Mark read button.



add before...

if ($context['user']['is_guest'])
{
// Register at post view mod
echo'
                <div id="posting_icons" class="floatright">
                <div class="buttonlist_reg">
                    <ul>
                        <li><a rel="nofollow" href="' ,$scripturl , '?action=register"><span> ', $txt['registertocreate'], '</span></a></li>
                    </ul>
                </div>
                </div>';
}

ApplianceJunk

That location worked great, thanks!

But instead of using the code in your last post for the button, this...

if ($context['user']['is_guest'])
{
// Register at post view mod
echo'
                <div id="posting_icons" class="floatright">
                <div class="buttonlist_reg">
                    <ul>
                        <li><a rel="nofollow" href="' ,$scripturl , '?action=register"><span> ', $txt['registertocreate'], '</span></a></li>
                    </ul>
                </div>
                </div>';
}


I used the button code from the post with the .css

this...

if ($context['user']['is_guest'])
{
// Register at post view mod
echo'
                <div class="buttonlist_reg">
                    <ul>
                        <li><a rel="nofollow" href="' ,$scripturl , '?action=register"><span> ', $txt['registertocreate'], '</span></a></li>
                    </ul>
                </div>
                <br />';
}


and the reason I did not is because the button/text looks really small on the bottom button compared to the buttons on the Message and Post template pages.

but when using the other button code as I did the button on the BoardIndex looks larger then on the Message and Post pages, lol...

It's not a big deal, just thought I would point it out. I'm using the code on my live site now so you can see what I mean, http://appliancejunk.com

I thought that I could maybe fix the size difference by simply changing the font size in the .css that you had me add, but when I use firebug to inspect all the buttons they all show, font-size: 0.8em.

Thanks a million for all the help. 

Mick.



IchBin™

Mick, saw someone post about this mod and noticed it was perfect for hooks. No files required on the SMF files anymore if you'd like to use this package. Code is all yours if you want to use it.

IchBin™        TinyPortal

Mick.

Quote from: IchBin™ on July 10, 2013, 07:13:00 PM
Mick, saw someone post about this mod and noticed it was perfect for hooks. No files required on the SMF files anymore if you'd like to use this package. Code is all yours if you want to use it.


Awesome. Thanks Brian. The thing is, i dont know crap about hooks lol, mayBE thats why i quit writing mods. Bahahaha!

Advertisement: