News:

Wondering if this will always be free?  See why free is better.

Main Menu

Hack: new message flashing icon

Started by marten, January 12, 2006, 08:40:11 PM

Previous topic - Next topic

marten

A little useful hack for the new Core Theme (NDT).

When you get a message you'll se a fashing icon next to the message button in the top menu.
Without this flashing icon it is hard to notice when u get a message, at least for me  ;)


Find index.template.php in Themes/default
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>

Replace with:
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/newpm.gif" border="0" />' : '' , '</a>


You also need the flashing image newpm.gif and upload that to Themes/default/images.

I put the one I use here, so just right click on it and save it to your computer.

  

http://www.hellasob.com/w3timages/newpm.gif [nofollow]
\_Marten

Simplemachines Cowboy

Absolutely way cool.

Thanks for doing this!
My SMF forum: The Open Range

1MileCrash

who made that icon? it looks very familiar...
The only thing php can't do is tell you how much milk is left in the fridge.



Bigguy

we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.

snork13

Quote from: Bigguy on January 12, 2006, 09:40:57 PM
we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.

yes, and it's already in tip and tricks...which is why it looks familiar..i use this one -->
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

marten

Quote from: Bigguy on January 12, 2006, 09:40:57 PM
we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.
Yes you can use any icon you want, just remember to name it right  or rename the image in the code.

Well I have seen that icon in many places too, I just used Google and found some and did choose this one  :D
\_Marten

marten

Quote from: snork13 on January 12, 2006, 09:45:11 PM
Quote from: Bigguy on January 12, 2006, 09:40:57 PM
we could use any flashing icon though right ? and yep it does look familiar, just dont know from where.

yes, and it's already in tip and tricks...which is why it looks familiar..i use this one -->
It is in tip and trick?? You mean a hack for RC2 NDT ..?  Anyway  your icon looks so much nicer so I think I will use that one instead :)
\_Marten

Bigguy

I just put it on my board and it works like a charm. Thanks for this. :)

Dexy

#8
I cant find
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>

in index.template.php

p.s. i am using macvision theme, is that problem?

psychophat

Can this be used also in the default SMF theme?
I adore this forum, from zero PHP knowledge to +.1% per post
I'm going to get the charter member thinggy when I get to save some cash
SMF v.1.1RC2
PHP v.4.3.11

Bigguy

I used this on the default smf 1.1 RC2 theme and it works fine.

psychophat

Way cool I'm going to put it right away.
I adore this forum, from zero PHP knowledge to +.1% per post
I'm going to get the charter member thinggy when I get to save some cash
SMF v.1.1RC2
PHP v.4.3.11

Bigguy

Theres also one around that plays a sound file "You`ve got mail" when you recieve a PM.

marten

#13
Hello again.

It is rather simple if you also want the sound "You`ve got mail" also.
In the code here i have used the IE tag "bgsound", but bgsound is a proprietary IE tag it isn't W3C standard so it won't work in Firefox, it should work in Opera though.

To allow playback of bgsound or embedded tags in Firefox you need an extension/plugin.

look for the same code as above. ( Still this is only for the New Default Theme for 1.1 RC2 )

Find index.template.php in Themes/default
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>


Replace with:
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/newpm.gif" border="0"><bgsound src="' . $settings['images_url'] . '/mail.wav" border="0">' : '' , '</a>


I have used a WAV file in this example called  "mail.wav"  so don't forget to change the name to what u want.

Upload the mail.wav file to Themes/default/images

You can find "You`ve got mail" wav files at this site (  I use - Mail03.wav Typical, "You've got mail". )

http://www.ilovewavs.com/Events/GotMail/GotMail.htm [nofollow]



\_Marten

Bigguy

Psyclones has made a hack to almost the same as this, he also has one I do believe for playing swf instead of wav. Which means of course no plugin is necessary, thats always nice.

Dexy

I have SMF 1.0.5. is there any hack for this version?
tnx

marten

Quote from: Dexy on January 15, 2006, 05:26:37 AM
I have SMF 1.0.5. is there any hack for this version?
tnx

Yes it is Tips and Tricks, at least I think it is for 1.05 , as someone pointed out here above ( I have never used that version myself ).
http://www.simplemachines.org/community/index.php?topic=9017.0
\_Marten

marten

Quote from: Bigguy on January 14, 2006, 09:20:00 PM
Psyclones has made a hack to almost the same as this, he also has one I do believe for playing swf instead of wav. Which means of course no plugin is necessary, thats always nice.

If so and it works with swf it will be a better choice ( havn't checked the hack ) , I don't use sound on my own board, only the animated icon, and u are right IF users have SWF turned on. Many users have that function turned OFF in their browers, because so many don't like SWF.. so my little hack work with most browsers except for Firefox witout a downloadable addon/extension to support BGSOUND. I dont't like sites either threre u visit websites with background musik, often MIDI files, and u can't turn it off BUT there are so many sites out there that uses bgsound and u can't hear the music then.

https://addons.mozilla.org/extensions/moreinfo.php?id=146 [nofollow]
\_Marten

FBI

I have bad idea. For guest visitor, playing the applause.wav.
Visitor who didnt register/login into forum, they will heard applaus sound :)
Its weird and feel bad (I think). But useful, you can push visitor to register into your forum.

Here the code

Go find the code inside /Themes/index.template.php
// Otherwise they're a guest - so politely ask them to register or login.
else
{
echo '
', $txt['welcome_guest'], '<br />
', $context['current_time'], '<br />';
        }


And add this code
Quoteecho '<bgsound src="http://www.yoursite.com/Applause.wav" border="0">';

And the full code are:
// Otherwise they're a guest - so politely ask them to register or login.
else
{
echo '
', $txt['welcome_guest'], '<br />
', $context['current_time'], '<br />';
              echo '<bgsound src="http://www.yoursite.com/Applause.wav" border="0">';
}


Get the wav here
Get the sample result at my forum here

Tested on IE and Opera

Its Bad Idea or Good idea? ;D

PS: You can record your own voice that speak "Welcome to my forum, please login.. bla.. bla.. bla"

Xerxes

#19
I just added this to 1.1 RC2 and it works great. It's the simple things that make communication more effective. Thanks.

copfirearms

Quote from: marten on January 12, 2006, 08:40:11 PM
A little useful hack for the new Core Theme (NDT).

When you get a message you'll se a fashing icon next to the message button in the top menu.
Without this flashing icon it is hard to notice when u get a message, at least for me  ;)


Find index.template.php in Themes/default
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>

Replace with:
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/newpm.gif" border="0" />' : '' , '</a>


You also need the flashing image newpm.gif and upload that to Themes/default/images.

I put the one I use here, so just right click on it and save it to your computer.

  

http://www.hellasob.com/w3timages/newpm.gif


Ok, I inserted  your code, heres what it looks like...



Any way to move the flashing icon to the center??
Or move it from where it's at?

If I could make it look like this, it woulld be great...
Thanks

It's God's Job To Forgive Bin Laden
It's Our Job To Set up The Meeting
-US Marines-

snork13

i pacakged this up for 1.1rc2, check it out here

Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

copfirearms

Quote from: snork13 on February 24, 2006, 06:02:31 PM
i pacakged this up for 1.1rc2, check it out here



I feel stupid for not seeing that !!!
Installed perfectly..
Thank You
It's God's Job To Forgive Bin Laden
It's Our Job To Set up The Meeting
-US Marines-

h4ni

How i can apply this tips in my the musiconia

code:
Quote
   // Go to PM center... [pm]
   if ($context['user']['is_logged'] && $context['allow_pm'])
   {
      echo ((isset($current_action) && $curent_action == 'pm') || $context['browser']['is_ie4']) ? '' : '' , '
               <a href="', $scripturl, '?action=pm">Messages Privés</a>: ', $context['user']['unread_messages'], ' Non Lus, ', $context['user']['messages'], ' Total.<br />';
   }

thank you

AtelierGal

I'm using 1.1.1 and it's not possible to install

I got this:
QuoteThe package you are trying to download or install is either corrupt or not compatible with this version of SMF.

vbgamer45

Contact Snork to update the mod or

Should work fine on 1.1.1 if you trick the package manager url.

Go to the package manager in your forum
In the address bar add
;version_emulate=1.1

To the url and hit enter to load the page or press go and you should be able to install the mod.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

FBI

I didn use Mod Package Manager. Just using this code, work perfectly on any SMF version and themes (currently Simplicity). Just put it on index.template.php in any side (need html knowledge). Show Welcome screen and Flashing PM (if any).. :)

Windows Pop Up will show, if you have message. And at IE, directly opening New Windows.

// Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
echo '
<a href="' . $scripturl . '?action=pm"><img src="http://forumbebas.net/Themes/newpm.gif" border="0" /> klik here disini..</a> ' . $context['menu_separator'] . '';


}
else
echo $txt['welcome_guest'];

h4ni

i musiconia theme you put this code

Quote// Go to PM center... [pm]
   if ($context['user']['is_logged'] && $context['allow_pm'])
   {
      echo ((isset($current_action) && $curent_action == 'pm') || $context['browser']['is_ie4']) ? '' : '' , '
         |&nbsp;<span class="smalltext"><a href="', $scripturl, '?action=pm">Messages Privés</a>: '. $context['user']['unread_messages'] . '', $context['user']['unread_messages'] > 0 ? '<img src="' . $settings['images_url'] . '/icons/pmnotify.gif" width="12" height="12" align="absmiddle" />' : '' , '&nbsp;Non Lus, ', $context['user']['messages'], ' Total.</span><br />';
   }

work fine

qubbah

how about custom theme...

like

// Go to PM center... [pm]
   if ($context['user']['is_logged'] && $context['allow_pm'])      
   echo'
            <td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
               <a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>   


ManilaGurL

Will this work with the latest version?

TrueSatan


saosangmo

I wonder if I can do the same thing with http://www.openhosting.co.uk/articles/webdev/6004/
Meaning when my user is inactive and someone send him a message, a warning will display to tell him.

kpel

Thanks Marten!

This is the ONLY mod I've been able to get to work so far and I love it. (thanks for a moment of accomplishment!)

Fallen Angel

In Dilber MC

Find index.template.php in Themes/dilbermc


// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo'
<td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>


Change with;


// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo'
<td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]&nbsp;<img src="' . $settings['images_url'] . '/msg.gif" border="0">' : '' , '</a>


Works for me!  ;D

spaarks

Marten an excellent mod. I'm very much a newcomer to php so excuse me for asking a simple question. Do I have to replace the whole code section or can I just change the last bit to      . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/newpm.gif" border="0" />' : '' , '</a>

thanks

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro


De4thPr00f

@copfirearms:
to place the icon at the center you need to insert it in a div. i havn't look at the code, but you should have a part that gets the image. The changes you would do are:
<div id="msgicon" align="center" border=0> //before the icon thing
</div> //after the icon thing.

spaarks

How can I put the flashing mail icon in other themes such as "Cool Mint and Blue"

kizer

I love this mod. I often hit the front page and click the box saying cancel on the PM and now I simply can not forget that I did that with that annoying flashing images.

Thanks. ;)
Own a Jeep? Links4Jeeps.com

Jed C

i installed this mod a while ago and had no probs until now  ::)
i had my flashy icon flashing in the message tab (cannot remember how i did that)
but i have just centred my tabs and it is now flashing to the left again
i read reply to copfirearms but my code is not the same
any ideas  ???

Quoteglobal $context, $settings, $options, $scripturl, $txt;  // Show Flashy icon if user has new messages and it not a guest
if (!$context['user']['is_guest'] && $context['user']['unread_messages'])
                             echo '
<a href="' . $scripturl . '?action=im"><img src="' . $settings['images_url'] . '/newpm.gif" border="0" />(' . $context['user']['unread_messages'] . ')</a> ' . $context['menu_separator'] . '';

TomW

Yes, I know that this is an OLD topic, but I would like to use this method for my 2.0 RC2 upgrade.  What changes are required ?

TomW

Quote from: TomW on January 24, 2010, 08:06:48 PM
Yes, I know that this is an OLD topic, but I would like to use this method for my 2.0 RC2 upgrade.  What changes are required ?

Bueller ?

waruna

Guys, what code for SMF2.0 RC2? Thanks in advance :D
Trust of Lust

balti27

#45
OK i made something and it worked for me.

As follows:

Copy the msg.gif file in the Main directory of your webspace.

Open Forum/Sources/Subs.php

Search for:
$context['menu_buttons'][$current_action]['active_button'] = true;

if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['menu_buttons']['pm']))
{
$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';
$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}
}


And Change it to:
$context['menu_buttons'][$current_action]['active_button'] = true;

if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['menu_buttons']['pm']))
{
$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';
$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]&nbsp;&nbsp;<img src="' . $settings['images_url'] . '/msg.gif" border="0" />';
}
}

balti27

I hope thise mod is going to be updatet for smf rc3  ;D

Advertisement: