View Full Version : Different Postbit for Mods/Admins
Ryangel
08-05-2002, 07:27 AM
Can this be achieved?
What comes to my mind first is showthread.php, and a new templates postbit_admin, postbit_mod.
I did open up showthread and got lost after loking through it. lol.
Anyone here worked with showthread a whole lot and know which part i should look at? (if its even showthread.php at all :rolleyes: )
Just wondering... Thanks.
Logician
08-05-2002, 08:57 AM
Edit functions.php, find:
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
Replace it as:
} else {
if ($$bbuserinfo[usergroupid]==6)
{eval("\$retval = \"".gettemplate("postbit2")."\";");
}
else{
eval("\$retval = \"".gettemplate("postbit")."\";");
}
}
Now create a new template named "postbit2" and you are done.. ;)
The ideal hack would be to give the users the option of choosing the postbit template they want to use and to post custom postbits for admins to add to postbit library. We discussed about this hack some time ago. I want to code it but I have other hacks more important to me in my pending list and nobody volunteered to code it although everybody liked the idea. I'm reminding the hackers reading requests forum once more: This would be a very nice hack if you have time to code it. ;)
Xenon
08-05-2002, 11:28 AM
i have started on such a hack some time ago, but have had problems with the replacementvars this time, so i stopped it.
perhaps i'll give it another try next weeks while i'm at work ;)
Logician
08-05-2002, 12:19 PM
I dont know what the problem was, but if you share your algorithm and the problems you encountered I believe we can solve the problems.
I would structure the hack like this:
* a seperate table that saves custom post bits.
* Code to post new postbits (invisible/moderated) and Admin CP integration to add/edit/approve (make visible) these new postbits
* User CP modification to give the users the right to choose their postbit. ($bbuserinfo[postbit])
* functions.php modification to check if $bbuserinfo[postbit] is set, if yes get the postbit from custom table to apply, if no/or invalid/unallowed postbit get default one.
You can use the function in webtemplates hack to get/parse a custom template from a custom table.
Needless to say anything I can do, I'm ready for help.. :)
Xenon
08-05-2002, 12:29 PM
That's the problem, i've deleted all of my code because it doesn't work ;)
but i think it wouldn't be so hard to rewrite it
my hackstructure was a bit different:
* an extra field in user-table called custompostbit
* editable below the signature in usercp
- If a user hasn't entered one, it displays the standart postbit in the textbox
- After saving profile it compares it with the standart, if the custom is empty or equal to standart nothing is saved in the db
- it was unmoderated, because just Admins got that feature ;)
Now i think anything i can do, but i started the hack, some time ago while i wasn't as good as now ;)
i think i'll restart the project these weeks, and the other ones on my large to do list now ;)
Ryangel
08-05-2002, 03:52 PM
Originally posted by Logician
Edit functions.php, find:
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
Replace it as:
} else {
if ($$bbuserinfo[usergroupid]==6)
{eval("\$retval = \"".gettemplate("postbit2")."\";");
}
else{
eval("\$retval = \"".gettemplate("postbit")."\";");
}
}
Now create a new template named "postbit2" and you are done.. ;)
The ideal hack would be to give the users the option of choosing the postbit template they want to use and to post custom postbits for admins to add to postbit library. We discussed about this hack some time ago. I want to code it but I have other hacks more important to me in my pending list and nobody volunteered to code it although everybody liked the idea. I'm reminding the hackers reading requests forum once more: This would be a very nice hack if you have time to code it. ;)
whao, thanks!
Much appreciated.
Ryangel
08-06-2002, 12:08 AM
hmmm this is my new fnction.php edit
// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} else {
if ($bbuserinfo[usergroupid]==6) {
eval("\$retval = \"".gettemplate("postbit_admin")."\";");
}
else{
eval("\$retval = \"".gettemplate("postbit")."\";");
}
}
return $retval;
}
but somehow its displaying all the posts with postbit_admin . Even with normal users. Any ideas?
Xenon
08-06-2002, 01:22 AM
change it to that:
// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} else {
if ($post[usergroupid]==6) {
eval("\$retval = \"".gettemplate("postbit_admin")."\";");
}
else{
eval("\$retval = \"".gettemplate("postbit")."\";");
}
}
return $retval;
}
squawell
08-06-2002, 01:40 AM
i use firefly's hack--postbit_first so this is my functions code
how do i change it??
// do posts from ignored users
if (!$ignore[$post[userid]]) {
eval("\$retval = \"".gettemplate($templatename)."\";");
} else {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
}
return $retval;
}
Xenon
08-06-2002, 01:43 AM
// do posts from ignored users
if (!$ignore[$post[userid]]) {
if ($post[usergroupid]==6) {
eval("\$retval = \"".gettemplate("postbit_admin")."\";");
}
else{
eval("\$retval = \"".gettemplate("$templatename")."\";");
}
} else {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
}
return $retval;
}
squawell
08-06-2002, 02:17 AM
thankz Xenon it works...:D
but only one problem....if u r administrator and use firefly
postbit_first hack it will cover the setting
can fix that?
Ryangel
08-06-2002, 02:51 AM
Originally posted by Xenon
change it to that:
// do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} else {
if ($post[usergroupid]==6) {
eval("\$retval = \"".gettemplate("postbit_admin")."\";");
}
else{
eval("\$retval = \"".gettemplate("postbit")."\";");
}
}
return $retval;
}
Thanks!
edit: hmm just tried it out. Now it just uses postbit even the admin. I did as shown , also i made a template postbit_admin with changes.
Just browsed the db and saw that post doesnt have a usergroupid field. maybe thats why $post[usergroupid] does not work?
Ryangel
08-06-2002, 03:16 AM
silly me.. i uploaded the wrong file :rolleyes:
*Ryangel is a friggin newb*
Xenon
08-06-2002, 11:48 AM
@squawell: yes i know, it was planned so ;)
if you want to change it so the first post alwas looks different, no matter of admin or normaluser
you have to post the block where $templatename is defined and do the changes there more specific.
@Ryangel: ;)
You're half right, post doesn't have a usergroupid field, but a join query was executed with the user-table and so there is a $post[usergroupid] defined
squawell
08-06-2002, 10:58 PM
Originally posted by Xenon
@squawell: yes i know, it was planned so ;)
if you want to change it so the first post alwas looks different, no matter of admin or normaluser
you have to post the block where $templatename is defined and do the changes there more specific.
so Xenon how should i do can make both work??
thankz help.....
Xenon
08-07-2002, 06:47 PM
in chens hack where $templatename is defined you have to add another if-clause if poste is an admin or not
i don'T know his hack but it'll look likle that:
if(isfirstspost) {
if($bbuserinfo[usergroupid]==6) $templatename="adminfirstpostbit";
else $templatename="firstpostbit";
} else {
if($bbuserinfo[usergroupid]==6) $templatename="adminpostbit";
else $templatename="postbit";
}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.