News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Audible PM v1.0

Started by Bigguy, September 07, 2006, 07:45:15 PM

Previous topic - Next topic

Bigguy

Link to Mod

This is a small mod that gives an Audible alert when you receive a PM ("You've Got Mail") Every time you refresh the page it gives the warning until you read your PM.

*Audible Pm 1.5 and 2.0* uses sessions so that the "gotmail" sound is not going off every time you change to a new page. (Tiny Portal version also available)

*Audible PM 2.1* uses sessions so that the "gotmail" sound is not going off every time you change to a new page.

Versions:
                 -AudiblePm15 supports the 1.1.x line of SMF
                 -AudiblePmTp_15 installs with Tiny Portal
                 -apm20/21 both install with 2.0.15
                 -apm21 supports 2.1 beta 3/4

Thanks to:

"Psyclones" for the code, and to everyone else that tested and helped me package it, you know who you are, and your mentioned in the readme.txt

Changes

-Updated to work with 2.1 beta 3/4
-There was a small problem with users being called guests after they logged in, this is taken care of now.
-There was also a problem with a space in the header when the sound would play, this is also taken care of.

URPG

Does this install for all themes or do i have to add it to all themes that are not the default one myself?

Bigguy

You will have to add it, but it's a small edit it should not be any problems

Bigguy

I'm working on a version for TP 0.9.5 The original package doesn't or might not work when you have the "Show userinfo/news at the top" turned off in TP settings. It is done now I do believe but has not been tested yet. Just thought I would let everyone know.

Bigguy

#4
Would anyone like to help test this. I already have the code on my site so I can't really and I don't have a test site with TP installed.

EDIT: I have tested it now and it does work with SMF 1.1RC3 and TP 0.9.5

URPG

I am upgrading to RC3 and TP.95 some time later today... I can send you the results...

Could you post the code to be added to other themes, please?

Bigguy

#6
I have packaged up a mod for TP and all the code is in the modification.xml file.

For Tiny Portal In the Index.template.php file find:

      if($context['TPortal']['showtop']==1)

And before that add:

//Sound Notify On Messages
   if (($context['user']['unread_messages']) >= 1){
echo '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="     http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="0" height="0" id="gotmail" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="gotmail.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="gotmail.swf" quality="high" bgcolor="#ffffff" width="1" height="1" name="gotmail" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>';

}


And it should work for you. Remember to put the "gotmail.swf" file in the root of your SMF.
 

steve in houston

how hard would it be to make an option on the profiles so
members have to click it to be able to use it.  my forum
is mostly used by office people from work and i would hate
to alarm them with that sound and get in trouble with their
bosses.

thanks

Bigguy

Well I can certainly look into that for the next version. It would be a nice feature. I'm not sure how long it would take me to do as this is my first mod. I will see what I can do.

steve in houston

i was just looking for the script for the
"Show a popup when you receive new messages?"
option on Profile.  i would like to replace the
javascript alert function with your code.
think it will work?

if so, wanna help me find the snippet?

Bigguy

It might work but I have no idea were that code is. You have me interested so I am on the hunt now, lol. ;)

Bigguy

I think it's in the PersonalMessage.template.php

steve in houston

Quote from: Bigguy on September 13, 2006, 12:38:33 AM
It might work but I have no idea were that code is. You have me interested so I am on the hunt now, lol. ;)

cool.  i figured the alert would be useless with the audible mod.
im going to search too.  jay, where is it??

Bigguy

Well, I'm still looking. I haven't found it yet but I have found alot on Pm's and stuff.

Bigguy

In "Profile.template.php I found this. Would this be it:

// Extra options available to the user for personal messages.
echo '
<tr>
<td colspan="2">
<input type="hidden" name="default_options[copy_to_outbox]" value="0" />
<label for="copy_to_outbox"><input type="checkbox" name="default_options[copy_to_outbox]" id="copy_to_outbox" value="1"', !empty($context['member']['options']['copy_to_outbox']) ? ' checked="checked"' : '', ' class="check" /> ', $txt['copy_to_outbox'], '</label><br />
<input type="hidden" name="default_options[popup_messages]" value="0" />
<label for="popup_messages"><input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked="checked"' : '', ' class="check" /> ', $txt['popup_messages'], '</label><br />
<label for="pm_email_notify">', $txt[327], '</label>
<select name="pm_email_notify" id="pm_email_notify">
<option value="0"', empty($context['send_email']) ? ' selected="selected"' : '', '>', $txt['email_notify_never'], '</option>
<option value="1"', !empty($context['send_email']) && ($context['send_email'] == 1 || (empty($modSettings['enable_buddylist']) && $context['send_email'] > 1)) ? ' selected="selected"

steve in houston

#15
i dont think so.
that looks like the markup to show the options on the Profile page.



this shows up when you view source the webpage.  its in the head section:

<script language="JavaScript" type="text/javascript"><!--
if (confirm("You have received one or more new personal messages.\nView them now (in a new window)?"))
window.open("http://www.xxx.com/xxx/index.php?action=pm");
// --></script>



This is found in index.english.php:

$txt['show_personal_messages'] = 'You have received one or more new personal messages.\\nView them now (in a new window)?';



so we need to search for $txt['show_personal_messages']




FOUND IT!!!!!!
sub.php
the javascript function is in there.
im going to comment it out and put your embedded flash in to see if it works.

steve in houston

OK, I got it working now.
Only need to alter 2 files.




FILE sub.php
Search for

// This is done to make it easier to add to all themes...
if ($context['user']['popup_messages'] && !empty($options['popup_messages']))
{
$context['html_headers'] .= '
<script language="JavaScript" type="text/javascript"><!--
if (confirm("' . $txt['show_personal_messages'] . '"))
window.open("' . $scripturl . '?action=pm");
// --></script>';
}


Replace with

// This is done to make it easier to add to all themes...
if ($context['user']['popup_messages'] && !empty($options['popup_messages']))
{
$context['html_headers'] .= '
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="0" height="0" id="gotmail" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="gotmail.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="gotmail.swf" quality="high" bgcolor="#ffffff" width="1" height="1" name="gotmail" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>';
}





FILE Profile.english.php

Search for

$txt['popup_messages'] = 'Show a popup when you receive new messages?';


Replace with

$txt['popup_messages'] = 'Allow an audible alert when you receive new messages?';

Bigguy

So this shows the popup window for a new PM and an audible alert so if you turn off the popup window the audible alert turns off. ???

steve in houston

Quote from: Bigguy on September 13, 2006, 02:47:07 AM
So this shows the popup window for a new PM and an audible alert so if you turn off the popup window the audible alert turns off. ???

no, i removed the popup window entirely cause its no use if there is an audio alert.
ive never really liked the javascript popup.
if you want both, leave the javascript and add the flash embed code just below it.

Bigguy

#19
Ah, so basically it now has the on/off button you wanted. Maybe I will throw this into a package to, with credit to you of course for your hard work and testing. :)

EDIT: Unless you have any objections. ???

Advertisement: