简体   繁体   中英

How to access custom fields Facebook PHP SDK

Facebook has in their documentation an example for a custom sign-up form:

<fb:registration
        fields="[{'name':'name'}, {'name':'email'},
        {'name':'favorite_car','description':'What is your favorite car?',
        'type':'text'}]" redirect-uri="URL_TO_LOAD_AFTER_REGISTRATION">
</fb:registration>

I want to create something like this but instead of favorite car my custom field is the address and I want fb-only registrations:

       <fb:registration
        fields="[{'name':'name'}, {'name':'email'},
        {'name':'address','description':'Address',
        'type':'text'},{'name':'zipcode','description':'Zipcode',
        'type':'text'}]" redirect-uri="http://example.com/register-exec.php"\
       fb_only='true' fb_register='true'>
       </fb:registration>

After the user registers, does Facebook keep in their database the custom field address and zipcode?

I can run

$facebook->api('\me') 

to get user info but can I do something like

$facebook->api('\me\zipcode') 

I am making the website facebook-only so I want facebook to keep track of these fields (I don't want to make my own database for this). Also, how can I know if someone has registered to the website when they access a page of the site?

Thanks

Facebook doesn't keep any record of the values provided by the user to any custom fields the developer requests

Your own app needs to process and store those in your own database - they won't be retrievable via the API as they're only passed during validation and submission of the registration plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM