[Snippet] Signature parsing in posting review V1 + V2

Little Mods and Snips 2

[Snippet] Signature parsing in posting review V1 + V2

Postby Sekuro » 21 Apr 2012, 16:38

Signature parsing in posting review V1

V1: Basic version

With this snippet you see signatures in posting topic review under postbox

Credit: BNa
Credit: Code Inspiration by Perlchamp, posted here

Instruction

open

includes/functions_posting.php

find

Code: Select all
        'SELECT'    => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe',


replace with

Code: Select all
        'SELECT'    => 'u.username, u.user_id, u.user_colour, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield, p.*, z.friend, z.foe',


find

Code: Select all
    $bbcode_bitfield = '';


after add

Code: Select all
    // Signature parsing in posting review / BNa / 2012
    $sig_bbcode_bitfield = '';
    // Signature parsing in posting review / BNa / 2012        


find

Code: Select all
        $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);


after add

Code: Select all
        // Signature parsing in posting review / BNa / 2012
        $sig_bbcode_bitfield = $sig_bbcode_bitfield | base64_decode($row['user_sig_bbcode_bitfield']);
        // Signature parsing in posting review / BNa / 2012        


find

Code: Select all
        $bbcode = new bbcode(base64_encode($bbcode_bitfield)); 


after add

Code: Select all
        // Signature parsing in posting review / BNa / 2012
        $sig_bbcode = new bbcode(base64_encode($sig_bbcode_bitfield));
        // Signature parsing in posting review / BNa / 2012      


find

Code: Select all
    // Grab extensions
    $extensions = $attachments = array();


before add

Code: Select all
    // Signature parsing in posting review / BNa / 2012
    // Instantiate Sig BBCode Class
    if (!isset($bbcode) && $sig_bbcode_bitfield !== '')
    {
        include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
        $sig_bbcode = new bbcode(base64_encode($sig_bbcode_bitfield));        
    
}
    // Signature parsing in posting review / BNa / 2012        


find

Code: Select all
        $message        = censor_text($row['post_text']);


after add

Code: Select all
        // Signature parsing in posting review / BNa / 2012
        $prev_signature = censor_text($row['user_sig']);
        // Signature parsing in posting review / BNa / 2012            


find

Code: Select all
        $message = smiley_text($message, !$row['enable_smilies']);


after add

Code: Select all
        // Signature parsing in posting review / BNa / 2012        
        if ($row['user_sig_bbcode_bitfield'])
        {
            $sig_bbcode->bbcode_second_pass($prev_signature, $row['user_sig_bbcode_uid'], $row['user_sig_bbcode_bitfield']);
        }        

        $prev_signature 
= bbcode_nl2br($prev_signature);
        $prev_signature = smiley_text($prev_signature);
        // Signature parsing in posting review / BNa / 2012            


find

Code: Select all
            'DECODED_MESSAGE'    => $decoded_message,


after add

Code: Select all
            // Signature parsing in posting review / BNa / 2012
            'PREV_SIGNATURE'    => $prev_signature,
            // Signature parsing in posting review / BNa / 2012                       


open

styles/prosilver/template/posting_review.html

find

Code: Select all
            <div class="content">{post_review_row.MESSAGE}</div>


after add

Code: Select all
             <!-- IF post_review_row.PREV_SIGNATURE --><div id="sig{post_review_row.POST_ID}" class="signature">{post_review_row.PREV_SIGNATURE}</div><!-- ENDIF -->


open

styles/prosilver/template/posting_topic_review.html

find

Code: Select all
            <div class="content">{topic_review_row.MESSAGE}</div>


after add

Code: Select all
             <!-- IF topic_review_row.PREV_SIGNATURE --><div id="sig{topic_review_row.POST_ID}" class="signature">{topic_review_row.PREV_SIGNATURE}</div><!-- ENDIF -->


clear all board-, template, style and browser-caches
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Re: [Snippet] Signature parsing in posting review

Postby Sekuro » 23 Apr 2012, 01:03

Signature parsing in posting review V2

V2: Use this version, if you have any problems with V1

With this snippet you see signatures in posting topic review under postbox

Credit: BNa

Instruction

open

includes/functions_posting.php

find

Code: Select all
        'SELECT'    => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe',


replace with

Code: Select all
        'SELECT'    => 'u.username, u.user_id, u.user_colour, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield, p.*, z.friend, z.foe',


find

Code: Select all
        $template->assign_block_vars($mode . '_row', array(


before add

Code: Select all
    // Signature parsing in posting review / BNa / 2012
    if (!empty($row['user_sig']))
    {
        $row['user_sig'] = censor_text($row['user_sig']);

        if ($row['user_sig_bbcode_bitfield'])
        {
        
        $bbcode_options 
= (($row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) +
        (($row['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + 
        
(($row['enable_magic_url']) ? OPTION_FLAG_LINKS : 0);
    
        $row
['user_sig'] = generate_text_for_display($row['user_sig'], $row['user_sig_bbcode_uid'], $row['user_sig_bbcode_bitfield'], $bbcode_options);        
        
}
    }
    // Signature parsing in posting review / BNa / 2012          


find

Code: Select all
            'DECODED_MESSAGE'    => $decoded_message,


after add

Code: Select all
            // Signature parsing in posting review / BNa / 2012
            'PREV_SIGNATURE'    => censor_text($row['user_sig']),
            // Signature parsing in posting review / BNa / 2012                 


open

styles/prosilver/template/posting_review.html

find

Code: Select all
            <div class="content">{post_review_row.MESSAGE}</div>


after add

Code: Select all
             <!-- IF post_review_row.PREV_SIGNATURE --><div id="sig{post_review_row.POST_ID}" class="signature">{post_review_row.PREV_SIGNATURE}</div><!-- ENDIF -->


open

styles/prosilver/template/posting_topic_review.html

find

Code: Select all
            <div class="content">{topic_review_row.MESSAGE}</div>


after add

Code: Select all
             <!-- IF topic_review_row.PREV_SIGNATURE --><div id="sig{topic_review_row.POST_ID}" class="signature">{topic_review_row.PREV_SIGNATURE}</div><!-- ENDIF -->


clear all board-, template, style and browser-caches
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Return to Snip Cl@ss II

Who is online

Users browsing this forum: No registered users and 1 guest

cron