PDA

View Full Version : Private Messages Enhancements - Private Message Quote Formatting


kh99
12-14-2012, 11:00 PM
What is it?
----------------------------
This mod arranges quotes in a PM to be in a "conversational" order instead of being nested. This solves the problem of displaying deeply-nested quotes. This mod also has an option to add a date/time stamp to quoted PMs.

Also, I'm not much of an html/css person - this mod mostly provides variables which can be checked in the template, and a bare-bones css file. If anyone comes up with css for a better looking format and wants to share it, please do (and maybe I'll put it in a later version).

(vb4 version is here: https://vborg.vbsupport.ru/showthread.php?t=292968)


Installation:
----------------------------
Just import the product XML file from the Product Manager. This doesn't change stored PMs in any way (unless you enable the date/time stamp option - see below), so you can uninstall or disable the product at any time to go back to the original PM template.

If you'd like to customize the format, you can edit the kh99_pm_quote, kh99_pm_quote_bit, and/or the kh99_pm_quote.css templates.

If you want to add date/time tags to PM quotes, go to the adminCP options under "Private Messaging Options" and set "Add Date and Time to Quotes" to yes. Note that if you later uninstall this mod, any messages quoted while this option was on will still contain a date/time tag, but it will display after the name in a default format and timezone. If this is a concern, it's probably better that you don't enable this option.

Also note that the date/time option only adds the timestamp to newly quoted messages - it will not add one to quotes in existing messages.

Note: Because I forgot to set a product id for version 0.90, when upgrading from 0.90 to a later version the mod installs as a separate product so that it looks like this mod is installed twice. If that happens you should just be able to uninstall version 0.9.

History:
----------------------------
1.0 (Jan 01, 2013)
Fixed issue with white page on some forums
All templates now cached (I hope).


0.91 (Dec 22, 2012)
Fixed conflict with at least one mod that adds default text formmating
Fixed problem with html in pm notification email
Option to show only N newest quotes and hide the rest
Optional Date/Time tag added to quotes in PMs
Added enable/disable option for the entire product, in admincp
Templates are now cached

0.9 (Dec 14, 2012)
Initial Release

CoffeeLovesYou
12-15-2012, 07:43 AM
This is a very nice addition, kh99!
Thank you very much
I hated when I had a PM I kept responding to for a long time because the quotes started to look really weird. This solves the issue!

edit:
:(
After installing this, I get this error.
Fatal error: Call to undefined method vB_Template::fetch_css_path() in /MYFORUMPATH/global.php(607) : eval()'d code on line 507
I replaced my actual forums path with MYFORUMPATH to protect my forum's path privacy lol but that is the error I'm getting.
No, it isn't all over the site, only when I go to private.php (aka my private messages)

kh99
12-15-2012, 12:51 PM
Yeah, sorry, I somehow managed to attach the vb4 version. It's fixed now.

Black Tiger
12-15-2012, 02:27 PM
This looks very nice.
I've tagged it for now, and wait until it's a bit more tested. Normally I could do that too, but my board is reasonably modded and has VBA CMPS on it, so at this point I don't take any risks. But I like this mod!

Fluke667
12-16-2012, 12:08 PM
Thank you it looks so nice :)

blind-eddie
12-16-2012, 01:41 PM
Wow, what a difference... Default quote in pm gets huge when you reply alot, I never liked the way it looked.... Very nice... Thank you for sharing your addon.

CoffeeLovesYou
12-16-2012, 04:59 PM
For some reason I don't see ANY quotes in ANY of my PMs after installing this again.
In the PM reply you can see about 4 or 5 quotes but none of them are showing up when I go to actually read the PM.

Why?

https://vborg.vbsupport.ru/external/2012/12/15.png

kh99
12-16-2012, 05:25 PM
I'm not sure, but it seems like maybe the template isn't working. You installed the vb4 version when I accidentally posted it, right? Did you completely uninstall that one? Maybe uninstalling and reinstalling, if you haven't already.

What verson of vb are you running?

CoffeeLovesYou
12-16-2012, 08:37 PM
Yes, I completely uninstalled and reinstalled.
I am running vB3.8.7

kh99
12-16-2012, 08:53 PM
Could you try creating a new style with no parent and see if that works?

Also, do you have any other mods that have to do with PMs? Maybe go to the Plugin Manager, sort by hook location, and see if anything else is using bbcode_create.

Kolektor
12-19-2012, 12:45 PM
thanks for this. it's good to see that still there are coders making mods for 3.8.x series.

ctrlbrk
12-20-2012, 05:52 AM
Looks good. But what about adding a date/time header to each quote box?

Also you need to cache your templates.

kh99
12-20-2012, 07:30 AM
Looks good. But what about adding a date/time header to each quote box?

I was just thinking about that a couple days ago. The existing quotes don't have that information available, but I'll see how hard it would be to add for new quotes.


Also you need to cache your templates.

I can't believe I forgot all about that. Thanks.

ctrlbrk
12-21-2012, 12:26 AM
There is another (major) problem, apparently the formatting of emails is messed up with half-HTML half-CSS half-original text.

For example here is a PM email

http://screencast.com/t/ZgwWxxBq

kh99
12-21-2012, 12:37 AM
Could you post the message (showing bbcode) that caused that?

ctrlbrk
12-21-2012, 01:03 AM
Could you post the message (showing bbcode) that caused that?

Best I can tell, any/all PM's that contain a quote (vb quote) will trigger the problem.

No bbcode being used or inserted by the user.

Examples:
http://screencast.com/t/iQOyaszXjY

First user sent "test 123" then second user replied "reply test", and the resulting email was:

http://screencast.com/t/bfJwu9uOTFQk

kh99
12-21-2012, 01:12 AM
Oh, I see. I missed that you were talking about the email. I'll look in to that, thanks.

Max Taxable
12-21-2012, 01:13 AM
I am watching this - I'm guilty of asking for this for v3.... So throw rocks at ME if it causes problems meanwhile I'll just wait and let the rest of you take all the risk! :D

kh99
12-21-2012, 01:24 AM
Well, that's why it's beta - I haven't tested it a lot. I don't think I even looked at a PM email when this was installed because it never occurred to me that it could be a problem.

Edit: oops - I forgot to mark the vb3 version as beta....

Max Taxable
12-21-2012, 01:26 AM
Normally I test stuff full speed ahead and damn the torpedoes, but on this one I'm not sure if will uninstall completely. Otherwise I would have right at it.

kh99
12-21-2012, 01:36 AM
Obviously others are interested in the vb3 version so it doesn't matter to me if you wait or decide not to install it at all. But for anyone else who might be worried about it, this makes no database changes and has no custom uninstall code, so uninstalling won't be a problem.

Max Taxable
12-21-2012, 01:37 AM
Obviously others are interested in the vb3 version so it doesn't matter to me if you wait or decide not to install it at all. But for anyone else who might be worried about it, this makes no database changes and has no uninstall code, so uninstalling won't be a problem.Nice to know.

I thought it was a good idea (it is) that's why I asked for it for v3.

ctrlbrk
12-21-2012, 01:47 AM
Yes, I very much want this to work... just need to fix the emails, or trigger them to be sent in HTML mode.

Max Taxable
12-21-2012, 02:18 AM
Yes, I very much want this to work... Me too.

kh99
12-21-2012, 02:34 AM
It turns out that it wasn't a big fix. I'll release a new version tomorrow.

ctrlbrk
12-21-2012, 03:11 AM
It turns out that it wasn't a big fix. I'll release a new version tomorrow.

Excellent, thanks. Crossing fingers for adding the date/time as well, I know it will take some PHP and query but I think is worth it :)

kh99
12-21-2012, 10:14 AM
Excellent, thanks. Crossing fingers for adding the date/time as well, I know it will take some PHP and query but I think is worth it :)

I'll look in to doing that. But one thing about that: it will be something that won't go away when you uninstall the mod. It's going to have to go in as part of the name of the person you're quoting.

ctrlbrk
12-21-2012, 10:27 AM
I'll look in to doing that. But one thing about that: it will be something that won't go away when you uninstall the mod. It's going to have to go in as part of the name of the person you're quoting.

Or just a $variable? I figure you'll need to do a SELECT query to find the info, then the plug-in could just throw it in a $variable? I for instance would prefer to be able to float: right; the date on the other side of the quote box. But either way, it is welcome.

kh99
12-21-2012, 11:12 AM
Or just a $variable? I figure you'll need to do a SELECT query to find the info, then the plug-in could just throw it in a $variable? I for instance would prefer to be able to float: right; the date on the other side of the quote box. But either way, it is welcome.

I'm not sure what you mean by a variable. (Edit: oh, I think I see now, you mean a variable you can use in the template). Maybe you have an idea of how to do it that I haven't thought about. But the quote is just a bbcode with the user's name as an option and the text as the parameter, like: Or just a $variable?.... That's all the information there is. It *might* be possible to do a query for previous messages matching the quoted text (assuming it hasn't been deleted), but I'm not going to try to do anything like that - it might end up being more complicated than the entire mod is now.

So that just leaves adding it to the option somehow. Quoting posts uses that method by adding the post id after a semicolon, like Or just a $variable?..., then the code looks for that, strips it off and uses it to create the little arrow that takes you to the post. I might be able to do something similar with the date and time, but then if my mod is uninstalled it will still be there (unless I go through all PMs on the system and delete it when I uninstall). That might not be a problem if it's text - my mod can strip it off and make it a variable in the template, and if it's uninstalled it will just appear after the name. Adjusting the timezone might be a bit of an issue but I think I can deal with that.

Anyway, let me know if you have a different idea.

kh99
12-21-2012, 11:52 AM
Hmm...I suppose I could just do one query to try to match the quoted text and username, and if it fails (like if the message was deleted) then it just won't show up. I don't like that as mush as including it as part of the option text, but I'm not the one requesting it. Would you rather it be a hit-and-miss type of thing that depends on the quoted message still being in the system (but it would work for existing pms with quotes and would go away completely if uninstalled), or make it part of the option, in which case it would not be there for pre-existing pms and it wouldn't go away when uninstalled, but it would stay around even if the mod is uninstalled? (In either case it will be a variable that you can float right, as long as this mod stays installed).

ctrlbrk
12-21-2012, 11:54 AM
Hmm. I figured that there was a hook that contained the private message ID somewhere, so you could know exactly what to query. But I haven't looked at the hooks or dumped any arrays to see what is available.

Once you have the PM ID#, I was thinking just to do a SELECT lookup, retrieve the date/time, then make that available as a $variable that can be used within the template.

For the moment, I'd just like the email bug fixed :)

ctrlbrk
12-21-2012, 12:05 PM
Perhaps $pmdm->pmtext['pmtextid'] from looking briefly

kh99
12-21-2012, 12:08 PM
Hmm. I figured that there was a hook that contained the private message ID somewhere, so you could know exactly what to query. But I haven't looked at the hooks or dumped any arrays to see what is available.

Well right, at the time the message is first quoted I can find the date/time, it's just that it needs to be stored as part of the quote tag or else I'd need to find it again (using only the user name and quoted text) every time the message is displayed.


For the moment, I'd just like the email bug fixed :)

I'll definitely be releasing that fix today, but I wanted to see what else I can get done in the same release.

Edit: I had a power outage here yesterday, so I'm a bit behind but it's basically done and I'll be releasing it soon.

kh99
12-22-2012, 04:16 PM
But what about adding a date/time header to each quote box?

Also you need to cache your templates.

There is another (major) problem, apparently the formatting of emails is messed up with half-HTML half-CSS half-original text.


OK, I released another version (0.91) that fixes the above, and also a problem someone asked about in the vb4 thread where it was incompatible with another mod. Also adds a cutoff setting that someone asked for via PM.

Edit: oops - I added a template to format the date/time in a new message, and now I've forgotten to cache that one. I'll add it next update (or you can add it in the cache_templates plugin if you want to take care of it before then).

Abu2
12-22-2012, 11:09 PM
0.91 (Dec 22, 2012)
Hi. I've a white screen on forum/private.php with new version.
Also, new version of product installs as a new product and it doesn't rewrite old one.
Previous version works great.

kh99
12-22-2012, 11:11 PM
Hi. I've a white screen on forum/private.php with new version.
Also, new version of product installs as a new product and doesn't rewrite old one.

Hmm...I think the reason for installing as a new product is that I forgot to set the product ID on the previous version. I think it should be OK to uninstall the 0.9 version, but if it still doesn't work uninstall the 0.91 version as well, then reinstall it. (It might be the cause of the white screen, but I'll do some more testing as well).

