The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.

Create a free forum like this one.

New tip : Change the background in function of the gender of the poster

Go down

New tip : Change the background in function of the gender of the poster

Post by Shadow on July 17th 2012, 4:04 pm

Change the background in function of the gender of the poster

1. Definition :

So that this tip works, it is necessary that the field "gender" is visible in the messages profile and this, with a picture and not only the text ! We are going to create a CSS additional class fa_postbody_xy (for the boys) and fa_postbody_xx (for the girls) to the message body according to the informed gender, and with this new class, we'll be able to personalize the design of the post by manipulating its CSS.

2. The codes :

Administration Panel Modules HTML & Javascript Javascript codes management
Create a new Javascript to apply "in the topics".

  • Title : (What you want)
  • Placement : in the topics
  • Javascript code :

    $(function() {
       //Indicate here the version of your forum.
       var version = "phpBB3";
       if(version.toLowerCase() == "phpbb2"){   
          $(".postdetails img[title='Male']").closest('.postdetails').parent('td').next('td').addClass("fa_postbody_xy");
          $(".postdetails img[title='Female']").closest('.postdetails').parent('td').next('td').addClass("fa_postbody_xx");
       }else if(version.toLowerCase() == "phpbb3"){   
          $(".postprofile img[title='Male']").closest('.postprofile').prev('.postbody').addClass("fa_postbody_xy");
          $(".postprofile img[title='Female']").closest('.postprofile').prev('.postbody').addClass("fa_postbody_xx");   
       }else if(version.toLowerCase() == "punbb"){   
          $(".user-info img[title='Male']").closest('.postmain').addClass("fa_postbody_xy");
          $(".user-info img[title='Female']").closest('.postmain').addClass("fa_postbody_xx");   
       }else if(version.toLowerCase() == "invision"){         
          $(".postprofile img[title='Male']").closest('.post-container').addClass("fa_postbody_xy");
          $(".postprofile img[title='Female']").closest('.post-container').addClass("fa_postbody_xx");

Important!: To make it works you absolutely need to indicate the version of your forum by editing the value of the variable version, you have the choice between phpBB2, phpBB3, punBB and Invision.

3. Personalization of the CSS :

For example, here we have a CSS which act on the 2 classes that we have set up, thanks to the javascript a background picture will be applied, different depending on your skill and your imagination. Smile

Administration Panel Display Colors and pics Colors CSS stylesheet


   background: url("");
min-height: 500px;
.fa_postbody_xx {
   background: url("");
min-height: 500px;

4. The results :

It's done ! cheers cheers cheers

Translated and updated by the Forumotion Staff

Tutorial created by : Turbodeif - 06.20.12, from the Spanish Support Forum


Female Posts : 15864
Reputation : 1696
Language : French, English

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum