MyBB Codes
Color for male and female - Printable Version

+- MyBB Codes (http://www.mybbcodes.com)
+-- Forum: Mods Database (/forumdisplay.php?fid=4)
+--- Forum: Requests (/forumdisplay.php?fid=16)
+--- Thread: Color for male and female (/showthread.php?tid=1422)


Color for male and female - Technoman - 07-21-2010 04:37 PM

I am using 2 plugins right now to have it look like this

[attachment=741]
[attachment=742]

I just want it to be where when they Register and there forced to choose there own sex ... they are a specfic color automatically... is there anyway to do this with out 2 plugins?

Thanks


RE: Color for male and female - exdiogene - 07-21-2010 06:12 PM

Here is a simple way to achieve this without any plugins :

1 - Go to AdminCP -> Configuration -> Custom Profile Fields -> Add New Profile Field

2 - Fill out the form so you will have two options like male and female for the sexes and click "Yes" for the "Required" field.

3 - Make sure that you have two images for each sex named like male.gif and female.gif in your "MyBB/images/" directory if you want to display images instead of text.

4 - Now go to AdminCP -> Templates & Style -> Templates -> Post Bit Templates -> postbit

5 - Around the {$post['profilelink']}, just add your field like {$post['fid3']} if you want a text display or like < img src="images/{$post['fid3']}.gif" > if you would like an image...

Now enjoy the view!


P.S. Depending of the number of new profile fields you already have the FieldID could be different like 'fid2' or 'fid4'.

Wink


RE: Color for male and female - Technoman - 07-21-2010 07:51 PM

Thanks for your time and this awesome in depth tutorial!


RE: Color for male and female - Technoman - 07-21-2010 08:08 PM

Ok now if I wanted a regular female "member name" highlighted in pink and same for a regular male in blue ... what are my ways of making this happen?

So what I would have to do in this part

Around the {$post['profilelink']}, just add your field like {$post['fid3']} if you want a text display or like < img src="images/{$post['fid3']}.gif" > if you would like an image...


See so this is sorta what I mean

A. regular male member ( name blue) + ( male icon upon registeration) ?
B. regular female member ( name pink ) + ( female icon upon registeration ) ?
Subscriber female member ( name green ) + ( female icon the same as A ) ?
Subscriber male member ( name purple ) + ( male icon the same as B) ?

now the code to be replaced directly inside the postbit would be like what?

Images I know that they have to placed inside the images folder but the code to be replaced in order for this to function correctly?

Thanks again!


RE: Color for male and female - exdiogene - 07-21-2010 08:54 PM

No easy way for what you want, but you could have the background kept pink for female and blue for male quite easily.

For the background you would simply put the username section inside a span tag with a male or female class.

Something like : < span class="{$post['fid3']}" >< strong >< span class="largetext">{$post['profilelink']}< /span >< /strong >< /span >

You now have to create the classes in the CSS file by adding this in AdminCP -> Templates & Style -> Themes -> YourTheme -> global.css

.male {
background: #e0e0ff;
padding: 2px;
}
.female{
background: #ffe0e0;
padding: 2px;
}

I have temporarely installed these changes to MyBBCodes.com, have a look at a few members posts...


RE: Color for male and female - Technoman - 07-21-2010 10:33 PM

Thats really neat exdiogene, I will have a play with it for sure... its always good to know other ways of coding tecniques Wink

Thanks friend!


RE: Color for male and female - FBI - 07-23-2010 09:24 AM

nice tutorial Wink
Because before this, I am thinking using Yumi PHP in Templates condition plugins Wink

[attachment=747]

Hahaha, there is something wrong in my post.
Read inside BBcode [code]
If, I didnt use bbcode, your forum show this error Wink

[attachment=746]


RE: Color for male and female - exdiogene - 07-23-2010 10:32 AM

I am trying to understand the problem you wrote about:

With code tags :
<php if ($post['fid3'] ) == 1 then> color </if>

Without code tags :
<php if ($post['fid3'] ) == 1 then> color </if>

I do not see any error!

Undecided

P.S. I will try it as a normal member to see if it is different...


RE: Color for male and female - Test - 07-23-2010 10:44 AM

With code tags :
<php if ($post[\'fid3\'] ) == 1 then> color </if>

Without code tags :
<php if ($post[\'fid3\'] ) == 1 then> color </if>

P.S. FROM EXDIOGENE : I can now see the problem, it is because of unescaped apostrophes in the message that clash with a new plugin i have installed yesterday, for testing, to eliminate duplicated posts!

I will try something to solve this right now!

Wink
New test...

With code tags :
<php if ($post['fid3'] ) == 1 then> color </if>

Without code tags :
<php if ($post['fid3'] ) == 1 then> color </if>


RE: Color for male and female - exdiogene - 07-23-2010 11:13 AM

It is working well now! Wink


RE: Color for male and female - FBI - 07-23-2010 03:26 PM

Ah, glad to see you can solved that Wink


RE: Color for male and female - Technoman - 11-08-2014 06:47 PM

Ok i haven't played around in awhile on a mybb board so i have got back into it and redone everything mentioned in this thread but now im stuck on the color change for username on gender ?

Example: So username would be blue for men and pink for female username?

I just don't want to have create another user group hopefully the Username color is possible for these 2 genders.


RE: Color for male and female - exdiogene - 11-09-2014 07:57 AM

Have you done what was mentioned in this message :

http://www.mybbcodes.com/showthread.php?tid=1422&pid=12902#pid12902


RE: Color for male and female - Technoman - 11-09-2014 08:24 AM

(11-09-2014 07:57 AM)exdiogene Wrote:  Have you done what was mentioned in this message :

http://www.mybbcodes.com/showthread.php?tid=1422&pid=12902#pid12902

Yes 1 profile field is already there by default in ACP and I enabled so its required upon registration to choose man or women ONLY and code placed so fid3 replaced the text in postbit to the left from (Gender: male) to (Gender: icon.gif) ONLY in postbit, im just stuck at where i would need to edit so that the 2 colors would be displayed for man blue and women pink USERNAME automatically.

Thanks.


RE: Color for male and female - Technoman - 11-09-2014 08:45 AM

(07-21-2010 08:54 PM)exdiogene Wrote:  For the background you would simply put the username section inside a span tag with a male or female class.

Something like : < span class="{$post['fid3']}" >< strong >< span class="largetext">{$post['profilelink']}< /span >< /strong >< /span >

You now have to create the classes in the CSS file by adding this in AdminCP -> Templates & Style -> Themes -> YourTheme -> global.css

.male {
background: #e0e0ff;
padding: 2px;
}
.female{
background: #ffe0e0;
padding: 2px;
}

I have temporarely installed these changes to MyBBCodes.com, have a look at a few members posts...

This is where it goes over my head sorry, the global css i understand but the part im stuck

< span class="{$post['fid3']}" >[/b]< strong >< span class="largetext">{$post['profilelink']}< /span >< /strong >[b]< /span >

a. where does this code go above
b. will the code automatically change the color of USERNAME according to gender?


RE: Color for male and female - exdiogene - 11-09-2014 09:56 AM

It goes inside the template where you want the username background colour to change. Mainly in the postbit template where you will find :
<span class="largetext">{$post['profilelink']}</span>

You just need to surround it with the gender colouring span section :
<span class="{$post['fid3']}"> ... </span>

Wink


RE: Color for male and female - Technoman - 11-09-2014 09:39 PM

(11-09-2014 09:56 AM)exdiogene Wrote:  It goes inside the template where you want the username background colour to change. Mainly in the postbit template where you will find :
<span class="largetext">{$post['profilelink']}</span>

You just need to surround it with the gender colouring span section :
<span class="{$post['fid3']}"> ... </span>

Wink

<span class="{$post['fid3']}"> ... </span>

So if i want Usernames for men gender and username for women gender to be their own color how to go about this?


RE: Color for male and female - Technoman - 11-09-2014 09:52 PM

Here is what I am talking about

[attachment=826]


RE: Color for male and female - exdiogene - 11-10-2014 09:45 AM

Simply replace this :
<span class="largetext">{$post['profilelink']}</span>
With this :
<span class="{$post['fid3']}"><span class="largetext">{$post['profilelink']}</span></span>

Inside your "postbit" template.

If you made the proper insertion in the style sheet, the background behind the username will be pink for "female" and blue for "male". But be sure that your profile field for the gender is really fid3! Wink


RE: Color for male and female - Technoman - 11-10-2014 08:36 PM

(11-10-2014 09:45 AM)exdiogene Wrote:  
<span class="largetext">{$post['profilelink']}</span>

<span class="{$post['fid3']}"><span class="largetext">{$post['profilelink']}</span></span>

@exdiogene thanks for help up to now, almost

    <div class="author_information">
            <strong><span class="{$post['fid3']}"><span class="largetext">{$post['profilelink']}</span></span></strong> {$post['onlinestatus']}<br />
            <span class="smalltext">
                {$post['usertitle']}<br />
                {$post['userstars']}
                {$post['groupimage']}


I copied this exact code above and replaced it with the original (default theme postbit) but still no color change ? Angel


RE: Color for male and female - exdiogene - 11-10-2014 08:48 PM

Send me by PM the URL, username and password for an administrator account on your forum. I will have a look on it...


RE: Color for male and female - Technoman - 11-10-2014 09:24 PM

.male {
background: #e0e0ff;
padding: 2px;
}
.female{
background: #ffe0e0;
padding: 2px;
}

/** Impromptu End */


Also this is in global.css , so i don't know what else it can be?


RE: Color for male and female - Technoman - 11-10-2014 11:10 PM

@exdiogene sent you pm


RE: Color for male and female - exdiogene - 11-11-2014 10:10 AM

Problem finally solved after waiting more than 30 minutes for an update!

But there seem to be caching issues between your site and me... Sad


RE: Color for male and female - Technoman - 11-12-2014 12:13 AM

(11-11-2014 10:10 AM)exdiogene Wrote:  Problem finally solved after waiting more than 30 minutes for an update!

But there seem to be caching issues between your site and me... Sad

This far without your help @exdiogene I wouldn't of been able to do this and I cannot thank you enough for everything!

Were almost there Blush


RE: Color for male and female - Technoman - 08-25-2015 11:14 AM

Due to MyBB updates (which sometimes is necessary) template edits were unfortunately lost on my end.

So i am here once again to redo the edits inside the default template accordingly. I have gone back over each reply in this thread and unfortunately the edits affect other groups, so im at a wall bumping my head here right now. Big Grin

Following the instructions within the last 3 pages (from what "exdiogenee worte" concerning edits for User Name COLORS for female, male or other, what happens is the color also affects other group Member Name colors and that is not what i expected or wanted. So my concern is maybe from the beginning I wasn't clear enough and why its not working to my liking.

So let me explain in another way in how i would like this working, and I guess we will start over again with a much better explanation/description from my end.


Admin is a group along with our chose of Username Style TEXT color, group images...etc
S.Mod is a group along with our chose of Username Style TEXT color, group images...etc
Mod is a group along with our chose of Username Style TEXT color, group images...etc
Banned is a group along with our chose of Username Style TEXT color, group images...etc
Registered Member is a group along with our chose of Username Style TEXT color, group images...etc

What i would like to do is (if possible) break up the Registered Member Group ONLY, have it where it changes ONLY the Username Style TEXT COLOR according to the Gender they selected upon registration....

Example selection:
Male
Female
Other

3 examples

1st example: new Registered member named John Smith is a Male, this would automatically put John Smith <--- Username Style Blue TEXT user name without interfering with other Groups colors.

2nd example: new Registered member named Jen Sogreat is a Female, this would automatically put Jen Sogreat <--- Username Style Blue TEXT user name without interfering with other Groups colors.

3rd example: new Registered member named Yolanda Smoothsunshine is Other, this would automatically put Yolanda Smoothsunshine<--- Username Style Blue TEXT user name without interfering with other Groups colors.


Ok one last thing, the Registered Only members Username Style TEXT will not affect other Groups! Also lets say down the road if i ever decided to lets say put Yolanda Smoothsunshine from other Registered Group to Admin Group the Username Style TEXT would change to Yolanda Smoothsunshine.


Hopefully this will not be to much work to achieve? If this cant be done at all that's perfectly fine. Wink


RE: Color for male and female - exdiogene - 08-25-2015 12:47 PM

Using the blue and pink colors as background, wont interfere with the color of the username!

For several groups exclusion, you will need PHP in template from ZingaBurga...


RE: Color for male and female - Technoman - 08-25-2015 08:35 PM

(08-25-2015 12:47 PM)exdiogene Wrote:  Using the blue and pink colors as background, wont interfere with the color of the username!

For several groups exclusion, you will need PHP in template from ZingaBurga...

Thank You exdiogene, which is answers my question related to the this topic "more challenging" then what its really worth!
Topic can be closed!