Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Mick. on April 17, 2010, 09:31:01 AM

Title: Register at post View v.1.1
Post by: Mick. on April 17, 2010, 09:31:01 AM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=2492)

This mod will add 2 register buttons to post view and message index,..... Top and bottom.

Created on March 15th, 2010
Revision #1 - v.1.1  Added buttons to message index.
             #2 -Updated to 2.0.2

Created by idesignSMF.com

(https://www.idesignsmf.com/images/idesignadvert.png) (https://www.idesignsmf.com)
Title: Re: Register at post View v.1
Post by: kingkingston on April 18, 2010, 12:07:52 AM
Awesome mod for people who use the twitter mod as well
Title: Re: Register at post View v.1
Post by: Afro on April 18, 2010, 07:48:29 AM
This sounds good.. Thanks for the mod..

It would be nice also if you can add the link on the message index to say "REGISTER TO CREATE A TOPIC"
Just a suggestion.
Title: Re: Register at post View v.1
Post by: Mick. on April 18, 2010, 10:23:46 AM
Quote from: Afro on April 18, 2010, 07:48:29 AM
This sounds good.. Thanks for the mod..

It would be nice also if you can add the link on the message index to say "REGISTER TO CREATE A TOPIC"
Just a suggestion.

Good idea..... im sure something can be worked out.
Title: Re: Register at post View v.1
Post by: Afro on April 18, 2010, 11:24:43 AM
Very well. I remember there was a time i asked for advice on how to allow the guests to see the "NEW TOPIC" Button,
which will of course direct them to Registration page. This is a perfect mod for that.
So you can use something like "START" instead of "CREATE".
Title: Re: Register at post View v.1.1
Post by: Mick. on April 24, 2010, 02:40:27 PM
Added a "Register to create new topic" in message index per request.   Thanx Afro for the idea. ;)

Remove old mod and delete from mod list in admin.    Upload new version v.1.1
Title: Re: Register at post View v.1
Post by: Afro on April 24, 2010, 04:01:22 PM
Weldone. Its a good mod since many newbies don't really know where the registration button is located on the menubar.
Installed perfectly. I changed my
"REGISTER TO COMMENT ON THIS TOPIC" to "COMMENT ON THIS TOPIC"
"REGISTER TO CREATE NEW TOPIC" to "START NEW TOPIC" in the language file.
it will of course direct them to the reg page.

..
Title: Re: Register at post View v.1
Post by: Rohan_ on April 26, 2010, 07:17:51 AM
i wanna use this on 1.1.11 please tell me how do i do that please
Title: Re: Register at post View v.1
Post by: Rohan_ on April 26, 2010, 07:51:28 AM
i made it different :) ... the url is not direct to register .. i made it like this

if ($user_info['is_guest'])
$buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/reply.gif" alt="' . $txt[146] . '" border="0" />' : $txt[146]) . '</a>';


because of this the url guests see is the reply url not register and when they click on it the forum tell them only registered users are allowed to access this section please register or login

can this be a problem ?

anyways thanks for the mod :)
Title: Re: Register at post View v.1
Post by: Afro on April 26, 2010, 09:41:47 AM
Its a good idea Rohan
Title: Re: Register at post View v.1
Post by: Rohan_ on April 26, 2010, 10:29:03 AM
Thanks Afro
Title: Re: Register at post View v.1
Post by: Afro on April 26, 2010, 11:12:36 AM
Quote from: Rohan_ on April 26, 2010, 10:29:03 AM
Thanks Afro

You can also make things a little clear for rookies by writing the file(s) you modified like i did on my post here.
like
theme/default/registertemplate.php
or another file.
Title: Re: Register at post View v.1
Post by: Rohan_ on April 26, 2010, 12:07:52 PM
no i did not edited registertemplate ......... i just edited the display.template and messageindex.template and and gave the link of reply or new topic for guests and in permissions i set that guests can not reply or create new topic so whenever a guest click on the new topic or reply button they will automatically see the login page because their step has been rejected from the permissions
Title: Re: Register at post View v.1
Post by: Afro on April 26, 2010, 02:03:15 PM
I understand. I just said that you should tell the file.
Its ok.
Title: Re: Register at post View v.1
Post by: ActivePatriot on August 15, 2010, 08:50:13 PM
I get this error when trying to download the package:

QuoteAlthough the package was downloaded to the server it appears to be   empty. Please check the Packages directory, and the "temp" sub-directory   are both writable. If you continue to experience this problem you   should try extracting the package on your PC and uploading the extracted   files into a subdirectory in your Packages directory and try again. For   example, if the package was called shout.tar.gz you should:
1) Download the package to your local PC and extract it into files.
2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
3) Upload all the files from the extracted package to this directory.
4) Go back to the package manager browse page and the package will be automatically found by SMF.

Is the package empty?
Title: Re: Register at post View v.1
Post by: Spoogs on August 15, 2010, 08:59:15 PM
download to your computer first then upload via package manager
Title: Re: Register at post View v.1
Post by: ActivePatriot on August 23, 2010, 04:17:18 PM
Quote from: Spoogs on August 15, 2010, 08:59:15 PM
download to your computer first then upload via package manager

Thanks, that worked.
Title: Re: Register at post View v.1
Post by: PenelopeQ on October 17, 2010, 08:08:00 AM
I received an error message.
QuoteError in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

Here is the table of what failed and what did not fail.
TypeActionDescription
Execute Modification ./Themes/default/Display.template.PHPTest failed
Replace ./Themes/default/Display.template.PHPTest successful
Add After ./Themes/default/Display.template.PHPTest failed
Execute Modification ./Themes/default/MessageIndex.template.PHPTest failed
Replace ./Themes/default/MessageIndex.template.PHPTest failed
Add After ./Themes/default/MessageIndex.template.PHPTest successful
Execute Modification ./Themes/default/languages/Modifications.english.PHPTest successful
Add Before ./Themes/default/languages/Modifications.english.PHPTest successful
Execute Modification ./Themes/default/languages/Modifications.english-utf8.PHPTest successful
Title: Re: Register at post View v.1
Post by: henrik1782 on December 06, 2010, 09:18:33 AM
Nice mod....

Here is the Danish tranlation


<file name="$themedir/languages/Modifications.danish.php" error="skip">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[
$txt['registertopost'] = 'Registrer for at kommentere dette indlæg';
$txt['registertocreate'] = 'Registrer for at tilføje et indlæg';
]]></add>
</operation>

</file>

<file name="$themedir/languages/Modifications.danish-utf8.php" error="skip">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[
$txt['registertopost'] = 'Registrer for at kommentere dette indlæg';
$txt['registertocreate'] = 'Registrer for at tilføje et indlæg';
]]></add>
</operation>

</file>


Best regards
Henrik Poulsen
Title: Re: Register at post View v.1
Post by: Mick. on December 06, 2010, 09:42:30 AM
Thank you Henrik!
Title: Re: Register at post View v.1
Post by: Clickout on September 01, 2011, 11:07:28 PM
can i use this mod for smf 2.0 ?
Title: Re: Register at post View v.1
Post by: Mick. on September 02, 2011, 11:34:28 AM
Quote from: Clickout on September 01, 2011, 11:07:28 PM
can i use this mod for smf 2.0 ?
yes.
Title: Re: Register at post View v.1
Post by: Eclipse16V on December 11, 2012, 07:50:39 AM
Thanks for the update
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 04, 2013, 04:01:56 PM
Nice, thanks!
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 04, 2013, 06:56:41 PM
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.
Title: Re: Register at post View v.1
Post by: Mick. on February 04, 2013, 08:17:40 PM
@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>';
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 04, 2013, 09:13:28 PM
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,

Title: Re: Register at post View v.1
Post by: Mick. on February 04, 2013, 10:21:49 PM
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 />';
}
Title: Re: Register at post View v.1
Post by: 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,
Title: Re: Register at post View v.1
Post by: Mick. on February 05, 2013, 08:42:59 AM
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 ;)
Title: Re: Register at post View v.1
Post by: Mick. on February 05, 2013, 08:57:17 AM
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();
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 05, 2013, 11:30:56 AM
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,
Title: Re: Register at post View v.1
Post by: Mick. on February 06, 2013, 09:39:09 AM
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 />';
}
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 06, 2013, 10:45:25 AM
That moved it up, but it also ended up moving the post icons on the right side down.

Title: Re: Register at post View v.1
Post by: Mick. on February 06, 2013, 11:19:34 AM
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>';
}
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 06, 2013, 12:07:47 PM
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. 
Title: Re: Register at post View v.1
Post by: Mick. on February 06, 2013, 12:12:14 PM
Awesome AJ ;)
Title: Re: Register at post View v.1
Post by: ApplianceJunk on February 06, 2013, 12:16:16 PM
Thanks,
Title: Re: Register at post View v.1
Post by: 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.

Title: Re: Register at post View v.1
Post by: Mick. on July 10, 2013, 07:16:44 PM
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!
Title: Re: Register at post View v.1
Post by: Mick. on July 10, 2013, 07:17:43 PM
Oh dang, i see how you did it. Time to study a bit about hooks. Thanx again.
Title: Re: Register at post View v.1
Post by: IchBin™ on July 10, 2013, 09:11:50 PM
Yeah, hooks are pretty dang cool. Just a couple of database entries and you're good to go. It'll call the file, an the other hooks call the functions needed. I think in SMF2.1 you can call a file with a hook, so no more requiring a file separately which is awesome.
Title: Re: Register at post View v.1
Post by: Mick. on July 10, 2013, 09:40:35 PM
Quote from: IchBin™ on July 10, 2013, 09:11:50 PM
Yeah, hooks are pretty dang cool. Just a couple of database entries and you're good to go. It'll call the file, an the other hooks call the functions needed. I think in SMF2.1 you can call a file with a hook, so no more requiring a file separately which is awesome.
Im studying it. This is something i should get into as i have a couple of mod ideas id like to make.
Title: Getting test failures with SMF 2.0.7
Post by: SDMiller on February 03, 2014, 12:28:23 AM
Seems like a great mod... but see the attached ss for where the instal tests fail.

FYI, I have the following mods installed:
Stop Spammer 2.3.9
httpBL 2.5.1
SimplePortal 2.3.5
Sneaky Editing 1.1
Glossary 0.3.1 (version 0 means what?, lol)
Ohara YouTube Embed 1.0
Peoplesign 1.6
Add IP2Location to Track IP 1.3
More Spiders 1.2


Any hope of an easy fix/manual instal situation?

Thanks.
Title: Re: Register at post View v.1
Post by: IchBin™ on February 05, 2014, 08:42:02 PM
Assuming you are using SMF2, try the package in this post on page 2 of this topic. I updated it for Mick. but it looks like he didn't put the update on the mod page. :)
Title: Re: Register at post View v.1
Post by: MotRude on February 05, 2014, 10:19:28 PM
This mod works great with 2.0.7..also works with different themes.

Title: Re: Register at post View v.1.1
Post by: pocttopus on July 29, 2018, 06:01:53 AM
Works on 2.0.15. :D
Thanks... this is great mod!  ;)
Title: Re: Register at post View v.1.1
Post by: Mick. on July 29, 2018, 09:29:16 AM
Quote from: pocttopus on July 29, 2018, 06:01:53 AM
Works on 2.0.15. :D
Thanks... this is great mod!  ;)
:)