PDA

View Full Version : Admin Signatures Parsed for vB Variables: by Logician


Neutral Singh
05-22-2005, 10:00 PM
Logician Hack : Admin signatures parsed for vb variables

Version 1.01 changes explained in the End of this post.

As the thread name suggests, credit for this cute little modification belongs to Logician, the gr8 vB Magician, who distributes hacks without even taking a credit for them. :)

Requested by: Myself :devious: --> here (https://vborg.vbsupport.ru/showthread.php?t=81759)



Context
Searched through all vb.org website for this nature of hack and anything that visually comes near to this modification is /you /me hack but that hack did not suit my requirement. I wanted to show any vb variable of my liking in the signatures and this little modification by Logician does exactly the same and is much more dynamic... Any resemblance to my other hack is surely coincidental.

What this hack does ?
Pretty simple, this modification is only for Admin's signatures, which parses the admin signatures for all vb variables and presents it into a readable information. ;)

Utility:
For example: i, as an admin, want my signatures to a show personalised message for members as follows:

Dear [Aman Singh], if you like spending your time at these forums then please consider making a donation. [more details here...]

Now, here the [membername] is dynamic and should change accordingly to every user who is reading the message in my signatures. After the modification, to achieve the above signatures, i enter the following information in my signatures:

Dear $bbuserinfo[username], if you like spending your time at these forums then please consider making a donation. [more details here...]

This mod makes the vb variable $bbuserinfo[username] dynamically change for each username to make the message a lot more personalised and more appealing. (and who knows someone might get encouraged to shell out a buck or two ;) )

Some of useful vB variables are listed below:

$bbuserinfo[username] : Username of the visitor
$bbuserinfo[email] : email of the visitor
$bbuserinfo[icq] : icq number of the visitor
$bbuserinfo[aim] : aim nick of the visitor
$bbuserinfo[yahoo] : yahoo id of the visitor
$bbuserinfo[posts] : Post count of the visitor
$bbuserinfo[homepage] : Home page of the visitor
$bbuserinfo[field1] : Value of user profile 1 of the visitor
$bbuserinfo[field2] : Value of user profile 2 of the visitor
$bbuserinfo[field3] : Value of user profile 3 of the visitor
$bbuserinfo[joindate]
$bbuserinfo[lastvisit]
$bbuserinfo[lastactivity]
$bbuserinfo[lastpost]
$bbuserinfo[reputation]
$bbuserinfo[pmtotal]
$bbuserinfo[pmunread]
$bbuserinfo[lastvisitdate]

(List compiled from gr8 WebTemplates Content Management System by Logician --> here (https://vborg.vbsupport.ru/showthread.php?t=76422&highlight=WebTemplates)) and kind help by Zero Tolerance :)

File Edits : Two

Files to Edit :
i) forum_root/includes/functions_showthread.php
ii) forum_root/member.php

Difficulty : Still, one of the easiest hacks ever.

Installation Time : Now it takes less than 3 mintues to apply the hack.

Instructions :



Edit includes/functions_showthread.php

FIND
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$post['signature'] = parse_bbcode($post['signature'], 'nonforum', $vboptions['allowsmilies']);
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ADD BELOW:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Logician Hack : Admin signatures parsed for vb variables
if ($post['usergroupid']==6)
{
@eval('$post[signature] = "' . addslashes($post['signature']) . '";');
$post['signature'] = stripslashes($post['signature']);
}
// Logician Hack : Admin signatures parsed for vb variables
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

That's all. ;)

Logician \\=^))




Modificaton done by Aurous --> here (https://vborg.vbsupport.ru/showpost.php?p=657829&postcount=8)
This mod helps in parsing the signatures properly in member profiles.

In member.php:

Search for:

// signature
if ($userinfo['signature'])
{
require_once('./includes/functions_bbcodeparse.php');


Below, add this code:


// Logician Hack : Admin signatures parsed for vb variables
if ($userinfo['usergroupid']==6)
{
@eval('$userinfo[signature] = "' . addslashes($userinfo['signature']) . '";');
$userinfo['signature'] = stripslashes($userinfo['signature']);
}
// Logician Hack : Admin signatures parsed for vb variables


Versions Changes:

1.01 : Added modification by Aurous at post#8, this helps properly parsing the signatures in member profiles as well. Thanks Aurous. ;)
1.00 : Released

Instructions are attached herewith.
The snapshot is attached herewith.

Hey You!! Dont Forget to hit INSTALL !! ;)
Enjoy !!
Aman Singh

Polo
05-23-2005, 12:50 PM
Nice, thank you :)

FightRice.com
05-23-2005, 03:14 PM
Is there a list of the $bb variables we can use with this hack...

*Installed

swantonio
05-23-2005, 04:57 PM
*Installed

jugo
05-23-2005, 05:52 PM
/me installs.....And starts to ponder quirky little games to play with board members...heh heh heh!!!

Thanks.

Neutral Singh
05-24-2005, 04:18 AM
Is there a list of the $bb variables we can use with this hack...

Yes, added some useful variables in the first post above. :)

**Please be aware that some of variables may display information only if that field has been filled in by the members like e.g. AIM, ICQ, YAHOO **

Enjoy !!

bigcurt
05-24-2005, 04:38 AM
Very, VERY nice. Congrats 2 both.

Aurous
05-24-2005, 09:21 PM
people can see the code in profile :p here's an easy fix for that

In member.php:

Search for:

// signature
if ($userinfo['signature'])
{
require_once('./includes/functions_bbcodeparse.php');


Below, add this code:


if ($userinfo['usergroupid']==6)
{
@eval('$userinfo[signature] = "' . addslashes($userinfo['signature']) . '";');
$userinfo['signature'] = stripslashes($userinfo['signature']);
}

Neutral Singh
05-25-2005, 12:39 AM
Oh Yes!! :devious: Thanks a lot for enhancing the integrity of the hack. I have updated the first post with due credits to your modification. :)

Enjoy !!

yinyang
05-25-2005, 05:11 AM
*clicks install*

this is awesome. is there a place where i can get the complete list of vB variables?

Neutral Singh
05-25-2005, 11:17 AM
is there a place where i can get the complete list of vB variables?

mmmmmm... nope !! i dont think so ...

Zero Tolerance
05-25-2005, 11:22 AM
$bbuserinfo contains a lot of information, if you make a file in your forums directory called "test.php", and put this code in it:

<?php
require_once("./global.php");
print_r($bbuserinfo);
?>

Then visit this file in your browser, you will see a load of mumbo jumbo, right click, view source, you will get a lot of stuff, like:
Array
(
[userid] => 1
[temp] =>
[field1] => I like to code :P
[field2] => England
[field3] => Coding...
[field4] => ...more coding
[field5] => Male
[field6] => #0099FF

To use this field, just put $bbuserinfo[FIELD]

So if you see:
[myfield] => Bla bla
You would use:
$bbuserinfo[myfield]

:)

- Zero Tolerance

yinyang
05-25-2005, 10:31 PM
$bbuserinfo contains a lot of information, if you make a file in your forums directory called "test.php", and put this code in it:

<?php
require_once("./global.php");
print_r($bbuserinfo);
?>

Then visit this file in your browser, you will see a load of mumbo jumbo, right click, view source, you will get a lot of stuff, like:


To use this field, just put $bbuserinfo[FIELD]

So if you see:
[myfield] => Bla bla
You would use:
$bbuserinfo[myfield]

:)

- Zero Tolerance

thanks! that was awesome and so much info. for others who may find it also useful, i have found the following bbuserinfo's helpful as well:

$bbuserinfo[joindate]
$bbuserinfo[lastvisit]
$bbuserinfo[lastactivity]
$bbuserinfo[lastpost]
$bbuserinfo[reputation]
$bbuserinfo[pmtotal]
$bbuserinfo[pmunread]
$bbuserinfo[lastvisitdate]

*edit*
actually, don't use anything with dates as they show up as really long numbers.

Zero Tolerance
05-26-2005, 12:55 PM
Yeah the date's show up as unix timestamps, i suppose additional code could be added to parse them into text format :)

- Zero Tolerance

COBRAws
05-27-2005, 01:13 PM
im gonna have fun with this one with my members hehehe

supernet33
06-05-2005, 08:30 PM
I installed this, and it works fine in all the admins except for one? Could it be some permissions?

Neutral Singh
06-06-2005, 04:36 AM
Yes, i think the user should be a member of Administrator (id: 6) Usergroup.

Hoang Tu Ao Den
06-26-2005, 08:01 PM
Installed ! Can I have more than one usergroups ?

Neutral Singh
06-30-2005, 04:30 AM
Installed ! Can I have more than one usergroups ?

Edit includes/functions_showthread.php

FIND
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$post['signature'] = parse_bbcode($post['signature'], 'nonforum', $vboptions['allowsmilies']);
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ADD BELOW:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Logician Hack : Admin signatures parsed for vb variables
if ($post['usergroupid']==6)
{
@eval('$post[signature] = "' . addslashes($post['signature']) . '";');
$post['signature'] = stripslashes($post['signature']);
}
// Logician Hack : Admin signatures parsed for vb variables
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

JUST BELOW THE ABOVE CODE, ADD:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Logician Hack : Admin signatures parsed for vb variables
if ($post['usergroupid']==2)
{
@eval('$post[signature] = "' . addslashes($post['signature']) . '";');
$post['signature'] = stripslashes($post['signature']);
}
// Logician Hack : Admin signatures parsed for vb variables
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

(Notice the change in above code --> if ($post['usergroupid']==2). You can do it for each usergroupid, separately. :)

Enjoy !!

Hoang Tu Ao Den
07-02-2005, 09:43 PM
Thank you !

yinyang
07-12-2005, 02:35 PM
can this be ported to vb3.5?

Kirk Y
07-20-2005, 03:53 AM
Edit includes/functions_showthread.php

FIND
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$post['signature'] = parse_bbcode($post['signature'], 'nonforum', $vboptions['allowsmilies']);
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ADD BELOW:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Logician Hack : Admin signatures parsed for vb variables
if ($post['usergroupid']==6)
{
@eval('$post[signature] = "' . addslashes($post['signature']) . '";');
$post['signature'] = stripslashes($post['signature']);
}
// Logician Hack : Admin signatures parsed for vb variables
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

JUST BELOW THE ABOVE CODE, ADD:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Logician Hack : Admin signatures parsed for vb variables
if ($post['usergroupid']==2)
{
@eval('$post[signature] = "' . addslashes($post['signature']) . '";');
$post['signature'] = stripslashes($post['signature']);
}
// Logician Hack : Admin signatures parsed for vb variables
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

(Notice the change in above code --> if ($post['usergroupid']==2). You can do it for each usergroupid, separately. :)

Enjoy !!

Couldn't you just do "if ($post['usergroupid']==2 OR 6)"? I don't know exactly how the OR thing works, but I know it can be used in a fashion similar to that, atleast that way you wouldn't need to repeat the entire code addition. Oh and by the way, great hack!

sketch42
08-02-2005, 10:46 AM
can this be done for posts??

sketch42
08-05-2005, 05:01 AM
one request can we get it so when you preview your sig you can see it as it should be seen by the users?

sketch42
08-05-2005, 06:26 PM
this
Hey $bbuserinfo[username] i see you havent been on since $bbuserinfo[lastactivity] , have you read the Rules Lately (http://www.wirelessolution.net/showthread.php?goto=newpost&t=7).


returns this... any ideas?
Hey sketch42 i see you havent been on since 1123269876 , have you read the Rules Lately.

ciocsy
08-05-2005, 10:11 PM
thanks, it worked like a charm!

Neutral Singh
09-02-2005, 09:07 AM
one request can we get it so when you preview your sig you can see it as it should be seen by the users?

Imagine your member's name instead of yours and thats what your members would see in your signatures. ;)

MThornback
11-14-2005, 10:16 PM
Is this going to be ported? *looks hopefully*

goodwillstacy
02-08-2006, 04:42 PM
I would also love if this was ported. It really increased the number of donations I got.
stacy