Abu2
12-22-2012, 11:17 PM
I reinstalled it, but... The same - white screen...

kh99
12-22-2012, 11:21 PM
OK. I just tried it myself and didn't see any problems, so possibly it's a conflict with something on your forum, and I'd like to figure out what it is. Do you have any access to your php or web server error logs, to see if there's any information there? Also, which version of vb are you running?

Edit: Another thing you could do - there are 4 plugins, you could try disabling the separate plugins one at a time to see if you can figure out which one is the problem. That would at least let me know which part to focus on.

Abu2
12-23-2012, 12:33 AM
I use 3.8.6. No errors in error.log.
I switched off all of PM's and quote mods, - no result.

But previous version 9.0 works.
Mabe problem in plugin hooks...

I tried to disable them step by step, but...

kh99
12-23-2012, 12:38 AM
Could you try going to the Plugin Manager, find the section for "Private Message Quote Formatting", and disable those plugins one at a time, to see if you can figure out if one of them is causing the problem?

kh99
12-23-2012, 12:53 AM
I tried to disable them step by step, but...

So you're saying you already disabled the individual plugins (not products) one by one and it didn't help? That's strange, I was pretty sure it had to be one of the plugins. I'm not sure what else it could be.

ctrlbrk
12-24-2012, 03:47 PM
Installed the new version. I think email problem fixed, but the quote[datestr] isn't doing anything - I sent several new messages to my test account, replied from test account back to admin account, and no datestr or timestr on anything.

I first uninstalled old version, deleted customized template, and then imported new one.

kh99
12-24-2012, 04:25 PM
Did you enable the option in the admincp (under Private Messaging Options)? It's disabled by default, since I didn't want people to turn it on unless they were aware that the date/time stamps would hang around even after uninstalling.

When it's turned on, you should see the date/time stamp in the quote tag (in the quick reply box, for example, like:

test

If you're not seeing that then you won't see the date str in the message.

On another subject: I realize that you customized your template for the previous version then I changed it - would it help if I posted the changes in the quote template that were made for the new version?

ctrlbrk
12-24-2012, 05:11 PM
Yup all good now, I didn't know there was an option.

https://vborg.vbsupport.ru/external/2012/12/8.png

Thx and Merry Christmas!

Kajouka
12-26-2012, 03:54 AM
I have 3.8.5 installed and when I added this, my server couldn't load the private.php page or the actual messages.

Not sure if it's that I haven't upgraded all the way, just thought I'd let you know. Thanks!

kh99
12-26-2012, 11:58 AM
I have 3.8.5 installed and when I added this, my server couldn't load the private.php page or the actual messages.

Not sure if it's that I haven't upgraded all the way, just thought I'd let you know. Thanks!

One other person had that same problem - I suspect a conflict with another mod. Any way you could tell me which mods you have installed (or PM me if you don't want to post it)?

Edit: also, I originally developed this on vb3.8.3, so I don't think the issue is the version.

dizzynation
12-27-2012, 03:42 AM
Sweet, looking to install tonight. I have "Send PM Attachments" mod, think everything will work ok?

kh99
12-27-2012, 10:39 AM
Sweet, looking to install tonight. I have "Send PM Attachments" mod, think everything will work ok?

I haven't tested it with that mod, but offhand I don't know of any reason that it wouldn't. It should be safe for you to try, you only need to uninstall this mod if there's a problem - it won't leave anything behind. But if this mod doesn't work for you, I'll try to figure out why.

dizzynation
12-29-2012, 01:32 AM
Installed and works great with "Send PM Attachments"

vijayninel
12-31-2012, 07:16 AM
Great mod but getting white pages :(

I have vBulletin PM-Autoresponder, GTPrivate Messages Enhanced Listing, GTUserCP - Enhanced USERCP Interface + USERCP Menu, PM Block List by BOP5. (edit .. tried disabling these mods but it still dint work)/

kh99
12-31-2012, 12:17 PM
Thanks, I'll try installing those anyway because I'm not sure what else to do.

Can you tell me what version of vb and php you have?

Edit: Also, another thing you could do if you still have this mod installed: There are 4 plugins - try enabling only one at a time to see if you can determine which one is causing the white screen.

vijayninel
12-31-2012, 12:46 PM
Thanks for the reply. Disabling the plugin - "PM Quote Formatting - Add CSS" makes the rest work of the mod work fine. Enabling it gives white pages. :(

I have vB 3.8.5 on PHP 5.3.10-1ubuntu3.4

kh99
12-31-2012, 01:06 PM
Could you try replacing the code in the "PM Quote Formatting - Add CSS" plugin with this:

if (THIS_SCRIPT == 'private' && $vbulletin->options['kh99_pmq_enable'])
{
if (intval($vbulletin->versionnumber) == 4)
{
if ($vbulletin->options['storecssasfile'])
{
$template_hook['headinclude_css'] .= '<link rel="stylesheet" type="text/css" href="' . vB_Template::fetch_css_path() . 'kh99_pm_quote.css?d=' . $style['dateline'] . '" />';
}
else
{
$template_hook['headinclude_css'] .= '<link rel="stylesheet" type="text/css" href="' . vB_Template::fetch_css_path() . 'kh99_pm_quote.css" />';
}
}
else // vb3
{
eval('$kh99_pmq_css = "' . fetch_template('kh99_pm_quote.css') . '";');
if ($kh99_pmq_css !== '')
{
$vbulletin->templatecache['headinclude'] .= '<style type=\"text/css\">' . addslashes($kh99_pmq_css) . '</style>\n\n';
}
}
}

vijayninel
12-31-2012, 01:17 PM
^^ Replaced. Working perfectly fine now. Thanks. :)

Installed.

kh99
12-31-2012, 01:26 PM
Great - yeah, it's combined vb3/vb4 code and I thought at one point it was a good idea to check for the vB_Template class, but I guess some mod is defining that. I should have known better. In any case I appreciate your help in figuring it out.

I'll release an update soon with that fix.

kh99
01-01-2013, 02:09 PM
Version 1.0 hopefully fixes the white page problem some people had, and also caches that template I missed last time. Thanks to everyone who helped find the bugs in the beta versions.

Abu2
01-01-2013, 03:41 PM
kh99, Thank you! It works!

joeychgo
03-05-2013, 11:50 AM
How about moving the quote command in the quick reply box down a bit so people dont mistakenly put text inside the quotes when answering?

kh99
03-05-2013, 12:36 PM
How about moving the quote command in the quick reply box down a bit so people dont mistakenly put text inside the quotes when answering?

You can do that yourself - edit template kh99_newpm_quote and just put a blank line above the code that's already there.

You can also do it without this mod by editing newpost_quote (under New Posting Templates) and do the same thing. If you do that, it will work for both PMs and regular posts. If you only wanted the space for PMs you could do this:
<if condition="THIS_SCRIPT == 'private'">
</if>{$pagetext}

OnlyTouch
12-19-2015, 02:05 PM
Good mod, installed!