Page 1 of 2

Close the PM Notify bar

Posted: 25 May 2011, 19:37
by Makis
Good evening Mr. Stoker its nice have you back again.

I found this mode very useful but I didn’t install it yet because in my board some users don’t have the permission to read pm for some time and for various reasons, so I’m asking you to tell please if and how you can give the option to user to close that pm bar notification without read the pm.

Thanks in advance

Re: Download PM Notify & Guest Register bar

Posted: 25 May 2011, 20:02
by Stoker
All these tough questions :)
You need a cookie. I have no plans for this yet. but maybe in the future.
Here is an example on how it is done: http://www.christianbullock.com/2011/ph ... al-notices

Re: Download PM Notify & Guest Register bar

Posted: 25 May 2011, 20:08
by Makis
Thank you very much I really appreciate it. :)

Re: Download PM Notify & Guest Register bar

Posted: 25 May 2011, 21:15
by Stoker
I have been playing with it tonight, but with no success.
I will see if I can figure it out later.

Re: Download PM Notify & Guest Register bar

Posted: 25 May 2011, 21:19
by Makis
Thanks again…I ll be around :reggae:

Re: Close the PM Notify bar

Posted: 25 May 2011, 22:54
by Stoker
Okay, here is what to do.
I have tried it on a area51 and it is working :)

Donwload, unzip and upload this folder to your forum:
script.zip
(25.28 KiB) Downloaded 260 times
Open styles/prosilver/template/overall_header.html
Find:

Code: Select all

<script type="text/javascript" src="{T_TEMPLATE_PATH}/forum_fn.js"></script>
add after:

Code: Select all

<script src="{ROOT_PATH}script/jquery-1.4.js" type="text/javascript"></script>
<script src="{ROOT_PATH}script/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
    $("a.cross").click(function() {
        $(".global-notice").fadeOut();
        $.cookie('noticeState', 'hidden', { expires: 3, path: '/'});
    });
    var noticeState = $.cookie('noticeState');
    if(noticeState == 'hidden') {
        $(".global-notice").hide();
    };
});
// ]]>
</script>
Make sure that jquery isnt allready included.

Next step is when the mod is installed.
Find:

Code: Select all

<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT and not S_IN_UCP -->
<div id="info"><div id="infobar">
<a href="{U_REGISTER}"><img style="width: 50px; height: 50px; padding-right: 100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/reg.png" />{L_PMG_WELCOME} {SITENAME}. {L_PMG_REGISTER}<img style="width: 50px; height: 50px; padding-left:100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/reg.png" /></a>
</div></div>
<!-- ENDIF -->

<!-- IF not S_IS_BOT and S_USER_LOGGED_IN and S_USER_PM_POPUP and S_DISPLAY_PM and (S_USER_NEW_PRIVMSG or S_USER_UNREAD_PRIVMSG) -->
<div id="info"><div id="infobar">
<a href="{U_PRIVATEMSGS}"><img style="width:50px; height: 50px; padding-right: 100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/mail.png" />{L_PMG_HELLO} {S_USERNAME} {L_PMG_YOUHAVE} {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD --> {L_PMG_AND} {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --><img style="width: 50px; height: 50px; padding-left:100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/mail.png" /></a>
</div></div>
<!-- ENDIF -->
Replace with:

Code: Select all

<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT and not S_IN_UCP -->
<div id="info" class="global-notice"><div id="infobar">
<a href="{U_REGISTER}"><img style="width: 50px; height: 50px; padding-right: 100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/reg.png" />{L_PMG_WELCOME} {SITENAME}. {L_PMG_REGISTER}<img style="width: 50px; height: 50px; padding-left:100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/reg.png" /></a>
</div><a class="cross" href="#">Close</a></div>
<!-- ENDIF -->

<!-- IF not S_IS_BOT and S_USER_LOGGED_IN and S_USER_PM_POPUP and S_DISPLAY_PM and (S_USER_NEW_PRIVMSG or S_USER_UNREAD_PRIVMSG) -->
<div id="info" class="global-notice"><div id="infobar">
<a href="{U_PRIVATEMSGS}"><img style="width:50px; height: 50px; padding-right: 100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/mail.png" />{L_PMG_HELLO} {S_USERNAME} {L_PMG_YOUHAVE} {PRIVATE_MESSAGE_INFO}<!-- IF PRIVATE_MESSAGE_INFO_UNREAD --> {L_PMG_AND} {PRIVATE_MESSAGE_INFO_UNREAD}<!-- ENDIF --><img style="width: 50px; height: 50px; padding-left:100px; vertical-align:middle;" alt="" src="{T_THEME_PATH}/images/mail.png" /></a>
</div><a class="cross" href="#">Close</a></div>
<!-- ENDIF -->
Save, upload and refresh template.

Now you have a Close link on both register and notify bar.
The cookie is set to last 3 days.

Thank to Christian for the guide on his site.

Re: Close the PM Notify bar

Posted: 26 May 2011, 12:42
by Fire-Fox
Nice one!

nice to have you back again Stoker :)

Re: Close the PM Notify bar

Posted: 26 May 2011, 18:01
by Makis
So I have no words to say more than 'thank you' for one nore time :hi:

Re: Close the PM Notify bar

Posted: 26 May 2011, 19:24
by Makis
I’m back… :twisted:
“Close” doesn’t close the bar, on click just jumps to the top of the page.

Double checked everything :?

Re: Close the PM Notify bar

Posted: 26 May 2011, 19:33
by Stoker
It works here, but it can conflict with other jquery scripts.
Post a link to your board and I will have a look.