phpBB.com     phpBB Academy     phpBB Modders     phpBB Weekly     ktuk     phpBB Hacks     Vlad Studio  

Link quote to original post

When a post is quoted, it links the user name in the quote to the original post

Not enough for a full proper MOD, but too useful not to share
Forum rules
Please read over our forum guidelines

Link quote to original post

Postby kenny » 09 Nov 2009, 23:06

First off, this it not my code, but was posted on phpBB forums somewhere. I have cleaned it up a little and added a little extra bit that shows the time when the post was quoted. This Snippet is available here on this site - you can try it out by posting in the test forum :)

Comment:
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
Code: Select all
        $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n"; 
;
#
#-----[ REPLACE WITH ]------------------------------------------
#
Code: Select all
//        $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
        $message_parser->message = '[quote="' . '[url=' . generate_board_url() . "/viewtopic.$phpEx?p=$post_id#p$post_id" . ']' . $post_data['quote_username'] . ' » ' . $user->format_date($post_data['post_time']) . '[/url]' . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";     
Last edited by kenny on 09 Nov 2009, 23:09, edited 1 time in total.
Reason: Fixed formatting
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Donate to 6 String MODs
If you like any of the work that I do here, please consider donating.
click the image on the left for a list of some of the advantages of donating



Link quote to original post

Postby marian0810 » 19 Feb 2010, 11:25

kenny » 10 Nov 2009, 00:06 wrote:and added a little extra bit that shows the time when the post was quoted.

I was really excited when I found this yesterday, I've been looking for this since the day we upgraded to phpBB3 more that a year ago. The only thing similar I found so far had an annoying bug in it when you use relative times. So yesterday I installed this on my testforum and waited... and found that it has the same bug :cry: :cry:
So please please please please can you make this work properly for boards that use "today" and "yesterday" instead of just the times? :notworthy: Our users really miss this function.

To clarify:
quote.jpg


text above quote doesn't convert to "yesterday" like it should (next day it should show the time only). Instead it stays "vandaag" which means "today" - as you can see it doesn't translate either when I set my profile to English :?
We had this working perfectly on phpBB2 so it should be possible, right?
User avatar
marian0810
Registered User
Registered User
 
Posts: 4
Joined: 18 Feb 2010, 11:38

Link quote to original post

Postby kenny » 19 Feb 2010, 18:43


Works fine for me :)
quote.png
quote.png (4.35 KiB) Viewed 3017 times
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Link quote to original post

Postby marian0810 » 19 Feb 2010, 20:41

Well yeah, probably because the post actually is from today :lol: But if you check the above post again tomorrow, that same link SHOULD say yesterday but it will in fact still say today.

We had quotes that were months old and still said '"today' :?
User avatar
marian0810
Registered User
Registered User
 
Posts: 4
Joined: 18 Feb 2010, 11:38

Re: Link quote to original post

Postby kenny » 20 Feb 2010, 18:36

Ah, ok I see it now. This may take a bit more work as that infomation is effectively stored as part of the post in the database. No real easy way to update it. It would probably be simpler to disable the use of relative dates for this
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Link quote to original post

Postby marian0810 » 20 Feb 2010, 21:08

:cry: I guess I had hoped you could tell me how to use the actual date function of phpBB instead :(
User avatar
marian0810
Registered User
Registered User
 
Posts: 4
Joined: 18 Feb 2010, 11:38

Re: Link quote to original post

Postby kenny » 20 Feb 2010, 21:55

Ah, sorry that's actually what I meant to say - it would be easier to use the actual date function for this. Me and my explanation fails tonight :P
This code:
Code: Select all
$user->format_date($post_data['post_time']) 

Is what should be changed. $user->format_date is what returns the date format. So if you're using relative dates, it will pull that. Changing to something like this would work:
Code: Select all
date("jS F Y, G:i:s", $post_data['post_time']) 

This part in quotes - "jS F Y, G:i:s" can be modified to your liking. php.net gives you a breakdown of all the values you can add. The one I included is my personal preference. I made it up a few years back :)
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK

Link quote to original post

Postby marian0810 » 20 Feb 2010, 23:43

Thank you very much! I'm going to try that immediately :D

Edit: working perfectly, thanks again!!
User avatar
marian0810
Registered User
Registered User
 
Posts: 4
Joined: 18 Feb 2010, 11:38

Re: Link quote to original post

Postby kenny » 21 Feb 2010, 01:44

Excellent. Hopefully others may benefit from that as well :)
|| 6 String Romance || Myspace || phpBB.com || Need Freelance Work? ||
If you need one of my MODs installed - click here


Are you a musician in the Glasgow area interested in acoustic events? The ArtBox
User avatar
kenny kenny is probably rawking out on RockBand \m/
Project Leader
Project Leader
 
Posts: 647
Joined: 06 Jun 2008, 11:38
Location: Airdrie, UK




Return to Code Snippets

Who is online

Google [Bot]


cron