How do I add a 'fill my profile with FB data' in a front end user profile page?


I have installed the Ultimate Facebook plugin and it shows a 'fill my profile with facebook data' link in the edit user profile admin page.
I am moving to a front end user page now (WP User Frontend) and would like to add this as a button on that page.
How do I do this?

  • aristath

    Just copy this in your functions.php file and customize it to your own needs:

    function custom_wdfb_profile_widget () {
    	$profile = apply_filters('wdfb-profile_name', '<em>' . get_bloginfo('name') . '</em>');//defined('BP_VERSION') ? "BuddyPress" : "WordPress";
    	echo '<a href="#" class="wdfb_fill_profile">' . sprintf(__('Fill my %s profile with Facebook data', 'wdfb'), $profile) . '</a>';
    	echo '<script type="text/javascript">(function ($) { $(function () { $(".wdfb_fill_profile").click(function () { var $me = $(this); var oldHtml = $me.html(); try {var url = _wdfb_ajaxurl;} catch (e) { var url = ajaxurl; } $me.html("Please, wait... <img src=\"' . WDFB_PLUGIN_URL . '/img/waiting.gif\">"); $.post(url, {"action": "wdfb_populate_profile"}, function (data) { $me.html(oldHtml); }); return false; }); }); })(jQuery);</script>';

    Then in your template you can use this:
    <?php custom_wdfb_profile_widget(); ?>


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.