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.

Changing the color of the posts (based on gender)

View previous topic View next topic Go down

Solved Changing the color of the posts (based on gender)

Post by Menos on January 4th 2014, 6:40 pm

I am using phpBB2..
I followed all the rules step by step 3 times.

help.forumotion.com/t115828-change-the-background-in-function-of-the-gender-of-the-poster#757421

The problem is that it only changes the background for the female users (xx)..
The male gender stays the same.. any suggestions?
Thank you for your time. Very Happy

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by SLGray on January 5th 2014, 12:48 am

Have you checked to see if the male members have it set in their profiles?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35657
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 7th 2014, 11:37 pm

Yes they have.
All the members have to click their gender in order to complete their registration.

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 9th 2014, 12:46 pm

Anyone??

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by SLGray on January 9th 2014, 6:29 pm

Do you have other JavaScripts or/and codes in the homepage message or/and in announcements?

If you do, remove all the other JavaScripts and see if the code works. Also try turning off announcements and remove the code from the homepage message.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35657
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 9th 2014, 10:26 pm

I have 4 more Java scripts running... I didn't realize that the code would create a conflict... pitty.. Sad

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by SLGray on January 9th 2014, 11:46 pm

@Menos wrote:I have 4 more Java scripts running... I didn't realize that the code would create a conflict... pitty.. Sad
So the code worked when you removed the other JavaScripts? You can add back the other JavaScripts one by one to see which ones are interfering with each other.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35657
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 10th 2014, 10:21 am

I disabled all the Java scripts I have, but the problem still remains..
I'm guessing that Java is not a problem.. Confused

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 14th 2014, 11:38 am


Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Ange Tuteur on January 14th 2014, 12:13 pm

Hi ,

Could you post the code you're using ?

Thanks Smile

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Sir. Mayo on January 14th 2014, 6:07 pm

Did you Change
Code:
var version ="phbb3";
to
Code:
var version ="phbb2";

now like Ange asked can you please post the codes you are using.

Sir. Mayo
Forumember

Male Posts : 963
Reputation : 85
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 15th 2014, 10:36 am

My CSS
Spoiler:

.fa_postbody_xy{
background: url("http://freefever.com/stock/fantastic-dark-gray-background-by-wiedzmawiedzma-dusdx.jpg");
min-height: 500px;
}

.fa_postbody_xx {
background: url("http://i79.servimg.com/u/f79/13/48/38/43/drock010.jpg");
min-height: 500px;
}

My Javascript
Spoiler:
$(function() {

//Indicate here the version of your forum.
var version = "phpBB2";

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() == "phpbb2"){
$(".postprofile img[title='Male']").closest('.post-container').addClass("fa_postbody_xy");
$(".postprofile img[title='Female']").closest('.post-container').addClass("fa_postbody_xx");
}
});

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Ange Tuteur on January 15th 2014, 10:50 am

The issue comes from the selector, since we're targeting the title texts which are currently in English. After switching my board language to Greek, as you said it would not work for male users.

The reason is because we're selecting this :
img[title='Male']

and since the language of your board is Greek, the title of the image changes to :
img[title='Άντρας']

Replace your current javascript with the one below and save.
Code:
$(function() {
 
  //Indicate here the version of your forum.
  var version = "phpBB2";
 
  if(version.toLowerCase() == "phpbb2"){
  $(".postdetails img[title='Άντρας']").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='Άντρας']").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='Άντρας']").closest('.postmain').addClass("fa_postbody_xy");
  $(".user-info img[title='Female']").closest('.postmain').addClass("fa_postbody_xx");
  }else if(version.toLowerCase() == "phpbb2"){
  $(".postprofile img[title='Άντρας']").closest('.post-container').addClass("fa_postbody_xy");
  $(".postprofile img[title='Female']").closest('.post-container').addClass("fa_postbody_xx");
  }
  });

Note :
If users switch their language under :
Profile > Preferences

This script may work partially, or not at all.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by Menos on January 19th 2014, 1:01 am

That's Amazing!!!!!:wouhou:
Thank you so much Ange Tuteur!!thumleft thumleft thumleft
Topic solved!!thumright

Menos
Forumember

Male Posts : 373
Reputation : 4
Language : Greek, English and Slovak

http://cbrxx.darkbb.com/

Back to top Go down

Solved Re: Changing the color of the posts (based on gender)

Post by SLGray on January 19th 2014, 1:12 am

Topic Solved & Locked


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35657
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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