Support ⇒ Troubleshootings :: Archives ⇒ [Fix - code change] User Info block not updating for new PMs :: Archived ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexTroubleshootings

Archived ⇒ [Fix - code change] User Info block not updating for new PMs


When my users receive a PM, the User Info block doesn't update. Also, the line at the top of the forums that would normaly tell you you have a new message, stays at "You have no new messages."

The User Info block will update if I open up the inbox and not read the messages and return to the homepage.

While the User Info block still shows 0 new messages, looking at the database, I see mysql> select user_new_privmsg from cms_users where username="UberDuper"; +------------------+ | user_new_privmsg | +------------------+ | 1 | +------------------+ 1 row in set (0.00 sec)

So the database is correct. Just looks like the User Info block isn't doing the query.

Help, please.
UD.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD/Apache2.0.53/4.1.10a/4.3.10/9.0.5.0

Last edited by UberDuper on Wed Mar 30, 2005 4:02 pm; edited 1 time in total


Enabling the debug option, I see:blocks/block-User_Info.php * LINE 29: SELECT s.uname, s.module, s.url, u.user_allow_viewonline FROM cms_session AS s LEFT JOIN cms_users AS u ON u.username=s.uname WHERE guest=0 OR guest=2 ORDER BY s.uname * LINE 30: SELECT uname, module, url FROM cms_session WHERE guest=1 OR guest=3 * LINE 0: SELECT COUNT(*) FROM cms_users WHERE user_regdate='Mar 30, 2005' * LINE 0: SELECT COUNT(*) FROM cms_users WHERE user_regdate='Mar 29, 2005' * LINE 0: SELECT username FROM cms_users WHERE user_active = 1 AND user_level > 0 ORDER BY user_id DESC LIMIT 1 * LINE 0: SELECT COUNT(*) FROM cms_users WHERE user_id > 1 AND user_level >= 0 * LINE 125: SELECT a.uname, u.user_id FROM cms_session AS a LEFT JOIN cms_users AS u ON u.username = a.uname WHERE guest = 2 ORDER BY a.uname

So to me, this confirms that it's not even querying for it.

UD.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD/Apache2.0.53/4.1.10a/4.3.10/9.0.5.0


those queries show they worked fine. it would say there was an error if there was. One of my users just reported the same thing but when I sent him a pm to try an reproduce it, it worked fine.

Just for clarification are you using block-Userinfo or block-Userinfo_small ?

NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS


hmmm did some further looking into this and it seem to only switch to showing a new pm after going to your inbox.

EDIT: hmmm nm that only seemed to happen once. the next pm worked fine

NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS


If I log out and back in, the first time the page loads, I see the correct number of new messages. But after that, with each page reload that number wont change if I receive a new message.

UD.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD/Apache2.0.53/4.1.10a/4.3.10/9.0.5.0


time for cpgnuke.com/Projects/p=1.html

NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS


By the way.. I do get the email notifying me that I've received a new PM.

UD.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD/Apache2.0.53/4.1.10a/4.3.10/9.0.5.0


Okay. I believe the problem is that in the block-User_Info.php there's this chunk if ($pm_active) { $pm = $userinfo['user_new_privmsg']+$userinfo['user_unread_privmsg']; $content .= ' <a title="'._READSEND.'" href="'.getlink('Private_Messages').'"><img src="images/blocks/email.gif" alt="" border= $content .= '  '._NEW.": <b>$pm</b><br />\n"; }
This is defining $pm via the $userinfo array instead of doing a db query. So if on the refresh, the array isn't rebuilt, the number of new messages listed in the User Info block wont be updated.

So. Since I don't know anything about php or programming in general, could some provide the string to query the db instead of pulling from the array? My attempts have failed miserably. I'm trying to replace the line$pm = $userinfo['user_new_privmsg']+$userinfo['user_unread_privmsg']; with a $db->sql_query

Thanks for any help you all can provide.
UD.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD/Apache2.0.53/4.1.10a/4.3.10/9.0.5.0


This makes User Info block work the way I think it's SUPPOSED to.

porkchop# diff block-Test_User_Info.php block-User_Info.php 29,33d28 < $get_pm_new = $db->sql_query("SELECT user_new_privmsg FROM cms_users WHERE username='$userinfo[username]'", false, __FILE__,__LINE__); < $pm_new = $db->sql_fetchrow($get_pm_new); < $get_pm_unread = $db->sql_query("SELECT user_unread_privmsg FROM cms_users WHERE username='$userinfo[username]'", false, __FILE__,__LINE__); < $pm_unread = $db->sql_fetchrow($get_pm_unread); < $pm = $pm_new[0] + $pm_unread[0]; 75a71 > $pm = $userinfo['user_new_privmsg']+$userinfo['user_unread_privmsg'];

Thanks.
UD.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD/Apache2.0.53/4.1.10a/4.3.10/9.0.5.0


I just noticed the same problem, Unfortunately that fix doesn't really do it for me, using the global $userinfo in inappropriate places is the real problem.

Where I noticed it was in the header.php which is supposed to fire a popup box on new PM's, only it'll never work as userinfo isn't refreshed.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD 5.2.1-RELEASE, Apache 1.3.33, MySQL 4.0.16, PHP 4.3.9, DragnFly 9.0.1.1


$userinfo is Grab User Info

Firefox is my Favorite Browser

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Apache/1.3.34 (Unix)/4.0.25-standard/4.4.1/CVS


cryptic xfsunoles is Very Happy

Again using a full English sentence maybe please for those of us who strong in force are not?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
FreeBSD 5.2.1-RELEASE, Apache 1.3.33, MySQL 4.0.16, PHP 4.3.9, DragnFly 9.0.1.1


A lot of my members are complaining that either new PMs don't show up or that in the user info block it still says they have 1 unread PM when they don't have any.

We're using 9.0.5 so i'm not sure if the above solution is applicable and if it is i'm not sure exactly what needs replacing with what.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux/Apache 2.0/MySQL 5.0.18-standard-log/PHP 4.3.11/DF 9.0.6.1


Its happening on our site as well.

-----------------------

www.purplepride.org
Home of Vikings Fans Worldwide
www.wildfans.com
Home of Wild Fans Worldwide

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
W2003/IIS6/4.x/ /9.0.5


not working correctly on my 9.0.6.1 CVS site either. Has anyone properly reported this as a bug?

NEMINI.org, NEMINI.us, NEMINI.info, NYMINI.org

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
1.3.34 (Unix)/4.1.18-standard/4.4.2 /9.1.0.8 CVS

All times are UTC