MyBB Codes

Full Version: Color for male and female
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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
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
Thanks for your time and this awesome in depth tutorial!
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!
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...
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!
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]
I am trying to understand the problem you wrote about:

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

Without code tags :
color

I do not see any error!

Undecided

P.S. I will try it as a normal member to see if it is different...
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>
It is working well now! Wink
Pages: 1 2 3
Reference URL's