PDA

View Full Version : looking for a hack to allow mods and admins to change username color...


michealo
07-07-2002, 02:54 PM
or do i even need a hack for this?
i searched this forum, but didnt find anything that would do just this

i looked thru CP and didnt see anything to do this either

any help would be appreciated
thanks

Xenon
07-07-2002, 03:03 PM
there are some hacks out there, most of them works with custom profilefields...

do another search and you'll find em

michealo
07-07-2002, 03:50 PM
i found this one, Username Font Color Hack(in postbit)

which looks nice, BUT its for all members, and i only want mods and admins to ahve this ability

Xenon
07-07-2002, 04:31 PM
just add an if-clause if(post[usergoupid]!=2) {....original code of the hack here ..... }

michealo
07-08-2002, 08:02 PM
thanks for yer help, but i coldnt get that too work

actually to make things easier, i just want to only allow this option once a certain post count it hit

would the command be?

if(post[postcount]!>=500) {....original code of the hack here ..... }

Xenon
07-09-2002, 12:03 AM
my code should work, perhaps there is a problem with your integration...

also for posts counts:
if(post[posts]>=500) {....original code of the hack here ..... }

michealo
07-09-2002, 01:59 AM
it should go in the postbit right?

before this line

<smallfont><font color="$post[field5]">$post[usertitle]</font>

i put it there and it just displays it just like another line

perhaps im putting it in wrong place, cause i dont want the members to even see the option in thier control panel is they have less than a certain number of posts

Xenon
07-09-2002, 10:21 AM
php-code you can just add in php-files

you have to edit functions.php

you have done so when you installed Username Font Color Hack.

so there add the code, not in the templates..

michealo
07-09-2002, 05:09 PM
i understand what yer saying now, but i didnt use functions.php to allow coloring of titles, i used this. a custom profile field

make a custom profile field which can only be 7 character long for the input...

Call it Custom Title Color

In that field they can type the hex of the color they want the title to be...

then find out what profile field it is (can't remember how to do it but its not har)

then in ure postbit template find this bit:

$post[usertitle]

then change that to:

<font color="$post[fieldx]">$post[usertitle]</font>

instead of the "x" in "fieldx" insert the number of the profile field..


so basically, i want the custom profile field to not even show up for a member if he hasnt reached a certain post count

thanks for all yer help so far

Xenon
07-09-2002, 05:27 PM
ok, i see :)
open member.php
find:
eval("\$customfields .= \"".gettemplate("register_customfields")."\";");

replace with: if($profilefieldname!=x || $bbuserinfo[posts]>yy) eval("\$customfields .= \"".gettemplate("register_customfields")."\";");

replace x with your profile id ;)
yy with the postaamount needed to use that field

michealo
07-09-2002, 05:56 PM
i feel like im wasting yer time, im sorry about this but

i did whats above, saved and uploaded it, logged in as a new user with zero postcount and i can still view and edit that custom profile field for changing usertext color

ive installed several wonderfull hacks from this forum, but i cant resolve this simple one

Xenon
07-09-2002, 06:13 PM
sorry, you have to edit the register.php in the same way

my fault, forgot to say that

michealo
07-09-2002, 06:46 PM
under User Control Panel For test > Edit Profile > Additional Information i still see the custom profile field "Custom Title Color: enter in a hex code to change the color of yer usertitle"

when when im logged in as a brand new member with zero posts
and it even still shows up when im in the registration process

http://home.adelphia.net/~michealo/title.JPG

perhaps i went about adding colored user titles the hard way from the very beginning

is there an easier to solve method to do all this?

Xenon
07-09-2002, 06:56 PM
hm, normally, you can add the variable in functions.php and not in the postbittemplate, so its easier for you to take out the functions for special users/usergroups

michealo
07-09-2002, 07:26 PM
im not sure what you mean by that

i removed the folowing cause too many new members were just abusing the privlegde

-code above that i added to the postbit template
<font color="$post[fieldx]">$post[usertitle]</font>

-deleted the custom profile field for usertext color

-and reset the member.php and register.php back to original

perhaps i really should be going about all this a different way
thanks for all yer help and patience so far, i'd love to get this solved.

Xenon
07-09-2002, 07:41 PM
ok, you already have this profilefield right?

then open your functions.php find in the getpostbit section:if ($post[showsignature] and $allowsignatures and trim($post[signature])!="" and ($bbuserinfo[userid]==0 or $bbuserinfo[showsignatures])) {
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]"];
}
} else {
$post[signature] = "";
}
just below add:if($post[posts]>yyy) $post[username]="<font color=".$post[fieldx].">".$post[username]."</font>";

thats all :)

michealo
07-09-2002, 08:05 PM
i readded the custom profile field for "custom user title color", changed yyy to 500 and fieldx to field6 (which is the number of the custom profile field) and still no go

i can still view the option as a new member with zero posts and when i do edit it as an admin with 5000 posts, the title color doesnt change if using the name of a color (brown) or as a hex code when posting

Xenon
07-09-2002, 08:22 PM
"i can still view the option as a new member with zero posts"
yes, but it has no use till the user has 500 posts

"when i do edit it as an admin with 5000 posts, the title color doesnt change if using the name of a color (brown) or as a hex code when posting"
must doing something wrong, i know it works.

michealo
07-09-2002, 08:52 PM
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

ok, we made serious progress
i misjudged my paste job and was pasting before a } and not after

but that code is for user name color which is just fine

can i do the same for user title colors, and just alter the code to

if($post[posts]>yyy) $post[usertitle]="<font color=".$post[fieldx].">".$post[usertitle]."</font>";

and paste it directly after the previous code for user name color?

THANK YOU SO MUCH!
:)

michealo
07-09-2002, 09:26 PM
welp, i threw caution to the wind and just did it and...

IT WORKS!!!!!!!!!!!!!!!!!!!!

Xenon, you are an all-star
i thank you

much respect

******************* EDIT

actually, when i do this, i makes the users show up as "guests" with "N/A postcounts" in all the threads unless they are currently logged in

it seems i have to add that second piece of code for usertitle color somepleace else

any thought?

Xenon
07-10-2002, 08:59 AM
hmm, are you sure you've posted it before the else code?

normally it should be correct.


your code should look so in the functions.php: if ($post[showsignature] and $allowsignatures and trim($post[signature])!="" and ($bbuserinfo[userid]==0 or $bbuserinfo[showsignatures])) {
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]"];
}
} else {
$post[signature] = "";
}
if($post[posts]>yyy) $post[usertitle]="<font color=".$post[fieldx].">".$post[usertitle]."</font>";
if($post[posts]>yyy) $post[username]="<font color=".$post[fieldx].">".$post[username]."</font>";
} else {

michealo
07-10-2002, 01:04 PM
yes, that might have been the problem

thank you xenon for all yer help

Xenon
07-10-2002, 01:11 PM
glad to hear it works now :)