Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version - Private Message Pop Up Notification 2.2
Version 2.2 fixes an issue with the popup script not displaying on some servers.

Description - This pops up a little window when there are new Private Messages Waiting. The window tells how many messages, and gives a link to check them. The window will refresh periodically and update the total number of messages, and close when there are no more new messages to read. There is also an option to have an audio alert (with or without the popup window) when you have new private messages. Users can specify which option, or none or both in their profiles.

Pre-requisites - none

Author - JoshPet

Credits - Definately couldn't have done this without help from JustDave and Gardener - Thanks Guys! Thanks to Chaos for helping to track down bugs and errors in my instructions for 6.2. <img src="/threads/php/images/graemlins/smile.gif" alt="" />

Files Altered - ubbt.inc.php, editbasic.php, changebasic.php,
/templates/default/editbasic.tmpl, /templates/default/ubbt_registerednav.tmpl,
/languages/english/online.php, /languages/english/generic.php,
/languages/english/editbasic.php

Database Altered - Yes - 2 fields (U_PrivatePopup & U_PrivateAlert) are added to allow users the option to choose or disable either option

New Files - messagepopup.php

Any other info - I was pretty proud of myself for pulling this one off. <img src="/threads/php/images/graemlins/wink.gif" alt="" /> LOL

Screenshot - Here is what the popup window looks like. I made it bright yellow, with red text (not stylesheet dependent) so that it will stand out. It inserts the name of the site (from config file), user's name, number of messages and link back to check private messages. Clicking the link or the flashing envelope icon will open the list of received messages back in the original threads window. 
[]https://www.ubbdev.com/threads/php/uploads/59752-popupwindow.gif[/]

I also have included this sound file in the zip, but you can substitute any .wav file. I found a great source for "you have mail" type sound files at http://newmail.monsterserve.com

NOTE: Audio alert may not work in all browsers. <img src="/threads/php/images/graemlins/wink.gif" alt="" />
Attachments
67205-PrivateMessagePopUp2.2.zip (0 Bytes, 315 downloads)

Last edited by JoshPet; 08/14/2003 12:51 AM.
Sponsored Links
Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Josh after installing this (I checked it twice so I think I have done it correctly) I get this

Parse error: parse error, unexpected T_ELSE in c:\wwwroot\ubbthreads\ubbt.inc.php on line 1759

Fatal error: Call to undefined function: getmicrotime() in C:\wwwroot\ubbthreads\main.inc.php on line 16

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK - think I got a little happy with Cut and Paste.

Look for the line in ubbt.inc.php that starts like this:

    if ($Query) { $Query .=","; }
    $Query .= "U_Username,U_Password,U_SessionId, .....


Below it, add:

    }

That should fix it.

I'll update my instructions and zip. Thanks.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
nope still getting the same error

per your suggestion
// -----------------------------------------------------------------
// We are automatically adding StyleSheet, Status, Privates and
// FrontPage and Number to each SQL call because this information is needed by
// every script that makes a call to authenticate
else {
if ($Query) { $Query .=","; }
$Query .= "U_Username,U_Password,U_SessionId, U_StyleSheet, U_Status, U_Privates, U_FrontPage, U_Number, U_PrivatePopup, U_PrivateAlert";
}

Last edited by JoshPet; 02/02/2003 2:44 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
What's around your line 1759 where it seems to be having trouble?

Sponsored Links
Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
lines 1755-1790
// -----------------------------------------------------------------
// We are automatically adding StyleSheet, Status, Privates and
// FrontPage and Number to each SQL call because this information is needed by
// every script that makes a call to authenticate
else {
if ($Query) { $Query .=","; }
$Query .= "U_Username,U_Password,U_SessionId, U_StyleSheet, U_Status, U_Privates, U_FrontPage, U_Number, U_PrivatePopup, U_PrivateAlert";
}

$Uid = addslashes(${$config['cookieprefix']."w3t_myid"});

$query = "SELECT $Query FROM {$config['tbprefix']}Users WHERE U_Number = '$Uid'";
$sth = $dbh -> do_query($query);
$thisuser = $dbh -> fetch_array($sth);
$dbh -> finish_sth($query);
if ( ($thisuser['U_SessionId']) && ($thisuser['U_SessionId'] == ${$config['cookieprefix']."w3t_mysess"}) ) {
return $thisuser;
} elseif (${$config['cookieprefix']."w3t_key"} == md5("{$thisuser['U_Number']}{$thisuser['U_Password']}")) {
srand((double)microtime()*1000000);
$newsessionid = md5(rand(0,32767));
$newsessionid_q = addslashes($newsessionid);
$query = "
UPDATE {$config['tbprefix']}Users
SET U_SessionId = '$newsessionid_q'
WHERE U_Number = $Uid
";
$dbh -> do_query($query);
if ($config['tracking'] == "sessions") {
session_register("{$config['cookieprefix']}w3t_mysess");
${$config['cookieprefix']."w3t_mysess"} = $newsessionid;
}
else {
setcookie("{$config['cookieprefix']}w3t_mysess","$newsessionid","0","{$config['cookiepath']}");
}
return $thisuser;
}

Thanks Josh-

Last edited by JoshPet; 02/02/2003 2:44 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Doah... I don't know what happened to my copy paste at that part of the instructions.... must have hit or pasted the wrong thing.

At the very top....

where it says "else {"
That line should be unchanged from the original... we are only changing the query line.

So change the else { line to this:

if ($Query != "*") {


Sorry for the trouble. I am fixing my zip.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
That solve the first problem now I am getting this


Parse error: parse error, unexpected T_STRING, expecting ',' or ')' in c:\wwwroot\ubbthreads\editbasic.php on line 74

Lines 61-80
// ----------------------------------------
// Get the current profile for this username
$Username_q = addslashes($Username);
$query = "
SELECT U_LoginName,U_Password,U_Email,U_Fakeemail,U_Name,U_Signature,
U_Homepage,U_Occupation,U_Hobbies,U_Location,U_Bio,U_TextCols,
U_TextRows,U_Extra1,U_Extra2,U_Extra3,U_Extra4,U_Extra5,U_Picture,
U_Visible,U_AcceptPriv,U_OnlineFormat,U_PrivatePopup,U_PrivateAlert
FROM {$config['tbprefix']}Users
WHERE U_Username = '$Username_q'
";
$sth = $dbh -> do_query($query);


// --------------------------------
// Make sure we found this Username
list($LoginName,$ChosenPassword,$Email,$Fakeemail,$Name,$Signature,
$Homepage,$Occupation,$Hobbies,$Location,$Bio,$TextCols,
$TextRows,$ICQ,$Extra2,$Extra3,$Extra4,$Extra5,$Picture,
$Visible,$AcceptPriv, $OnlineFormat,t,$PrivatePopup, $PrivateAlert) =
$dbh -> fetch_array($sth);
$dbh -> finish_sth($sth);


if (!$ChosenPassword){
$html -> not_right("{$ubbt_lang['NO_PROF']} '$Username'",$Cat);
}

Last edited by JoshPet; 02/02/2003 2:47 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK I see the problem

Find this:

$OnlineFormat,t,$PrivatePopup,$PrivateAlert)

Remove that stray "t" like this:

$OnlineFormat,$PrivatePopup,$PrivateAlert)

Sorry you've had so much trouble. Guess it was too late when I pulled together my instructions. Or they were messed up from before. I had posted this under 6.1 but just got around to updating it (at my user's request) last night.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
This might be a good basis to use as a start onto an instant message hack where this window would pop up with the message you send them from a list of choosable users online at that moment.

Sponsored Links
Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554

Ok we are one step closer to the promised land.
The pop up window now comes up but I am getting a server 500 error within it
And I was up pretty late too as you can see by my 4:50 am post and my uhh..other posts on the forum

*edit-my badd...the privatemessage.php and the sound file got extracted with its dir folder instead of directly to my UBBThreads directory.-told ya I was up late *

Thanks Josh

Last edited by ChAoS; 02/02/2003 3:06 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I'm not sure about a server 500 error.
Anyone know what kind of error that is?

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
^see above edit^

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Cool!

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Josh does this function check for Private Message automatically or does it rely on me refreshing the page I am viewing? I dont seem to be getting notification until I refresh and it sees the flashing envelope icon

Also when hovering above the flashing envelope in the pop up box the numerical value is missing for amount of posts
"You have _ new message(s)

Last edited by ChAoS; 02/02/2003 3:31 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, it works the same as the flashing envelope icon... threads doesn't check for new PMs until you refresh the page.

The popup will keep refreshing and close itself when there are no PMs left.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Doah... this one was just all dusty.

In the messagepopup.php file.....

Look for this:

alt="{$ubbt_lang['WEL_PRIV2']} $Privates {$ubbt_lang['WEL_PRIV3']}"


Change $Privates to $Messages



I'll update the zip.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Updated the zip with what *should* be the last of the tweaks and fixes.

Added Chaos to the Credits list for tracking down all the bugs and errors in the directions. Hadn't fooled with this mod since 6.1 so I guess it was dusty.

Thanks Chaos.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
LOL great work..I hope ya dont mind me keeping ya jumping this afternoon
and believe me if there is a bug I am usually apt to find it lol

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
No better to track it down early.... blaze the trail. Now everyone else can try, now that you've found all the bugs.

It's safe now. LOL

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
Works like a charm now. and congrats on your 2500th post Josh

What kind of load does it put on the server if I use a different .wav file? Any suggestions on the length?

Last edited by ChAoS; 02/02/2003 4:24 PM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Each time it plays... it's basically bandwidth used. So smaller is better if bandwidth is a concern for you... or if you have lots of members on dialup.

Joined: Aug 2002
Posts: 45
User
User
Offline
Joined: Aug 2002
Posts: 45
Josh I get a blank popup box and no sound hearing

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Hmmmm... does it work if you open the popup in the broser directly?

Joined: Aug 2002
Posts: 45
User
User
Offline
Joined: Aug 2002
Posts: 45
Also a blank page

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Do you have a URL so I can look?

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
must have been fixed

Joined: Feb 2002
Posts: 67
Power User
Power User
Offline
Joined: Feb 2002
Posts: 67
[]Hmmmm... does it work if you open the popup in the broser directly? [/]

Hi Josh,

same problem here (Link removed - was for testing purposes only).

Installation was done exactly how you described it

Last edited by Stefan; 02/17/2003 5:18 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Hmmm...

I'm not 100% sure why it doesn't work for you. I see it's working, but he popup won't generate.

Might be HTML fussiness.

I've learned a bit more since I originally wrote that.

Try this.... download the messagepopup.txt file that I attached to THIS post. Rename it to .php. See if that one works for you.

If anybody else want to glance at it (attached to this post) and see if they see any issues with how I've done this, please do.

If this one works for you, please let me know, and I'll put this version into the distribution.

<fingers crossed>
Attachments
68950-messagepopup.txt (0 Bytes, 231 downloads)

Last edited by JoshPet; 02/14/2003 11:44 PM.
Joined: Feb 2002
Posts: 67
Power User
Power User
Offline
Joined: Feb 2002
Posts: 67
Hi Josh,

this one works - thanks

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I've updated the main post in this thread to version 2.2.

This fixes an issue with the popup not appearing on some servers. Thanks Stefan for your help in testing this.

Kudos goes to JustDave (although he doesn't know it) because looking at his popup graemlin panel gave me clues as to how to fix this.

Plagiarism is the biggest form of flattery.

Joined: Mar 2000
Posts: 180
Member
Member
Offline
Joined: Mar 2000
Posts: 180
This is one of my FAVORITES!

Thanks for the help, Josh!

Joined: Oct 2002
Posts: 26
User
User
Offline
Joined: Oct 2002
Posts: 26
##########################################
# Find this:
#

// -----------------------------------------------------------------
// We are automatically adding StyleSheet, Status, Privates and
// FrontPage and Number to each SQL call because this information is needed by
// every script that makes a call to authenticate
if ($Query != "*") {
if ($Query) { $Query .=","; }
$Query .= "U_Username,U_Password,U_SessionId, U_StyleSheet, U_Status, U_Privates, U_FrontPage, U_Number, U_PrivatePopup, U_PrivateAlert";
}

#
# Change to this:
#

// -----------------------------------------------------------------
// We are automatically adding StyleSheet, Status, Privates and
// FrontPage and Number to each SQL call because this information is needed by
// every script that makes a call to authenticate
if ($Query != "*") {
if ($Query) { $Query .=","; }
$Query .= "U_Username,U_Password,U_SessionId, U_StyleSheet, U_Status, U_Privates, U_FrontPage, U_Number, U_PrivatePopup, U_PrivateAlert";
}


###################################################

is exactly the same *gg a bug?

greetings from oversea

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Ah probably an error in my instructions.

The part you are finding wouldn't have the U_PrivatePopup, U_PrivateAlert being queried. It would end with U_Number.


Joined: Oct 2002
Posts: 26
User
User
Offline
Joined: Oct 2002
Posts: 26
hier is the right one:
##########################################
# Find this:
#

// -----------------------------------------------------------------
// We are automatically adding StyleSheet, Status, Privates and
// FrontPage and Number to each SQL call because this information is needed by
// every script that makes a call to authenticate
if ($Query != "*") {
if ($Query) { $Query .=","; }
$Query .= "U_Username,U_Password,U_SessionId, U_StyleSheet, U_Status, U_Privates, U_FrontPage, U_Number";
}

#
# Change to this:
#

// -----------------------------------------------------------------
// We are automatically adding StyleSheet, Status, Privates and
// FrontPage and Number to each SQL call because this information is needed by
// every script that makes a call to authenticate
if ($Query != "*") {
if ($Query) { $Query .=","; }
$Query .= "U_Username,U_Password,U_SessionId, U_StyleSheet, U_Status, U_Privates, U_FrontPage, U_Number, U_PrivatePopup, U_PrivateAlert";
}


###################################################

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thanks.

Daine #234927 03/23/2003 1:40 PM
Joined: Oct 2002
Posts: 26
User
User
Offline
Joined: Oct 2002
Posts: 26
bugs?
1. Set the default for Private Message Popup & Private Message Alert Sound

they are allways on NO
if i change them to YES it's ok
if i open the "Personal information" again they go automatic on NO

2. Set the Private Message Alert Sound

if the Private Message Popup is on YES allways the sound,
YES/NO in the Private Message Alert Sound without function

3. below the footer its showing a Query:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Query: UPDATE w3t_Users SET U_Rating = '40' , U_Rates = '8' , U_RealRating = '5' WHERE U_Number = '2'
Query took a total of 0.001 seconds.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
a bug? ore possible don't show that?

Ohton #234928 03/23/2003 4:06 PM
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I don't understand what you are asking.

That query has to do with user ratings.

Daine #234929 03/23/2003 6:11 PM
Joined: Oct 2002
Posts: 26
User
User
Offline
Joined: Oct 2002
Posts: 26
ok...one's more

1. when i open "Main Configuration" >> "Personal information, email, password, etc." >> "Do you want a Notification box for Private Messages?"
the default setting is on "NO"
if i open "Main Configuration" >> "Personal information, email, password, etc." >> "Do you want an Audio Alert for Private Messages?"
the default setting is on "NO"
if i change both with a click on "YES" the popub works.

when i go again into the "Main Configuration" >> "Personal information, email, password, etc."
both settings show me again "NO"
why they changed automatic?

2. if "Do you want a Notification box for Private Messages?" is on "YES" i always hear a sound, the
"Do you want an Audio Alert for Private Messages?" didn't work....YES ore NO....always the sound!

3.after a new config from "Personal information, email, password, etc." it shows me a Query
Attachments
74047-query.jpg (0 Bytes, 324 downloads)

Ohton #234930 03/23/2003 6:34 PM
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
It sounds like you've got a problem in editbasic.php or changebasic.php Double check those intructions. Make sure you've modified the query to grab the current settings of on or off. My guess is that the fields or variables haven't been added, and without a value, its going back to the default.

Then the sound always playing and the query on the bottom of the page, I'm not sure. That query has nothing to do with this.... that's a query to update someone's user Rating. So that makes me think you are missing a } somewhere in ubbt.inc.php. Double check those files as well.

Page 1 of 2 1 2

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)