08-30-2000, 06:02 PM
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. Well, I thought of this the other evening, and here is the vB implementation:
In showthread.php, find:$signature= "\n__________________\n$userinfo[signature]";and add
// begin TagLine Hack
$tagline = "\[tagline]";
if (eregi($tagline,$signature)) {
// create an array holding the signature components
$tags = split($tagline,$signature);
// output the first segment, which will be the signature line plus the constant signature
$signature = $tags[0];
// add the tag according to the mod of the postid
$tagcount = count($tags)-1;
if ($tagcount > 0) {
$tagid = ($postid % $tagcount) + 1;
$signature .= $tags[$tagid];
}
}
// end TagLine Hack
on the next line, before the } else { statement.
In newreply.php, find if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
$previewmessage.=bbcodeparse("\n__________________\n$getsig[signature]",0,$allowsmilies);
}and change it to if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
// begin TagLine Hack
$tagline = "\[tagline]";
$tagsignature = $getsig[signature];
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
}
// end TagLine Hack
$previewmessage.=bbcodeparse("\n__________________\n$tagsignature",0,$allowsmilies);
}
In newthread.php, find if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
$previewmessage.=bbcodeparse("\n__________________\n$getsig[signature]",0,$allowsmilies);
}and change it to if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
// begin TagLine Hack
$tagline = "\[tagline]";
$tagsignature = $getsig[signature];
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
}
// end TagLine Hack
$previewmessage.=bbcodeparse("\n__________________\n$tagsignature",0,$allowsmilies);
}The newthread.php and newreply.php changes are subtly different from the showthread.php change 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 fromMy SigtoMy Sig
[tagline]
My first tag.
[tagline]
My second tag.
[tagline]
My third tag.
It can be multiple lines, too.
[tagline]
&cWhen 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 (http://www.vbulletin.com/forum/index.php?action=bbcode) in your tag lines so that you can even have rotating links to important messages as per eva2000's tip (http://www.vbulletin.com/forum/showthread.php?threadid=2259) in another forum.
In showthread.php, find:$signature= "\n__________________\n$userinfo[signature]";and add
// begin TagLine Hack
$tagline = "\[tagline]";
if (eregi($tagline,$signature)) {
// create an array holding the signature components
$tags = split($tagline,$signature);
// output the first segment, which will be the signature line plus the constant signature
$signature = $tags[0];
// add the tag according to the mod of the postid
$tagcount = count($tags)-1;
if ($tagcount > 0) {
$tagid = ($postid % $tagcount) + 1;
$signature .= $tags[$tagid];
}
}
// end TagLine Hack
on the next line, before the } else { statement.
In newreply.php, find if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
$previewmessage.=bbcodeparse("\n__________________\n$getsig[signature]",0,$allowsmilies);
}and change it to if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
// begin TagLine Hack
$tagline = "\[tagline]";
$tagsignature = $getsig[signature];
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
}
// end TagLine Hack
$previewmessage.=bbcodeparse("\n__________________\n$tagsignature",0,$allowsmilies);
}
In newthread.php, find if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
$previewmessage.=bbcodeparse("\n__________________\n$getsig[signature]",0,$allowsmilies);
}and change it to if ($signature==1) {
$getsig=$DB_site->query_first("SELECT signature FROM user WHERE userid=$userid");
// begin TagLine Hack
$tagline = "\[tagline]";
$tagsignature = $getsig[signature];
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
}
// end TagLine Hack
$previewmessage.=bbcodeparse("\n__________________\n$tagsignature",0,$allowsmilies);
}The newthread.php and newreply.php changes are subtly different from the showthread.php change 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 fromMy SigtoMy Sig
[tagline]
My first tag.
[tagline]
My second tag.
[tagline]
My third tag.
It can be multiple lines, too.
[tagline]
&cWhen 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 (http://www.vbulletin.com/forum/index.php?action=bbcode) in your tag lines so that you can even have rotating links to important messages as per eva2000's tip (http://www.vbulletin.com/forum/showthread.php?threadid=2259) in another forum.