PDA

View Full Version : Custom Postbit for every User


Xenon
18 Sep 2002, 12:56
After the one Day Beta-Version i've finished the Hack so i can release it now.

Hack Version: 1.20b

Additional Queries in showthread.php: 1

What it does: It gives users the Ability to choose between custom postbits instead of just the one global postbit (or more if you have different styles).
Also it allows users to create their own custom postbits using html-code (These must be validated by an admin before they can use them)
It also gives you the ability to create a postbit just a special usergroup or just a special user can use.

I think i've tested every little option, but if you find a bug please tell me.

Please click install if you use the hack.

Some additions:
in cpostbit.php you find this lines to allow users wether to choose a custom postbit or to create new ones:
// Usergroups which can use custom postbits
$canusecpb="2 5 7 6";
// Usergroups which can create own custom postbits
$cancreatecpb="2 5 7 6";

people who installed the beta version should run installcpb.php?action=unstall&killbeta=1 before installing the hack.


Enjoy
screenshots following

Xenon
18 Sep 2002, 12:57
admin overview

Xenon
18 Sep 2002, 12:57
validate screen

Xenon
18 Sep 2002, 12:58
preview of an unvalidatet postbit + editscreen

Xenon
18 Sep 2002, 12:59
user choose postbit screen

Xenon
18 Sep 2002, 12:59
user add custom postbit

Xenon
18 Sep 2002, 13:00
thread view with different postbits

MarkB
18 Sep 2002, 14:18
I'd be interested in seeing this in action on a live forum (and people's reactions to it:))!

Velocd
18 Sep 2002, 17:11
Wow..this is different than what I thought it was initially, but still looks cool. I thought it would be just like choosing other styles, but postbits for each style.

Anyway, still cool ;)

Vile
18 Sep 2002, 20:02
Ooh, this looks sweet.
Thanks :)

Mystislav
19 Sep 2002, 01:40
Wow, that would end up being pretty complicated but it's cool.

Link14716
19 Sep 2002, 02:13
I installed it, and all is fine but on the cpostbit.php page AND on the admin cpostbit page, the preview just shows the postbit template no matter what the postbit is. Any fix?

Colon33
19 Sep 2002, 07:23
Hey, Like i was saying in the BETA forum. Its not a good idea unless you trust a user to know his HTML well. i mean very well.

You can trust a user not too mess it up on purpose but what happens when they completely botch a customizing job and really screw over your forums for awhile? It has nothing to do with trust people make mistakes. Maybe you should release a version of this where people can change the location and whats displayed but the HTML is SET. Its too much of a risk allowing people to do there own HTML work.


But the idea itself is a great mod to a VB... just i think its way to risky.

Xenon
19 Sep 2002, 10:32
colon i think you didn't understand my hack....
a user cannot use a selfmade custom postbit until it has been validatet by an admin, so the risky thing is that you as an admin would oversee anything...

@Link: Are you sure you have applied the changes to functions.php correctly?
because here at my testboard everything works fine

Xenon
19 Sep 2002, 10:33
Mystislav, please go to this (http://www.vbulletin.com/members/vbulletin.org.php) page and enter your username, to show you are licensed. (you will need to use your customer number and password to access that page)
Thank you.


oh and no it's not so complicated as it looks now ;)

Xenon
19 Sep 2002, 15:28
damn triplepost ^^

ok i've released version 1.20
no new features are added but i'd say all of you should update, because it'll reduce query ammount alot (if a user hast posted twice on a page just one query is needed now)

upgradeinfos: you have just to apply the changes in functions.php
then you should apply the changes to showthread.php

and then at the end of getpostbit function apply the changes you can see in cpostbit.txt


With this new Version the query-count increases just by 1 instead of 15 (or how much post per page you had)

vdinh
19 Sep 2002, 23:24
Hi Xenon,
Great hack :) ...

In your version 1.20 instruction:


