Move username under the quote

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Move username under the quote

Post by Татьяна5 »

Hello
How to move username under the quote?
Like this:

Image

Sorry for my bad English, it is a foraign language for me
User avatar
HGN
Former Team Member
Posts: 4706
Joined: Wed Dec 03, 2008 1:53 pm
Location: The Netherlands
Name: Alfred
Contact:

Re: Move username under the quote

Post by HGN »

What style is that?
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: Move username under the quote

Post by Татьяна5 »

Style is SmartDark based of subsilver2

I can simply move username in bbcode.html, but it doesn't work. Variable "username" not specified in the quote_close, and I don't know how to specify it
User avatar
Lumpy Burgertushie
Registered User
Posts: 68471
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Move username under the quote

Post by Lumpy Burgertushie »

not really clear on exactly what you want to do here.

can you please explain a little better.

also, where did you get that style, I can't seem to find it.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52219
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Move username under the quote

Post by Brf »

The username is replaced in bbcode.php in the bbcode_tpl_replace() function. it explicitly replaces the {USERNAME} variable in the quote_username_open tag.
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: Move username under the quote

Post by Татьяна5 »

Lumpy Burgertushie,
http://smartor.is-root.com/phpbb2-style ... ark-style/ (Style changed to phpBB 3.0.11)


I want move

Code: Select all

{USERNAME} {L_WROTE}
under the quote (picture in the first post), but

Code: Select all

{USERNAME}
don't work in the

Code: Select all

<!-- BEGIN quote_close -->
</div>
<!-- END quote_close -->
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: Move username under the quote

Post by Татьяна5 »

Brf, yes, I know
but how to do that:

Code: Select all

<!-- BEGIN quote_username_close -->
code {USERNAME} {L_WROTE} code
<!-- END quote_username_close -->
?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52219
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Move username under the quote

Post by Brf »

If you want to use "quote_username_close", then you will have to call that up in bbcode.php. Right now bbcode.php has a special routine to call the correct open template, you would have to write in a similar routine for choosing the close template.
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: Move username under the quote

Post by Татьяна5 »

I don't understand what to write in the bbcode.php

Code: Select all

case 0:
					$this->bbcode_cache[$bbcode_id] = array(
						'str' => array(
							'[/quote:$uid]'	=> $this->bbcode_tpl('quote_close', $bbcode_id)
						),
						'preg' => array(
							'#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise'	=> "\$this->bbcode_second_pass_quote('\$1', '\$2')"
						)
					);
				break;

Code: Select all

function bbcode_tpl_replace($tpl_name, $tpl)
	{
		global $user;

		static $replacements = array(
			'quote_username_open'	=> array('{USERNAME}'	=> '$1'),

Code: Select all

function bbcode_second_pass_quote($username, $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);

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

		$quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote;

		return $quote;
	}
This is precisely my question...
User avatar
AmigoJack
Registered User
Posts: 5812
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Move username under the quote

Post by AmigoJack »

Open /includes/bbcode.php and find:

Code: Select all

    foreach ($bbcode_ids as $bbcode_id)
    {
      switch ($bbcode_id)
      {
        case 0:
          $this->bbcode_cache[$bbcode_id] = array(
            'str' => array(
              '[/quote:$uid]'    => $this->bbcode_tpl('quote_close', $bbcode_id)
            ),
            'preg' => array(
              '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise'    => "\$this->bbcode_second_pass_quote('\$1', '\$2')"
            )
          );
        break; 
Replace with:

Code: Select all

    foreach ($bbcode_ids as $bbcode_id)
    {
      switch ($bbcode_id)
      {
        case 0:
          $this->bbcode_cache[$bbcode_id] = array(
            /*** 2013-02-14 BEGIN AmigoJack
              http://www.phpbb.com/community/viewtopic.php?t=2171827 ***/
            /*'str' => array(
              '[/quote:$uid]'    => $this->bbcode_tpl('quote_close', $bbcode_id)
            ),
            'preg' => array(
              '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise'    => "\$this->bbcode_second_pass_quote('\$1', '\$2')"*/
            'preg' => array(
              '#\[(/?)quote(?:="(.*?)")?:$uid\]((?!\[/?quote(?:=".*?")?:$uid\]))?#ise'=> "\$this->bbcode_second_pass_quote('\$1', '\$2', '\$3')"
            /*** 2013-02-14 END ***/
            )
          );
        break; 
Find:

Code: Select all

  function bbcode_tpl_replace($tpl_name, $tpl)
  {
    global $user;

    static $replacements = array( 
After, add:

Code: Select all

      /*** 2013-02-14 BEGIN AmigoJack
        http://www.phpbb.com/community/viewtopic.php?t=2171827 ***/
      'quote_username_close'=> array( '{USERNAME}'=> '$1' ),
      /*** 2013-02-14 END ***/ 
Find:

Code: Select all

  function bbcode_second_pass_quote($username, $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);

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

    $quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote;

    return $quote;
  } 
Replace with:

Code: Select all

  /*** 2013-02-14 BEGIN AmigoJack
    http://www.phpbb.com/community/viewtopic.php?t=2171827 ***/
  /*function bbcode_second_pass_quote($username, $quote)*/
  var $aQuoteUsername= array();
  function bbcode_second_pass_quote($slash, $username, $quote)
  {
    if( $slash ) {
      $username= array_pop( $this-> aQuoteUsername );
      return $username? str_replace( '$1', $username, $this-> bbcode_tpl( 'quote_username_close' ) ): $this-> bbcode_tpl( 'quote_close' );
    }
    /*** 2013-02-14 END ***/

    // 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);

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

    /*** 2013-02-14 BEGIN AmigoJack
      http://www.phpbb.com/community/viewtopic.php?t=2171827 ***/
    array_push( $this-> aQuoteUsername, $username );

    //$quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote;
    $quote = $this-> bbcode_tpl( 'quote_open' ). $quote;
    /*** 2013-02-14 END ***/

    return $quote;
  } 
(for every style) Open /styles/*/template/bbcode.html and find (for prosilver in this example):

Code: Select all

<!-- BEGIN quote_username_open --><blockquote><div><cite>{USERNAME} {L_WROTE}:</cite><!-- END quote_username_open -->
Replace with:

Code: Select all

<!-- BEGIN quote_username_open --><blockquote><div><!-- END quote_username_open -->
Find:

Code: Select all

<!-- BEGIN quote_close --></div></blockquote><!-- END quote_close -->
After, add:

Code: Select all

<!-- BEGIN quote_username_close --><cite>{USERNAME} {L_WROTE}:</cite></div></blockquote><!-- END quote_username_close -->
Tested.
Last edited by AmigoJack on Thu Feb 21, 2013 6:43 am, edited 2 times in total.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: Move username under the quote

Post by Татьяна5 »

This is work:

Code: Select all

[quote="123456"]Это пример сообщения[/quote]
Image

This is don't work:

Code: Select all

[quote]11111111111111[/quote]
[quote="123456"]2222222222[/quote]
Image
User avatar
AmigoJack
Registered User
Posts: 5812
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Move username under the quote

Post by AmigoJack »

I only tested a lone quote and two nested quotes, not two serial quotes. I updated my post - you have to redo the 1st and 3rd modification instructions - this time I tested all three cases.
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
User avatar
Татьяна5
Registered User
Posts: 143
Joined: Wed Feb 13, 2013 5:30 pm
Name: Tatiana

Re: Move username under the quote

Post by Татьяна5 »

Thanks for the help

Russian text in nested quotes disappeared: fix 1 and fix 2
User avatar
AmigoJack
Registered User
Posts: 5812
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Move username under the quote

Post by AmigoJack »

That's a questionable fix. Instead, change

Code: Select all

              '#\[(/?)quote(?:="(.*?)")?:$uid\]((?!\[/?quote(?:=".*?")?:$uid\]).)?#ise'=> "\$this->bbcode_second_pass_quote('\$1', '\$2', '\$3')" 
into:

Code: Select all

              '#\[(/?)quote(?:="(.*?)")?:$uid\]((?!\[/?quote(?:=".*?")?:$uid\]))?#ise'=> "\$this->bbcode_second_pass_quote('\$1', '\$2', '\$3')" 
  • The worst thing about censorship is ███████████
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
Locked

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