We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Need gender in profile filled out - Facebook Connect | Forum

Ugur
Ugur Jul 29 '13

 

Why no gender? it looks kind of important to me

Alican
Alican Aug 16 '13
Yes I have the same problem. Isn't it possible to get GENDER data of profile with facebook plugin? How can we add GENDER to synchrnization.
Dubz
Dubz Sep 12 '13
I did this manually to my site. If you feel confident enough in editing your site manually I'll post the code I added to do this. Keep in mind you will have to re-add it whenever there is an update for the plugin (or verify it's still there).


Keep in mind that if you are going to do this modification that:

1. First make a backup of the site's files and database

2. Know how to edit the files on the site (dreamweaver, notepad++, etc) (NOT Notepad, even though it will work, it's not recommended).

3. Know how to access and edit the database.


If you don't know how to do one of these then I wouldn't recommend trying this modification yourself and to rather wait for an update. I posted what's needed for this to work, so it wouldn't be hard to throw it in the next update since all they have to do is add the following data to it.


Database:

Navigate to the table called "ow_fbconnect_field". This is where all the rules are stored for the site and point to the converters used.


Add a value to this table with the following data:

question: sex

fbField: sex

converter: FBCONNECT_FC_Sex


You could also just run this query:

INSERT INTO `ow_fbconnect_field` (`question`, `fbField`, `converter`) VALUES('sex', 'sex', 'FBCONNECT_FC_Sex');



PHP:

The first file to edit will be located at path_to_www/ow_plugins/fbconnect/classes/converters.php

What you need to do is add the following code to the end of the file (between the #):


####################################################

class FBCONNECT_FC_Sex extends FBCONNECT_CLASS_ConverterBase

{


    public function convert( $question, $fbField, $value )

    {

        switch($value)

        {

            case 'male':

                return 1;

            break;

            case 'female':

                return 2;

            break;

        }

    }

}

####################################################



The second file to edit is located at path_to_www/ow_plugins/fbconnect/bol/service.php

On line 238 (roughly, that's where mine was at) You will add the following text, keeping the same syntax as the lines before:


###########################

case 'sex':

    return array('sex');

###########################



That's it! Your site should now use the sex listed on the user's facebook when they sign in.

The Forum post is edited by Dubz Sep 12 '13
Alican
Alican Sep 13 '13
Thanks a lot for the help and detailed explanation. I will try in my test site as soon as possible and let you know if it works.
Dubz
Dubz Sep 13 '13
No problem. If you need any help or have any questions just reply back here or shoot me a pm.
Alican
Alican Sep 15 '13
I have tried and it works perfect :) thanks a lot again.
You do not have permission to reply this topic