Step 6: edit admin/index.php
----------------------------
after:
if ($moderatenewmembers==1 or $usecoppa==1) {
$waiting=$DB_site->query_first("SELECT COUNT(*) AS users FROM user WHERE usergroupid=4");
if ($waiting[users]==0) {
echo "<font size='1'>There are currently $waiting[users] user(s) awaiting <a href=\"user.php?s=$session[sessionhash]&action=moderate\">moderation</a>.</font>";
} else {
echo "<b><a href=\"user.php?s=$session[sessionhash]&action=moderate\">There are currently $waiting[users] user(s) awaiting moderation</a>.</b>";
}
}

add:
$unvalid=$DB_site->query_first("SELECT COUNT(*) AS number FROM custompostbit WHERE validated=0");
echo "<br><a href=\"admincpb.php?s=$session[sessionhash]&action=validate\">There are currently ".$unvalid[number]." custom postbits to validate!</a><br><br>";

find:
// ***
makenavoption("New Posts","../mod/moderate.php?action=posts","<br>");
makenavoption("New Attachments","../mod/moderate.php?action=attachments");
makenavselect("Moderation","<hr>");

replace with:
// ***
makenavoption("New Posts","../mod/moderate.php?action=posts","<br>");
makenavoption("New Attachments","../mod/moderate.php?action=attachments");
makenavselect("Moderation");
// **
makenavoption("Add","admincpb?action=add","|");
makenavoption("View/Edit/Delete","admincpb?action=view","<br>");
makenavoption("Validate Postbits","admincpb?action=validate","<br>");
makenavselect("Custom Postbits","<hr>");


I think those lines need to add the .php extension before the question makrs :)

Xenon
20 Sep 2002, 13:22
huh?

yes you're right thank you....

but it also works without i think.. (i mean it worked here i just copied the lines out of my index.php) ;)

i've updated the instructions

vdinh
20 Sep 2002, 16:08
Hi Xenon,
I wonder if there is a way to, also, create separate postbit format for a member for each sub-forum. Suppose that my vBulletin forum got 3 rooms, can each of the 3 rooms carry a different postbit format for myself? Thanks.

Xenon
20 Sep 2002, 16:36
well if you've installed this hack you cann edit your showthread.php:
findwhile ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {

if ($postdone[$post[postid]]) {
$counter--;
continue;
} else {
$postdone[$post[postid]]=1;
}
$postbits .= getpostbit($post);
}

and replace with this:
while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) {

if ($postdone[$post[postid]]) {
$counter--;
continue;
} else {
$postdone[$post[postid]]=1;
}
$postbitid=0;
if($thread['forumid']==x and $post[userid]==y) $postbitid=z;
$postbits .= getpostbit($post,$postbitid);
}

that should do it

vdinh
20 Sep 2002, 16:55
Thanks a lot, Xenon! Finally I figured out what you meant :) It worked like a charm https://www.vbulletin.org/forum/external/2011/01/19.gif

Colon33
22 Sep 2002, 17:16
Originally posted by Xenon
colon i think you didn't understand my hack....
a user cannot use a selfmade custom postbit until it has been validatet by an admin, so the risky thing is that you as an admin would oversee anything...

@Link: Are you sure you have applied the changes to functions.php correctly?
because here at my testboard everything works fine


OK. i think i understand. I thought, that you had to validate a user before using it. Not the customization. In that case, its a little more safer. Just one question.

How bad does this lag a board? If at all.

Xenon
22 Sep 2002, 17:43
it adds just one query so the DB queries don't lag a board.
and if the users don't use foreign images then it doesn't lag a board..

Link14716
22 Sep 2002, 22:58
Ok, I figured it out. There was a part of futureal's arcade code in there, I had to switch the position of the code to get it to work ;)

wolfe
24 Sep 2002, 13:34
Xenon m8 is there a way i can make it not show the picture of the default post bit just a option user Default Postbit

and it will only show the pics of the custom postbit i made :D

Xenon
24 Sep 2002, 14:23
you have to edit cpostbit.php:
if($bbuserinfo[postbitid]!=0) {
$choosetext = "<input type=\"radio\" name=\"cpostbit\" value=\"0\"> Use standart";
$postbit=getpostbit($post,0);
eval("\$choosebits .= \"".gettemplate('cpostbit_choosebit')."\";");
}
not the finest way but try this:
if($bbuserinfo[postbitid]!=0) {
$choosetext = "<input type=\"radio\" name=\"cpostbit\" value=\"0\"> Use standart";
$postbit="";
eval("\$choosebits .= \"".gettemplate('cpostbit_choosebit')."\";");
}
that should do it

wolfe
24 Sep 2002, 14:34
also there is something wrong i have added a custom postbit

and it goes something like this


<br>
<table align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="15"><img src="{imagesfolder}/left.gif" border="0"></td>

<td align="center" background="{imagesfolder}/catbg.gif" width="887"><normalfont color="{categoryfontcolor}"><b>$post[title]</b></normalfont></td>

<td width="15"><img src="{imagesfolder}/right.gif" border="0"></td>
</tr>
</table>
<table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextra} width="{contenttablewidth}" align="center"><tr><td>

<DIV id="p$post[postid]h" style="display:$ph">
<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
<tr>
<td bgcolor="#CFCFCF" width="175" valign="top" nowrap>$plusimg <font size="4"><b>$post[username]</b></font><br>
$bigstars
$goldstars
$pips<br>
<smallfont>$post[usertitle]</smallfont></td>
<td bgcolor="#CFCFCF" width="100%" valign="top">
<table width="100% cellspacing="0" cellpadding="0" border="0">
<tr>
<td><smallfont>$post[icon] <b>$post[title]</b></smallfont></td>
<td align="right" nowrap><smallfont>$onlinestatus $post[foldericon] $post[postdate] <font color="{timecolor}">$post[posttime]</font></smallfont></td><td width="15%" align="right"> <smallfont>(Post# <a href="showthread.php?postid=$post[postid]#post$post[postid]"><smallfont>$countposts</smallfont></a>)</smallfont></td></tr></table><br><normalfont>$post[shortmsg]</normalfont>

</tr>
</table>
</DIV>

<DIV id="p$post[postid]e" style="display:$pe">

<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%"><tr>

<td bgcolor="#CFCFCF" width="175" valign="top" nowrap> <a name="post$post[postid]"></a>
<br>
<br>

<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="verdana,arial,helvetica" size="1"><B>Level: $level | Member ID: $post[userid]</b></font></p>

<p style="word-spacing: 0; margin-top: 0; margin-bottom: 0"><font face="verdana,arial,helvetica" size="1"><B>MP: $maxmp%</font></B></p><table border="1" cellpadding="0" cellspacing="0" width="90%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000"><tr><td width="100%"><img border="0" src="{imagesfolder}/bar1.gif" width="$maxmp%" height="9"></td> </tr></table><font face="verdana,arial,helvetica" size="1"><B>HP: $hp%</B><table border="1" cellpadding="0" cellspacing="0" width="90%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000"><tr><td width="100%"><img border="0" src="{imagesfolder}/bar2.gif" width="$hp%" height="9"></td> </tr></table><font face="verdana,arial,helvetica" size="1"><B>EXP: $exp%</b><table border="1" cellpadding="0" cellspacing="0" width="90%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000"><tr><td width="100%"><img border="0" src="{imagesfolder}/bar3.gif" width="$exp%" height="9"></td></tr></table><br>

<smallfont>
$awaymessage
Registered: $post[joindate]<br>
Location: $post[field2]<br>
Posts: $post[posts] <font color="#00FFFF">[$postsperday Per Day]</font><br>
Board Pounds: $post[storep] $donate<br>
Thread Views: $post[views]<br><br>
</smallfont></td>

<td bgcolor="CFCFCF" width="100%" valign="top">
<p><normalfont>$post[firstnewinsert]$minusimg <font size="4"><b>$post[username]</b></font><br>
$bigstars $goldstars $pips<br>
<smallfont>$post[usertitle]<br>
$post[avatar]<br>
<br>
<a href='timeonline.php?s=$session[sessionhash]&action=view_leader'><b>Time
Spent On This Board:</b></a><br>
$post[onlinetime] </smallfont></normalfont></p>
$post[attachment]
<p>$post[signature]</p>
<p>$post[editedby]</p>

<p align="right"><smallfont></smallfont></p>
<table border="0" width="100%">
<tr>
<td width="85%"> <smallfont>$post[icon] <b>$post[title] </b></smallfont></td>
<td width="15%" align="right"> <smallfont>(Post# <a href="showthread.php?postid=$post[postid]#post$post[postid]"><smallfont>$countposts</smallfont></a>)</smallfont></td>
</tr>
</table>
<p><br>
$post[message]</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p align="right"> <a href="report.php?s=$session[sessionhash]&postid=$post[postid]">Report
this post to a moderator</a> | $post[iplogged]<br>
$post[warnings]</p>
</td>
</tr><tr> <td bgcolor="#CFCFCF" width="175" height="16" nowrap><smallfont>$post[foldericon] $post[postdate] <font color="{timecolor}">$post[posttime]</font></smallfont></td> <td bgcolor="#CFCFCF" width="100%" valign="middle" height="16"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"><td><smallfont>$post[profile] $post[pmlink] $post[useremail] $post[homepage] $post[search] $post[buddy]$post[icqicon] $post[aimicon] $post[yahooicon] $post[msnicon]</smallfont></td><td align="right" nowrap><smallfont><a href="javascript:showwin('store.php?action=rate&postuserid=$post[userid]&postid=$post[postid]&postusername=$post[username]', 'width=550,height=250')"><img src="{imagesfolder}/storerate.gif" border="0" alt="Rate This Post"></a><a href="editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]"><img src="{imagesfolder}/edit.gif" border="0" alt="Edit/Delete Message"></a><a href="newreply.php?s=$session[sessionhash]&action=newreply&postid=$post[postid]"><img src="{imagesfolder}/quote.gif" border="0" alt="Reply w/Quote"></a></smallfont></td></tr>
</table>
</td></tr>
</table></td></tr>
</table>
</DIV>
<table align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center" width="15"><img src="{imagesfolder}/pbbleft.gif" border="0"></td>

<td align="center" background="{imagesfolder}/postbbg.gif" width="887"></td>

<td align="center" width="15"><img src="{imagesfolder}/pbbright.gif" border="0"></td>
</tr>
</table>


and it is just making the default one what comes with VBB i am using 2.2.7 also when i pick one i made it just still uses the default one i did on the board :( please help

wolfe
24 Sep 2002, 14:36
wtf it just added vbb.org where i had { imagesfolder }

Xenon
24 Sep 2002, 14:40
it shows the postbits correct on the chooserscreen?

be sure you have added correctly every single line to functions.php and showthread.php

normally everything should work, and it works on two of my test boards..

Mathiau
01 Oct 2002, 04:15
wow!

a wicked hack

Question

me, i like things to ALL look the same, so this could make things look "messy" to someone like me.

Would it, if it does not already, have an option, much like a certain template

So, i make my own postbit template and then, when I view forums ALL posbits look like that? OR i can change to say another postbit template and it will look like that? - much the same as u change the color scheme on here... it affects the overall site, nut just what u do.

instead of seeing everyonme diff, postbit - as i can see some people finding that annoying as you get used to something, like profile being in one place, but it is in a few diff. places for diff people....

Just a thought.

but other wiuse very impressive hack!

Xenon
01 Oct 2002, 10:44
hmm you mean users can create and select different postbits but just they can see what they've choosed and all other posts look like their own?

well you can hack my hack a bit to get that effect:
chage this lines: if($postbitid==0 && $post[postbitid]==0) {
eval("\$retval = \"".gettemplate("postbit")."\";");
} else {
if($postbitid==0) $postbitid=$post[postbitid];


into this: if($postbitid==0 && $bbuserinfo[postbitid]==0) {
eval("\$retval = \"".gettemplate("postbit")."\";");
} else {
if($postbitid==0) $postbitid=$bbuserinfo[postbitid];


that should do the trick

sonic3d
13 Feb 2003, 16:54
hey xenon after i finish adding a postbit, this comes up

Custom Postbits
x_Vmo67n:v4K6ht}iD$C(z/Ķrsw<)$$Yj c#Uxy(*.Yxھ' ,^yۏCzKm3p6\<nN6i6 x+p܋= ,0OO@;^/yu IABe:b^C`l_#eh8Xx{E


and nothing happens. did i do something wrong?

l8er
sonic

Xenon
13 Feb 2003, 18:05
hmm, seems like you've done something wrong, but no idea what :)
looks really wierd....

sonic3d
13 Feb 2003, 20:57
well i double checked it and still doesn;t work. i just uninstalled it.

l8er
sonic

Xenon
13 Feb 2003, 21:01
maybe the fileupload was corupted...

sonic3d
13 Feb 2003, 21:08
maybe, i will try it later today and see what happens.

l8er
sonic

dnd
17 Feb 2003, 20:39
hi xenon

I've installed this hack, added a new postbit
but whin i click on " View/Edit/Delete " i can only see the custom postbit with no options to edit or delete

whats wrong?

Xenon
17 Feb 2003, 21:18
@sonic3d: now i got the same error....
don't know the reason, maybe it has to do with the mysql or php version....
/me tries to find out..

@dnd: hmm, wierd
have you installed everything correct?
i can't test it now, as my testserver produces another problem...

Xenon
17 Feb 2003, 21:49
@sonic3d and all others:
gzip compression produces that problem
i've uploaded a new version. there were just changes to admincpb.php so just upload this..

dnd
17 Feb 2003, 22:13
thanks xenon
works great now :)

Xenon
17 Feb 2003, 22:26
:)
glad to hear :)

