View Full Version : Last PM on Forumhome
Kratheous
01-18-2003, 10:00 PM
This hack will show you last PM you recieved on the forumhome.
Kratheous
01-19-2003, 09:00 PM
Screenshot:
Disturbed
01-20-2003, 03:13 AM
nice, thanks for sharing ^^
Sebastian
01-20-2003, 07:59 AM
it doen't work for me.. no errors, just says i have no new pms when i do. v229
Floris
01-20-2003, 07:59 AM
Great, I will install it right away, nice little hack! simple/easy/effective :)
Floris
01-20-2003, 08:05 AM
floris - You have 1 new message(s) since your last visit.
(You have 1 unread messages and 42 total messages in all your folders.)
You have no Private Messages in your inbox at the moment.
Uhm, doesn't seem to be working though :> vB 2.2.9
Floris
01-20-2003, 08:16 AM
inph from the irc informed me to also add the templates that are used into the $templatesused=' bit.
So, find:
$templatesused=' (in the top of index.php)
and at the end of the line, replace:
';
with:
,forumhome_pmlastno,forumhome_pmlast';
Boofo
01-20-2003, 08:37 AM
Well, it works for me, almost. It says the last message title correct but is has ARRAY as the user the message is from (and there is no such user on my board). Also, the message it is picking up was moved out of the Inbox into another folder. Is it supposed to show only pms in your inbox?
inphinity
01-20-2003, 08:48 AM
i think $lastpmuser should be referenced as:
<br><br><b>Latest Private Message:</b> $lastpmstuff[title] by $lastpmuser['username']
also it is the last pm recieved in all folders
you could limit it to inbox by adding folderid = 0 after WHERE in the $lastpmstuff query
Boofo
01-20-2003, 09:06 AM
Should it look like this?
$lastpmstuff=$DB_site->query_first("SELECT * FROM privatemessage WHERE folderid = 0 userid=$bbuserinfo[userid] and fromuserid!=$bbuserinfo[userid] $ignoreusers ORDER BY dateline DESC LIMIT 1");
inphinity
01-20-2003, 09:36 AM
put an 'and' in there as well
folderid = 0 AND userid=$bbuserinfo[userid]
Boofo
01-20-2003, 09:41 AM
Thank you very much. ;) Would there also be a way to pull out the name of the folder the message is in, too?
inphinity
01-20-2003, 10:46 AM
if ($bbuserinfo[pmfolders]) {
$allfolders = explode("\n", trim($bbuserinfo[pmfolders]));
while (list($key,$val)=each($allfolders)) {
$thisfolder = explode("|||", $val);
}
}
$thisfolder[$folderid] = name of folder message is in
$thisfolder[0] (inbox) has a name of "1"
pm folder names are kept in the user table
Boofo
01-20-2003, 10:57 AM
Originally posted by inphinity
if ($bbuserinfo[pmfolders]) {
$allfolders = explode("\n", trim($bbuserinfo[pmfolders]));
while (list($key,$val)=each($allfolders)) {
$thisfolder = explode("|||", $val);
}
}
$thisfolder[$folderid] = name of folder message is in
$thisfolder[0] (inbox) has a name of "1"
pm folder names are kept in the user table
I kind of follow you on this. I put the first 6 lines in but I got lost with the last two lines. :) What would be the complete code I need to do it?
mauce
01-20-2003, 11:36 AM
So how would the hack look like in total?
I'm kinda confused now.
Corrupter
01-21-2003, 07:00 AM
Mine is showing last PM by ARRAY..
Do you have the correct code for this?
Corrupter
01-21-2003, 07:06 AM
Nevermind..
The correct code for template: forumhome_pmlast
<br><b>Latest Private Message:</b> $lastpmstuff[title] by $lastpmuser[username]
See Image:
Kratheous
01-21-2003, 03:01 PM
Hmmm... Indeed. Sorry about that.
Other than that, it should've worked. My friend's running it (that's where I got the screenie from.. haven't reinstalled it on my own boards, yet. @_@)
Boofo
01-21-2003, 03:24 PM
Is there a way to have this link to the last message shown so all you have to do is click on the link to bring the message up?
Kratheous
01-21-2003, 03:33 PM
Yep.
Replace:
$lastpmstuff[title]
With:
<a href="./private.php?s=$session&action=show&privatemessageid=$lastpmstuff[privatemessageid]">$lastpmstuff[title]</a>
Boofo
01-21-2003, 03:45 PM
Excellent! Thank you. Great hack! ;)
Sebastian
01-21-2003, 05:11 PM
Originally posted by Kratheous
Hmmm... Indeed. Sorry about that.
Other than that, it should've worked. My friend's running it (that's where I got the screenie from.. haven't reinstalled it on my own boards, yet. @_@)
but it doesn't work, if you haven't install it then do so, then tell me if it works. 1 person out of 10 got it to work in this thread, doesn't that tell you something? :ermm:
Boofo
01-21-2003, 05:15 PM
Do you have any hacks installed that might be messing with it? I have alot of hacks installed and it works great here.
Kratheous
01-21-2003, 05:30 PM
I just installed it on a 2.2.9 and it does work. No hitches, except the one "array" thing, which has been fixed in the posts above. I can't think of a reason where it shouldn't.
Boofo
01-21-2003, 06:14 PM
Kratheous, don't forget to update the first post with the Array fix. :) I am running a heavily hacked v2.2.9 and it works fine here, too. Also, I adapted it to work on my vbHome lite page as well.
By the way, the code you gave me for the link to the Latest Private Message was missing a sessionhash. :)
This:
<a href="./private.php?s=$session&action=show&privatemessageid=$lastpmstuff[privatemessageid]">$lastpmstuff[title]</a>
Should be this:
<a href="./private.php?s=$session[sessionhash]&action=show&privatemessageid=$lastpmstuff[privatemessageid]">$lastpmstuff[title]</a>
Slynderdale
01-22-2003, 07:43 PM
Ok heres a fix i made to the hack, it uses just 1 query instead of 2, i also added support for firefly's private attachment hack, it also gets the folder name the pm is in, it links the user who sent you the pm to there profile and it also links the message to the pm itself, i fixed up the code and templates, ill post a screenshot below and in the next post the fix. enjoy.
Slynderdale
01-22-2003, 07:43 PM
You can find the updated fixed file that shows the correct folder name here:
https://vborg.vbsupport.ru/showthread.php?postid=345000#post345000
MetroSports82
01-22-2003, 10:45 PM
um.. not working. I'm getting this message, with new pm's?
You have no PMs in your inbox!
Slynderdale
01-22-2003, 11:00 PM
Originally posted by MetroSports82
um.. not working. I'm getting this message, with new pm's?
Hmm, im using it right now and it works, the new pm must be from some one else, not the same user that your checking the pm from, so if you tested by messaging yourself it wont show up as a new pm.
Kratheous
01-22-2003, 11:03 PM
Yes, at the time I made this hack, I hadn't discovered joins... it's actually a few months old... *shrugs* And I must be out of it this week, excuse my lack of full variables. @_@
MetroSports82
01-22-2003, 11:07 PM
Originally posted by Slynderdale
Hmm, im using it right now and it works, the new pm must be from some one else, not the same user that your checking the pm from, so if you tested by messaging yourself it wont show up as a new pm.
LoL! Doh!! :D it works now. thanks, great hack! ;)
Boofo
01-23-2003, 12:05 AM
Originally posted by Slynderdale
Heres the fix.
Thank you, sir, for the folder name addition. Was looking for that one. ;)
Boofo
01-23-2003, 02:10 AM
Originally posted by Slynderdale
Heres the fix.
The foldername is always Inbox when the last message I have is in another folder. It's not showing the folder the actual message is in. Any fix for this?
Slynderdale
01-23-2003, 02:18 AM
Originally posted by Boofo
The foldername is always Inbox when the last message I have is in another folder. It's not showing the folder the actual message is in. Any fix for this?
Hmm, ill fix that now
Slynderdale
01-23-2003, 03:34 AM
Ok, i saw whats wrong and I fixed it and tested it, this now shows the correct folder name its in, enjoy.
Updated, see this post:
https://vborg.vbsupport.ru/showthread.php?s=&postid=394675#post394675
Boofo
01-23-2003, 05:17 AM
Thank you again, sir. ;)
mauce
01-23-2003, 09:47 AM
eeeh.... may I ask.
Can the folders be made clickable (to make it browse to that folder) as well..
(some people are never satisfied, duh?)
Slynderdale
01-23-2003, 10:29 AM
Originally posted by mauce
eeeh.... may I ask.
Can the folders be made clickable (to make it browse to that folder) as well..
(some people are never satisfied, duh?)
in forumhome_pmlast find:
in folder $lastpmstuff[foldername]
change it to:
in folder <a href="private.php?s=$session[sessionhash]&folderid=$lastpmstuff[folderid]">$lastpmstuff[foldername]</a>
I also updated the text file with this.
Slynderdale
05-13-2003, 07:13 PM
Its been a while, any ways, Added a small add on that shows the first 300 chracters of the private message on forumhome.
Boofo
05-13-2003, 07:18 PM
Welcome back, my friend. ;)
Slynderdale
05-13-2003, 07:26 PM
Today at 04:18 PM Boofo said this in Post #40 (https://vborg.vbsupport.ru/showthread.php?postid=394677#post394677)
Welcome back, my friend. ;)
Thanks, latly I pretty much giving up on making hacks for vbulletin till 3.0 comes out. Ive been working on other projects in the mean time. Most for some freinds.
Current Projects (Not intergrated with vbulletin in any way):
Team managment page - user system with user profiles and a admin and user system that allow team admins to create accounts then users to log in and edit there profile.
List List - shows a list of links added by a team admin and also supports banners and tells the status of the site.
Image Gallery with auto thumbnailer
FAQ system that allows people to search FAQ's and team admins to add there own
Projects page - allows the admin to add, edit and delete current prjects and add a screen shot, link, description and other things.
Online dictionary - A custom dictionary where some one can add a word, pronouncian, translation, description and comments. Also with the dictionary withh be a search feature and a text translator feature.
and a bunch of others.
vB-Host.com
05-14-2003, 06:01 AM
Awesome hack.. installed in less then 2 minutes on my www.thesportsforum.net board... thanks for such a cool hack!
Kriek
06-02-2003, 09:37 PM
Confirmed working on 2.3.0, however I made a few slight modifcations in the manner that the private message previews are displayed. I noticed that you were utilizing nl2br() (http://www.php.net/nl2br) to convert new lines into <br> which can stretch the layout so I removed the call to that function and added a str_replace() (http://www.php.net/str_replace) to remove carriage returns "\n" and new lines "\n" from the $lastpmstuff['preview'] variable.
Boofo
06-02-2003, 10:07 PM
Today at 05:37 PM Kriek said this in Post #43 (https://vborg.vbsupport.ru/showthread.php?postid=403571#post403571)
Confirmed working on 2.3.0, however I made a few slight modifcations in the manner that the private message previews are displayed. I noticed that you were utilizing nl2br() (http://www.php.net/nl2br) to convert new lines into <br> which can stretch the layout so I removed the call to that function and added a str_replace() (http://www.php.net/str_replace) to remove carriage returns "\n" and new lines "\n" from the $lastpmstuff['preview'] variable.
Can you show us what you changed in the code itself?
Kriek
06-03-2003, 02:29 AM
Open index.php and find
$lastpmstuff['preview'] = preg_replace("/\[[^\]]*\]/","",$lastpmstuff['message']);
Add the following below it
$lastpmstuff['preview'] = str_replace(array("\n","\r\n","\r")," ",$lastpmstuff['preview']);
Remain in index.php and find
$lastpmstuff['preview'] = trim(nl2br(dowordwrap($lastpmstuff['preview'])));
Replace with the following
$lastpmstuff['preview'] = trim(dowordwrap($lastpmstuff['preview']));
Boofo
06-03-2003, 02:55 AM
Here's what I already had for that piece of code and I think it works about the same way, doesn't it?
$lastpmstuff['preview'] = preg_replace("/\[[^\]]*\]/","",$lastpmstuff['message']);
$lastpmstuff['preview'] = str_replace("\"","",$lastpmstuff['preview']);
$lastpmstuff['preview'] = trim(htmlspecialchars($lastpmstuff['preview']));
if (strlen($lastpmstuff['preview']) > 300) {
$lastpmstuff['preview'] = substr($lastpmstuff['preview'], 0, 300) . "…";
}
$lastpmstuff['preview'] = trim(dowordwrap($lastpmstuff['preview'])); // for pm title= preview
Kriek
06-03-2003, 03:35 AM
Technically yes, but it will not remove carriage returns and/or new lines.
Boofo
06-03-2003, 03:47 AM
I tried it with your code and the message looked all run together. I want it to look like it does in the pm when you preview it.
Kriek
06-03-2003, 09:41 PM
Then you completely misunderstood the purpose of my modifcations, as I do NOT want the preview to look like the original private message, because it stretches the layout; imagine a private message with ten or more carriage returns.
Boofo
06-03-2003, 09:50 PM
I understand what you mean now. Sorry about that. It is just a little hard to read all bunched together for me. ;)
Kriek
06-03-2003, 10:01 PM
No problem, my modifcations are easy enough for you to reverse I hope ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.