Changing quote bbcode

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
Vampy
Registered User
Posts: 140
Joined: Mon May 12, 2003 4:25 pm

Changing quote bbcode

Post by Vampy »

Hi, all! I'm tearing my hair out with trying to modify the bbcode for quote username. From my phpBB2 forum, the quote username is formatted to something like this:

Code: Select all

[quote="username" date="unix_time" post="post_number"]quoted text[/quote]
which when parse by bbcode.php will be output as

Code: Select all

<a href="domain.com/viewtopic.php?t=post_number">Username wrote on date</a>: Quoted text</a
I trying to accomplish the same thing with phpBB3. However, every attempt I did just ended up with me breaking the formatting of the bbcode. Below is an example of the codes I use:
bbcode.php

Code: Select all

'preg' => array(
							'#\[quote(?:="(.*?)"\sdate="(.*?)"\spost="(.*?)")?:$uid\]((?!\[quote(?:=".*?"\sdate=".*?"\spost=".*?")?:$uid\]).)?#ise'	=> "\$this->bbcode_second_pass_quote('\$1', '\$2', '\$3', '\$4')"
						)

Code: Select all

function bbcode_second_pass_quote($username, $timestamp, $post_number, $quote)
	{
		// when using the /e modifier, preg_replace slashes double-quotes but does not
		// seem to slash anything else
		$quote = str_replace('\"', '"', $quote);
		$username = str_replace('\"', '"', $username);
		$date = str_replace('\"', '"', $timestamp);
		$converted_date = $user->format_date($date);
                $post = str_replace('\"', '"', $post_number);

		// remove newline at the beginning
		if ($quote == "\n")
		{
			$quote = '';
		}

		if ($username)
		{
			$quote = str_replace('$1', $username, $this->bbcode_tpl('quote_username_open'));
			$quote = str_replace('$2', $converted_date, $this->bbcode_tpl('quote_username_open'));
                        $quote = str_replace('$3', $post, $this->bbcode_tpl('quote_username_open'));
		}
		else
		{
			$quote = $this->bbcode_tpl('quote_open') . $quote;
		}
		
		//$quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote;

		return $quote;
	}
Of course I made changes to the bbcode.html template file and I refresh the template caches as well.
Can someone please advise what's wrong and how to rectify it? Thanks.
Julian
Locked

Return to “[3.0.x] MOD Writers Discussion”