NuclioN
23 Feb 2003, 11:44
Xenon, when you have the arcade hack installed the line in functions.php is:

function getpostbit($post,$vpa_champs=0) {

In that case would:
function getpostbit($post,$postbitid=0,$vpa_champs=0) {

The right way to place the code?

Xenon
23 Feb 2003, 12:30
hmm, not sure, it depends on how the arcade hack calls the postbits.

normally you are right, but you could get problems....
be sure to check every call of the getpostbitfunction, that the syntax isn't wrong anywhere...

NuclioN
23 Feb 2003, 12:46
In showthread.php is an instance of the same code,

$postbits .= getpostbit($post,$vpa_champs_a);

that (should) be:

$postbits .= getpostbit($post,$postbitid=0,$vpa_champs_a); ?

I've test it and there are no errors, however when i make an adjustment or replacement it does not update it. Also after validation there is no change with the original standard postbit.

NuclioN
23 Feb 2003, 12:59
In functions.php there's also this:

eval("\$retval = \"".gettemplate("postbit")."\";");
} else if ($bbuserinfo['usergroupid']!=12) {
eval("\$retval = \"".gettemplate("postbit_banned")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
}
return $retval;
}

That's part of "stealth ban" hack so there are 3 instances of:
eval("\$retval = \"".gettemplate("postbit")."\";");

I like this hack Xenon but it looks that it's not for me this time.

Xenon
23 Feb 2003, 19:47
well, yes it's hard to implement it, when you already have hacked the getpostbit in your way..

the first things seemed right, so maybe you can achieve it so it works correctly.

last question: hmm, replace every instance :)

sonic3d
23 Feb 2003, 20:17
Originally posted by Xenon
@sonic3d and all others:
gzip compression produces that problem
i've uploaded a new version. there were just changes to admincpb.php so just upload this..

thanx a lot will try later today or tomorrow

l8er
sonic

vdinh
24 Feb 2003, 05:51
Hi Xenon,

I am currently running vBulletin 2.2.9. On some of the old threads, whenever I tried to get to the first page, it gave me an error such as:

---------------------------
Database error in vBulletin 2.2.9:

Invalid SQL: SELECT * FROM custompostbit WHERE postbitid IN (0,0,0,0,0,0,0,0,0,,0,0,0,,,0,,0,,0,,0,0,,0,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
mysql error: You have an error in your SQL syntax near '0,0,0,,,0,,0,,0,,0,0,,0,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)' at line 1
mysql error number: 1064

Date: Sunday 23rd of February 2003 04:48:45 PM
Script: http://myvbulletin.com/vb...mp;threadid=903
Referer: http://myvbulletin.com/vbulleti...=&forumid=3
------------------------------

The thing is if I click to to to page 2 of those thread, it worked as normal. So what is the problem and how can I fix it ? Please enlighten me

Thanks a lot.

Xenon
24 Feb 2003, 11:05
huh?

that error never occured to me.

have you made an error while installing?

if not i need more informations, what is different between the first page and the second one?