View Full Version : Default User Color?
CdaKnight
11-04-2002, 12:42 AM
I've started to make a hack that will allow a user to have a default post color, and not have to set it in the actual post everytime.
I'm kind of a hacking n00b, so all I've been able to do is make the profile field.
Is there any way I can make a tag similar to normalfont, that is just like normalfont, except it is used only to display post test, with the specified color? (I just need to know where it's defined so I can copy it and make something new.)
Thanks,
CdaKnight
Erwin
11-04-2002, 01:39 AM
You can set replacement variables in your Admin CP by going to the Replacement section, and click Modify. Then, make something up like <postfont> and the replacement being <font color=$post[fieldx]>
Change x to the number of your custom profile id.
and </postfont> replacement being </font>
Then, in your postbit, add <postfont> and </posfont> around $post[message]. :)
CdaKnight
11-04-2002, 01:46 AM
Thanks a lot!!!!!!!!!!!!!!!
CdaKnight
11-04-2002, 01:55 AM
Hmmm. Now I'm having a problem. :(
All of my fonts default to blue.
is there a way I can set a default value for the profile field?
CdaKnight
11-04-2002, 02:00 AM
And I just figured out why. Its not translating $post[field5] into whatever the custom field is.
And to continue my question, I just thought of something. Is there a way to set a default if the user has nothing in the field?
Erwin
11-04-2002, 02:04 AM
Make it easy on yourself.
Forget about the <postfont> replacement.
In your postbit, use the HTML code directly like this:
<font color="$post[field5]">$post[message]</font>
It will work 100%.
Erwin
11-04-2002, 02:06 AM
The replacement variables don't parse custom profile IDs since replacement variables are not php file specific. So you can use them in your replacements it looks like, unless the variable is global.
CdaKnight
11-04-2002, 02:17 AM
Is there a way to set a default? All the people who haven't set a font color are blue.
CdaKnight
11-04-2002, 02:27 AM
And I just realized its not replacing. Where I have <font color="#$post[field5]"> it has <font color="#">
Erwin
11-04-2002, 02:37 AM
That's because the person has not filled out Custom Profile Field 5 out - are you sure it's custom profile id 5? It should be higher than that since usually the first 5-10 are taken already.
Why use #?
Why not have a custom user profile, and have your users enter either a color eg. "black, red, blue" or a hex "#000000" etc.
Then use <font color="$post[fieldx]"> NOT <font color="#$post[fieldx]"> - this way you won't have font becoming blue.
Also, then users can put in colors in words eg. marineblue, gold, yellow etc.
CdaKnight
11-04-2002, 02:56 AM
Its still not replacing the $post[fieldx] with anything. (Yes, I changed the 'x' to a #, which is unique)
My Postbit:
<p><font face="Arial" size="2" color="$post[field42]">$post[message]</font>
</p>
Output of a post:
<p><font face="Arial" size="2" color="">
Output
</font>
</p>
I mean, please tell me if I'm being retarded and doing something wrong. I don't think I have... but I probably did.
Erwin
11-04-2002, 03:15 AM
Remember, this is searching for the custom profile field content of the POSTER, not your own.
So to test this, fill out a color in your OWN custom profile field, then post something, and look at it.
If you want your color to affect ALL posts by OTHER posters, replace $post[fieldx] with $bbuserinfo[fieldx]. Otherwise, if you look at posts by other posters, and they haven't filled it out, their post will remain normal ie. color=""
Make sure you have the profile id correct too. To get the profile id, put your mouse over the link - the number at the end of the URL is the profile id number.
CdaKnight
11-04-2002, 09:22 AM
I think I'm calling the field wrong, because I have filled out the field, and its not showing up in threads I've posted in.
When I made the field, I set it up as following:
Max Input, and field length are both 25, I set the display order to a number to 6 (we have 5 other custom fields), its required, visible, and editable by the user.
I think my problem is I was calling $post[field6], but that's the display #.
This may sound stupid, but how do I go about finding the field#?
CdaKnight
11-04-2002, 09:26 AM
I figured it out, but I'm curious to know if there's a more conventional way than reading the output source of my profile page.
Sorry to have made this simple thing so much trouble!
Erwin
11-04-2002, 09:30 AM
The custom profile field id is NOT the display number!!! That is what I was trying to tell you in my posts! :)
You get the custom profile field id number by putting your mouse over the link to the custom profile field, and looking at the number at the end of the URL. Or opening the link to that custom profile field in a new window, and looking at the number at the end of the URL.
It should work now that you are using the CORRECT field number. :)
CdaKnight
11-04-2002, 09:31 AM
Sorry about that. I just woke up, and I must have scrolled past it. *bleh*
Thanks for all your help though.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.