dqch34769 2014-11-23 20:00
浏览 60

使用Facebook数据填充Wordpress用户配置文件字段

I've scoped the necessary extended permissions for my Facebook login button, but now I assume that I need to alter the user-functions.php in order to populate my user metadata with the extended permissions. The extended permissions are: user_likes, user_education_history, and user_work_history. I have created corresponding user meta fields that are: Interests, Education, and Employment. This is the current user-functions.php:

/* Update user profile from facebook */

function userpro_update_profile_via_facebook($user_id, $array) {

    global $userpro;

    extract($array);



    if ( userpro_is_logged_in() && ( $user_id != get_current_user_id() ) && !current_user_can('manage_options') )

        die();



    if ($id && $id != 'undefined') { update_user_meta($user_id, 'userpro_facebook_id', $id); }



    if ($first_name && $first_name != 'undefined'){ update_user_meta($user_id, 'first_name', $first_name); }

    if ($last_name && $last_name != 'undefined') { update_user_meta($user_id, 'last_name', $last_name); }



    if ($gender && $gender != 'undefined') { update_user_meta($user_id, 'gender', $gender); }



    if ($link && $link != 'undefined') { update_user_meta($user_id, 'facebook', $link); }

I was wondering if anyone had any tips for connecting these three extended permissions with my user data. Thanks in advance for any help!

  • 写回答

1条回答 默认 最新

  • dongou4052 2014-11-23 23:27
    关注

    There's a facebook API to do that, check this out, Retrieve User's Profile

    Take a look aswell at Graph API Reference this will give an hint about what information you can retrieve.

    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)