News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Member Colors

Started by roach6390, July 25, 2006, 08:17:47 PM

Previous topic - Next topic

roach6390

Hi, I was going to code this myself, but I am not yet familiar enough with SMF.

I want to have it so my users on my forum can chose the color that they want their username to show up in.

The idea is very simple:
           TO DISPLAY:
- check if user wants to see the colors via SQL table
- find member number
- from member number, search SQL table to color referring to member number
- use HTML, probably <SPAN> to change color
           TO SET:
- have a field in the user profile editing for a user to enter a hex color
- on submit, it will send the color to the SQL table with the info of memnber number and color
- same thing for the option to view colors or not

Any help?

EDIT: I'm going to try and tackle this myself, but if you want to add some pointers, please do.  8)

TaGBaN

Im not sure entirely what you plan to do... But SMF already offers membergroup colors, and there are mods to display these colors via either memberlists, posts, or other places.

roach6390

#2
Yes, membergroup colors, but I want an option for ever single person, even int he same membergroup to chose their personal color. I already have a temporary solution, but it will convert every link containing a user's name into that color ;)

Here is a temporary fix:
function ColourName(username,colour,method) {var iLink = document.getElementsByTagName("a");for (a=0; a<iLink.length; a++) {switch (method) {
case "num":
if (iLink[a].href.match(new RegExp('showuser=' + username,'i'))) {iLink[a].style.color = colour;}break;
case "name":
if (iLink[a].innerHTML.toString().match(new RegExp(username,'i'))) {iLink[a].style.color = colour;}break;}}}


Use as such:
ColourName("Username","Color","name");

The last parameter is telling it to get it by name. You can also use "num".


EDIT:::::
Nevermind, I managed to make the system myself  :) I'd submit it as a mod, but it's so intertwined with my forum, I can't really pull it out.

Advertisement: