Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by phumphries phumphries is offline
Developer Last Online: Aug 2014 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 08-09-2001 Last Update: Never Installs: 0
 
No support by the author.

This is an update to the hack that I released for vB1.1.3.

I don't know how many of you remember back to the old off-line reader dial up BBS days, but there was an option on many of those beasts to randomly add a "tag line" from a text file to your signature.

In showthread.php, find both occurances of:
PHP Code:
$postbits .= getpostbit($post); 
and add
PHP Code:
// begin TagLine Hack
    
$tagsignature $post[signature];
    
$tagline "\\[tagline]";
    
$tagpostid $post[postid];
    if (
eregi($tagline,$tagsignature)) {
    
//don't want the signature cache anymore (only the first postid would be processed!)
        
unset($sigcache);
    
// create an array holding the signature components
        
$tags split($tagline,$tagsignature);
    
// output the first segment, which will be the signature line plus the constant signature
        
$tagsignature $tags[0];
    
// add the tag according to the mod of the postid
        
$tagcount count($tags)-1;
        if (
$tagcount 0) {
            
$tagid = ($tagpostid $tagcount) + 1;
            
$tagsignature .= $tags[$tagid];
        }
    }
    
$post[signature] = $tagsignature;
// end TagLine Hack 
right before it (in both places -- just in case you ever use the showpost routine).

In printthread.php, find:
PHP Code:

      
if (!isset($sigcache["$post[userid]"])) {
        
$post[signature]=bbcodeparse($post[signature],0,$allowsmilies);
        eval(
"\\$post[signature] = \\"".gettemplate("postbit_signature")."\\";");
        
$sigcache["$post[userid]"] = $post[signature];
      } else {
        
$post[signature] = $sigcache["$post[userid]"];
      } 
and replace it with:
PHP Code:

    
// begin TagLine Hack
        
$tagsignature $post[signature];
        
$tagline "\\[tagline]";
        
$tagpostid $post[postid];
        if (
eregi($tagline,$tagsignature)) {
        
//don't want the signature cache anymore (only the first postid would be processed!)
            
unset($sigcache);
        
// create an array holding the signature components
            
$tags split($tagline,$tagsignature);
        
// output the first segment, which will be the signature line plus the constant signature
            
$tagsignature $tags[0];
        
// add the tag according to the mod of the postid
            
$tagcount count($tags)-1;
            if (
$tagcount 0) {
                
$tagid = ($tagpostid $tagcount) + 1;
                
$tagsignature .= $tags[$tagid];
            }
        }
        
$post[signature] = bbcodeparse($tagsignature,0,$allowsmilies);
        eval(
"\\$post[signature] = \\"".gettemplate("postbit_signature")."\\";");
    
// end TagLine Hack 
This eliminates caching of the signatures at the same time as processing the tag lines. Make sure that you do not replace any part of the surrounding if statement, which puts a blank signature on posts that do not meet the requirements.

In newreply.php and newthread.php, find
PHP Code:
    if ($signature) {
      
$post['signature'] = bbcodeparse($bbuserinfo['signature'],0,$allowsmilie);
      eval(
"\$post[signature] = \"".gettemplate("postbit_signature")."\";");
      
$previewmessage.=$post['signature'];
    } 
and change it to
PHP Code:
    if ($signature) {
      
$post['signature'] = bbcodeparse($bbuserinfo['signature'],0,$allowsmilie);

    
// begin TagLine Hack
        
$tagsignature $post['signature'];
        
$tagline "\\[tagline]";
        if (
eregi($tagline,$tagsignature)) {
        
// create an array holding the signature components
            
$tags split($tagline,$tagsignature);
        
// output the first segment, which will be the signature line plus the constant signature
            
$tagsignature $tags[0];
        
// don't show any taglines in Preview mode
        
}
        
$post['signature'] = $tagsignature;
    
// end TagLine Hack

      
eval("\$post[signature] = \"".gettemplate("postbit_signature")."\";");
      
$previewmessage.=$post['signature'];
    } 
In private.php, find
PHP Code:
    if ($message[showsignature] and $allowsignatures and trim($post[signature])!="") {
      
$post[signature]=bbcodeparse($post[signature],0,$allowsmilies);
      eval(
"\$post[signature] = \"".gettemplate("postbit_signature")."\";");
    } else {
      
$post[signature] = "";
    } 
and change it to
PHP Code:
    if ($message[showsignature] and $allowsignatures and trim($post[signature])!="") {
      
$post[signature]=bbcodeparse($post[signature],0,$allowsmilies);

    
// begin TagLine Hack
        
$tagsignature $post['signature'];
        
$tagline "\\[tagline]";
        if (
eregi($tagline,$tagsignature)) {
        
// create an array holding the signature components
            
$tags split($tagline,$tagsignature);
        
// output the first segment, which will be the signature line plus the constant signature
            
$tagsignature $tags[0];
        
// add the tag according to the mod of the postid
            
$tagcount count($tags)-1;
            if (
$tagcount 0) {
                
$tagid = ($privatemessageid $tagcount) + 1;
                
$tagsignature .= $tags[$tagid];
            }
        }
        
$post['signature'] = $tagsignature;
    
// end TagLine Hack

      
eval("\$post[signature] = \"".gettemplate("postbit_signature")."\";");
    } else {
      
$post[signature] = "";
    } 
