Show pm inbox amount?
Posted: 03 July 2005 01:25 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  174
Joined  05-14-2004

I was wondering if there was a way to pull the info of any new messages for private messaging so say on the index it would say:

Welcome back {you}! You currently have 2 new PM’s! or You do not have any new messages

Any ideas?

 Signature 

OneStarryNight

Profile
 
 
Posted: 03 July 2005 01:30 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

I just tried putting the private message box code on the index and it didn’t work, so I’m not sure how, or if you can (without sql queries) do this right now.

 Signature 
Profile
MSG
 
 
Posted: 03 July 2005 01:33 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  174
Joined  05-14-2004

what’s the PM code I can try to see if I can come up with something?

 Signature 

OneStarryNight

Profile
 
 
Posted: 03 July 2005 01:35 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Eh, the code is getting messed up here.  Send me an email and I’ll send it to you.

 Signature 
Profile
MSG
 
 
Posted: 03 July 2005 03:48 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  74
Joined  05-14-2004

In any template allowing PHP:

{if logged_in}

<?php
global $SESS;
$pmcount = $SESS->userdata['private_messages'];

if (
$pmcount == 1) {
  
echo 'You have a new private message!';
} elseif ($pmcount > 0) {
  
echo 'You have '.$pmcount.' new private messages!';
}

?>

{
/if}

I’ll let LisaJill Wiki this, I couldn’t figure out where it should go.  :)

SFT

Profile
 
 
Posted: 03 July 2005 04:08 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12779
Joined  04-29-2002

Wik’d - DisplayPMStats

I’ll let her categorize it. smile

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 03 July 2005 08:16 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  174
Joined  05-14-2004

The code doesn’t appear to work for me.

 Signature 

OneStarryNight

Profile
 
 
Posted: 03 July 2005 10:23 AM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  74
Joined  05-14-2004

How does it fail?  Throw an error?  Display nothing whatsoever?  Point and laugh?

Profile
 
 
Posted: 03 July 2005 12:12 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  174
Joined  05-14-2004

It points and laughs at me :( oh and shows nothing whatsoever… lol I should have posted when I was more awake and coherant instead of “IT DOESN’T WORK FIX IT” without the actual error lol

 Signature 

OneStarryNight

Profile
 
 
Posted: 03 July 2005 12:13 PM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7509
Joined  08-05-2002

Do you have PHP turned on?

We’re going to add a global variable that has the unread private messages count soon.  Just have not got there yet.

 Signature 
Profile
 
 
Posted: 03 July 2005 12:14 PM   [ Ignore ]   [ # 10 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12779
Joined  04-29-2002
StarryMom - 03 July 2005 08:16 AM

The code doesn’t appear to work for me.

This snippet displays only if you have a pm.

It’s slightly different from what you requested.

And actually I just noticed ==

if ($pmcount == 1) {
echo 'You have a new private message!';
} elseif ($pmcount > 0) {
echo 'You have '.$pmcount.' new private messages!';
}

should be:

if ($pmcount == 1) {
echo 'You have a new private message!';
} elseif ($pmcount > 1) {
echo 'You have '.$pmcount.' new private messages!';
}

>1 not >0

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 03 July 2005 12:22 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  174
Joined  05-14-2004

That small fix did help me Sue and thank you 75th Trombone for the coding!

 Signature 

OneStarryNight

Profile
 
 
Posted: 03 July 2005 01:37 PM   [ Ignore ]   [ # 12 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Add it to the wiki, categorize it, and I can always move it if I know of somewhere better.  I just host the thing, I’m not the end-all be-all of wiki knoweldge, even of this one. wink

Let chaos reign, I say. *dances*

 Signature 
Profile
MSG
 
 
Posted: 03 July 2005 09:17 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  484
Joined  05-14-2004

Hmm.. This code doesn’t seem to work for me.  I get nothing returned and I have 1 msg in my Inbox as a test.
Now this is not for the “forums” only is it as I dont have that module.  I am just using the built in 1.3 PM code.

{exp:since_last_visit:stats}

<a href="{path=member/profile}">Profile</a> | <a href="{path=LOGOUT}">Logout</a><br />
<
span style="font-weight:bold;">
Welcome {screen_name}!
</
span><br />
Last visited on {last_visit_date format="%m/%d/%y"} at {last_visit_date format="%H:%i"}<br />
You are visiting from {ip_hostname}.<br />
New
Posts: <strong>{new_entry_total}</strong> New Comments: <strong>{new_comment_total}</strong><br />
<
a href="{path=member/memberlist}" target="_blank">Member List</a>

{/exp:since_last_visit:stats}

<?php
global $SESS;
$pmcount = $SESS->userdata['private_messages'];

if (
$pmcount == 1) {
echo 'You have a new private message!';
} elseif ($pmcount > 1) {
echo 'You have '.$pmcount.' new private messages!';
}

?>

{
/if}

 Signature 

Far From Perfect
Broadcasting live from Iraq via High-speed Bytes/Second Internet!

Profile
 
 
Posted: 03 July 2005 09:35 PM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  174
Joined  05-14-2004

Is the message read or unread?

 Signature 

OneStarryNight

Profile
 
 
Posted: 04 July 2005 02:21 AM   [ Ignore ]   [ # 15 ]  
Grad Student
Rank
Total Posts:  74
Joined  05-14-2004

Also, it’s not just for the forums, I’m using it without the forum module.

I reckon StarryMom’s got the right idea—- that your test PM has been read, and you’re not expecting EE to be as cool as it’s being.  XD

Also make sure that PHP is turned on, and that your initial {if logged_in} statement actually exists—- in your pasted code the {/if} is just hangin’ out by itself. ;P

Profile
 
 
Posted: 20 July 2005 07:50 PM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  04-24-2004

This is nice, thanks for the code guys (and for wiki’ing it) :thumbsup: smile

One question though - what’s the appropriate path to link to a private message inbox? I’m using
http://www.mysite.com/forums/member/messages/view_folder/1/
..which seems to work whether you’re user 1 or 81 - is that correct? Should the trailing number be ‘1’ for any logged in user?

 Signature 

lukestevensdesign.com · Design 2.0 · Pro Network member

Profile
 
 
Posted: 20 July 2005 08:01 PM   [ Ignore ]   [ # 17 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  7509
Joined  08-05-2002

That URL you have there will work.  The PM system will only ever show the messages for the currently logged in user so that URL works for everyone.  If the person is not a logged in user, then it will not work, in case you are wondering.

 Signature 
Profile
 
 
Posted: 20 July 2005 08:05 PM   [ Ignore ]   [ # 18 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  04-24-2004

Excellent, thanks Paul!

 Signature 

lukestevensdesign.com · Design 2.0 · Pro Network member

Profile
 
 
   
 
 
‹‹ Spell Check      Stand Alone Form ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66460 Total Logged-in Users: 65
Total Topics: 84846 Total Anonymous Users: 25
Total Replies: 455288 Total Guests: 171
Total Posts: 540134    
Members ( View Memberlist )