PDA

View Full Version : need help completing this code in functions.php


michealo
09-22-2002, 12:51 AM
xenon helped me a while back (thank you!) to add a line that would allow users to edit thier username and usertitle color IF they met a certain postcount minimum

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

is the code that allowed this to work

im trying to add another criteria where users can add glow to thier name using the same code. ive tried it several ways, and this is how i thought would make it work, but it just gives me a parse error

if($post[posts]>yyy) $post[username]="<table style="filter:glow(color=".$post[fieldx].", strength=2")>".$post[username]."</table>";

any help would be appreciated, thanks

TECK
09-22-2002, 01:23 AM
if ($post['posts'] > 10) {
$post['username'] = '<table style=filter:glow(color="' . $post[fieldx] . ', strength=2")>' . $post[username] . '</table>';
}

michealo
09-22-2002, 01:42 AM
thanks, that code works

BUT it makes every user's name glow red, who has the required number of posts

i need it so the name doesnt glow if no color is specified in the profile field.

also, it only works if a hex color is entered.

thanks

Velocd
09-23-2002, 06:33 PM
also, it only works if a hex color is entered.


Hex colors are the only way to go, you don't actually input "blue", "red", etc. do you..??
* Velocd shrieks in horror

Actually it doesn't really matter, and I guess for members who know nothing about HTML that would be easier..

Use this code to make it so that if no color is inputted, the thing doesn't glow.


if ($post['posts'] > 10 && $post['fieldx']) {
$post['username'] = '<table style=filter:glow(color="' . $post[fieldx] . ', strength=2")>' . $post[username] . '</table>';
}


That wont check though if the inputted value in fieldX is something other than a hex code.

If you want it to work with color names, just put this right below the IF statement, inside:


if($post[fieldx] == "white"){
$post[fieldx] = "#FFFFFF";
}


And just replicate that code changing the values for each different color you want to add.

Hope any of this helps ;)

michealo
09-23-2002, 09:57 PM
worked great, thanks!

it added a blank line beneath the name and above the usertitle, tho

but otherwise, looks good

Velocd
09-24-2002, 01:15 AM
Check this part out:

if ($post['posts'] > 10 && $post['fieldx']) {
$post['username'] = '<table style=filter:glow(color="' . $post[fieldx] . ', strength=2")>' . $post[username] . '</table>';
}


See those <table> tags..I personally don't recall the username being inbetween the <table> tags, so it's probably not needed.

Try replacing the <table> and </table> with a <td> and </td> tag, then with some tweaking around you should be able to remove the space maybe..

michealo
09-24-2002, 03:36 PM
that worked great
this is the code i use for all three items: username color, usertitle color, and username glow color

i think it gets confused when setting the username colors and glow colors, cause the names only seem to glow red no matter what hex code it entered



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



if($post[posts]>2000) $post[username]="<font color=".$post[field6].">".$post[username]."</font>";



if ($post['posts'] > 5000 && $post['field9']) {

$post['username'] = '<span style=height:10;filter:glow(color=".$post[field9]." strength="1")>' . $post[username] . '</span>';

}


i changed the ".$post[field9]." to #FFFFFF and everyone's name glowed white, so the code works. is there a way to combine the two if statements (username color and username glow color)?