The newthread.php and newreply.php changes are subtly different from the showthread.php and private.php changes because those routines handle the signature a little differently. I decided not to show the tag line in the "preview" as the tag is supposed to be psuedo random and actually will change as new tags are added to the signature, any way.

So, how does it work? After installing the three modifications above, you change your signature from
Quote:
My Sig
to
Quote:
My Sig
[tagline]
My first tag.
[tagline]
My second tag.
[tagline]
My third tag.
It can be multiple lines, too.
[tagline]
&c
When a post is displayed, the showthread.php routine you modified, above, checks the user's signature for the [tagline] keyword (which you can change -- see the code), and selects, based on the index number of the post, a tag line from any number that have been entered by the user. Users who do not add tag lines to their signatures are unaffected. If you have some tag lines and never change them, the effect is that your posts display different tag lines but always the same one for each individual post. If you change or add tag lines, the modulus operation shifts them all around. The other way to implement this would be to use the random number function in PHP, but the described effect is the one that I was after (not completely random).

You can quickly test it out by just applying the showthread.php modification. This is also a good way to see in the "Preview" mode what your signature variable is outputing before it gets "arrayed" by the PHP code.

And, you can use vB Code in your tag lines so that you can even have rotating links to important messages as per eva2000's tip in another forum.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-11-2001, 05:05 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the "&c" at the end of your new signature example...is it important?
Reply With Quote
  #3  
Old 08-11-2001, 05:28 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I've tried it exactly as you have it here. But even though nobody on my board, including myself, has [tagline] in their signatures, everybody's signatures were showing up totally wrong.

Here's a screenshot from before I did this hack:


And here's a shot from after I did this hack:


See the differences in the three signatures you can see.
Reply With Quote
  #4  
Old 08-11-2001, 06:59 PM
valid
Guest
 
Posts: n/a
Default

nice idea but it dosent work at all!

http://vbulletin.com/forum/showthrea...threadid=25056
Reply With Quote
  #5  
Old 08-12-2001, 10:31 PM
phumphries's Avatar
phumphries phumphries is offline
 
Join Date: Nov 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very drole, valid. It is working fine on my board!

JJR512, I can only suggest that you try making just the showthread.php change, maybe just in the Show Thread part of the routine ("$postbits .= getpostbit($post);" at line 396 in an unhacked version). My code goes just before that so that the $post[signature] variable is modified before calling the templates.

If "[tagline]" does not appear in your signature's text, the only "action" that is taken is to copy $post[signature] to $tagsignature and back again. If this is not working, perhaps you have a magicquotes problem on your PHP install (just guessing, although the third signature in your example does not have any quotes in it).

The &c in my example means "etcetera" or "just keep going until you get bored adding new tag lines."
Reply With Quote
  #6  
Old 08-12-2001, 11:58 PM
valid
Guest
 
Posts: n/a
Default

did what you said, its not working at all, I got what JJR512 got, vb2.0.3!

sucks!
Reply With Quote
  #7  
Old 08-14-2001, 03:03 PM
phumphries's Avatar
phumphries phumphries is offline
 
Join Date: Nov 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, guys. It never occurred to me that anyone would cut and paste from the displayed message. I always use the Quote option, then cut and paste from there to avoid any formatting problems.

Attached is a text file with the instructions. I have also edited the original post to properly display the "\[tagline]" entries, which is what was causing JJR512's problem. Entered as just "[tagline]" he was executing the eregi command on the seven letters "t" "a" "g" "l" "i" "n" and "e" rather than on the string "[tagline]" as it should have.

Of course, anyone who uses the quote option to cut and paste will have bad code, now. I had a look through the bugs and troubleshooting forums and found this message indicating that this slash parsing problem is a PHP bug. So, in future, I will try to catch that and make a note for readers.

My humble thanks for your gently worded constructive feedback.
Reply With Quote
  #8  
Old 10-11-2001, 03:34 PM
phumphries's Avatar
phumphries phumphries is offline
 
Join Date: Nov 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I discovered a little bug in this routine.

Because showthread uses the sigcache, only the tag line corresponding to a user's first post would be displayed, even though a new signature is generated each time through. So, the routine now disables sigcache if it is processing a tag line.

I also changed the code that pulls postbit.

The only file affected if you have already implemented this hack is showthread.php. Just replace the two tag line hack sections with the new code.

I updated both the instructions in the first post and the attached instructions in the post before this one.
Reply With Quote
  #9  
Old 10-11-2001, 04:17 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I remember in the original version in the printable version it would show the entire sig (tagline tag and all), does it still do this and is there any way around it?
Reply With Quote
  #10  
Old 10-11-2001, 07:36 PM
phumphries's Avatar
phumphries phumphries is offline
 
Join Date: Nov 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your question, Bane. I did not realize that it did this as I have never actually used printthread.php on my board!

I have updated the instructions in the first post as well as the downloadable text instructions.

Let me know if you have any problems. It seems to work well on my board. The only "stretch" is that my hack eliminates any signature caching, which is probably a very small thing relative to the amount of processing that is going on to extract the tag lines!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.13601 seconds
  • Memory Usage 2,363KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (8)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (8)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete