Author Topic: Friend request message says "his" when it's from a woman.  (Read 2135 times)

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1006
  • Karma: +56/-7
Friend request message says "his" when it's from a woman.
« on: August 28, 2012, 01:53:04 PM »
I received a friend request message from a woman and in the message it says: [user name] wants to add you to his Friends network. The user is a woman, not a man. Is there a way that I can fix this automated message so that it says either his or her according to the sex of the user?

I understand that in Skin Settings > skin > Translate, I can change the word from "his" to "their", but I am curious to know if there's a way for the system to change the word automatically from "his" to "her" or whichever one is appropriate determined by the sex of the user.
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

amaco

  • Confirmed Member
  • **
  • Posts: 12
  • Karma: +1/-0
Re: Friend request message says "his" when it's from a woman.
« Reply #1 on: August 29, 2012, 04:28:21 PM »
I am not sure if this is the best way, but I managed to fix it and it works for me. You have to make a query to database to find out if the user is a man or a woman and change the pronoun to “his” or “her” depending on the gender of the user. Find the file “net_adduser.php” in "processors" folder and locate the following line:

$request['message_body']=sanitize_and_format(sprintf($GLOBALS['_lang'][85],$_SESSION[_LICENSE_KEY_]['user']['user'],get_net_name($input['net_id'])),TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);

Replace with the following code:

$pronoun="his";
$getGenderQuery="SELECT `f1` FROM `{$dbtable_prefix}user_profiles` WHERE `fk_user_id`=".$_SESSION[_LICENSE_KEY_]['user']['user_id']."";
if ($userGenderResult=@mysql_query($getGenderQuery)) {
   $userGender=@mysql_fetch_assoc($userGenderResult);
   if ($userGender['f1'] == 2) // Check if this is a female user.
      $pronoun="her";     // If this is a female user we change the pronoun.
} else {trigger_error(mysql_error(),E_USER_ERROR);}
$userRequest=$_SESSION[_LICENSE_KEY_]['user']['user'].' wants to add you to '.$pronoun.' '.get_net_name($input['net_id']).' network.<br /><a class="content-link simple" href="friendship_requests.php">Click here</a> to approve/deny this request and to see any other friendship requests.';
$request['message_body']=sanitize_and_format($userRequest,TYPE_STRING,$__field2format[FIELD_TEXTFIELD]);

Keep in mind that if you want to translate the site to another language you have to modify it in this piece of code, because this code doesn't use the $GLOBALS['_lang'][85] variable.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1006
  • Karma: +56/-7
Re: Friend request message says "his" when it's from a woman.
« Reply #2 on: August 30, 2012, 02:16:43 AM »
Thanks amaco! That worked for me as well.
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.