Custom User Profile and added Registration Fields

Hello all..

I have installed the Ultimate Facebook plugin on http://myinspriredwedding.com, its working great.

I have 2 issues I'd like to resolve.
- I need to do is add an extra user_meta field - wedding date, to the registration form the plugin provides.
- Upon login.. all users are sent to the homepage (I have no value in the "Redirect on login" field). How to I set the Facebook connect setting to simply refresh the current page upon login.?

(see attached screen cap)

I have added the following to my functions.php to add the field to the user profile. I now just want to add a field to the facebook connect registration page and widget to request this data before allowing them to register.

function my_new_contactmethods( $contactmethods ) {
$contactmethods['wedding_date'] = 'Wedding Date';
$contactmethods['contact_source'] = 'Source';
return $contactmethods;
}
add_filter('user_contactmethods','my_new_contactmethods',10,1);

.. any help or direction would be greatly appreciated.

  • rgkeenan

    Upon looking a little deeper into this. It seems Facebook registration allows for a JSON string instead of a csv allowing the app to accept added registration fields.

    The /lib/forms/registration.php file seems to use this to pass blog title and descriptions into a variable called $new_blog_options which is then appended to the fields JSON string.
    fields=[
    {'name': 'name'},
    {'name': 'email'},
    {'name': 'first_name'},
    {'name': 'last_name'},
    {'name': 'gender'},
    {'name': 'location'},
    {'name': 'birthday'},
    <?php echo $new_blog_options;?>
    <?php echo $captcha;?>
    ]

    Is is possible to pass any user_meta values input in the "Map WordPress profile to Facebook" that have a mapping value of "nothing"

    I'd hate to modify the core for this app if I don't have to (always the opportunity to forget to re-apply changes to code when the app gets updated)... is there a hook or filter I should be using to accomplish this in my functions.php

    Perhaps I am totally over-analyzing this.. is the plugin already set up to accommodate custom user/profile data (I know is supports buddypress xprofile data) and I am missing somethng?

  • rgkeenan

    Thanks Mason.. appreciate it. I can live without the redirect (agreed btw..the docs seem to imply that is the case and it makes sense.. annoying but not a deal killer).

    Being able to add custom fields (and passing those user_meta values to the site registration) is critical in this instance (even if I have to modify the plugin a bit to make it work - not ideal, but is viable).

    Our users are brides, and without knowing their wedding date its tougher to provide them with the pertinent info we'd like to.

    Thanks for any help and guidance in advance..

  • Vladislav

    Hello,

    I understand what you're after and, at this point, it is not possible without modifying the plugin files itself. However, the idea is great and it's only logical we provide for easier addition and removal of the new fields within the plugin itself. This is something that we're working on right now, and it will definitely find its way into the next release, which will hopefully be very soon.

  • Vladislav

    Hi,

    Apparently, "very soon" would mean "today". The latest plugin release (v1.4.3, just released) allows you to add (and process) as many registration fields as you want.

    You could add fields by hooking up with a plugin filter that processes the fields array. For an example, you could do it like so:

    function rgkeenan_add_registration_fields ($fields) {
    	$fields[] = array(
    		"name" => "myname",
    		"description" => "My desciption",
    		"type" => "text",
    	);
    	return $fields;
    }
    add_filter('wdfb-registration_fields_array', 'rgkeenan_add_registration_fields');

    You can put this code in your theme's functions.php file, or in a separate file in your mu-plugin folder, or even make a separate plugin for it. It is very important that your function returns an array. This will add your new field to the registration page, but it still won't record it in the database.

    To do this, you should also process your field. This can be done by hooking some code up with a plugin action named "" which accepts two arguments: the ID of your new user, and the array of registration field name/value pairs. For an example, if you used the code above to create your new field, this is how you could record it into a database:

    function rgkeenan_user_registered ($user_id, $registration) {
    	update_user_meta($user_id, 'myfield_name', $registration['myname']);
    }
    add_action('wdfb-user_registered', 'rgkeenan_user_registered', 10, 2);

    The examples are a bit simplistic, but hopefully they can get you started.

  • rgkeenan

    Woo hoo.. thats fantastic VeBailovity. am going to give it a whirl right now..

    I was just about to bail on Untimate Facebook due to what seemed like an insurmountable conflict with FormidablePro and the recaptcha functions in that plugin. (I have another open ticket Mason was helping me with regarding this)

    I just discovered that if I turn off the Facebook OpenGraph Support in Ultimate Facebook, my problems with the recaptcha code disappears (not precisely sure why this resolved the problem - but am content to be able to continue to use both this fantastic tools)..

    so today is a great day.. two big problems potentially put to bed.

    (FYI - WPMUDev should have a hard look at Formidable, it is a remarkable tool in areas where gravity forms is still thin.. namely front end user submission of such things as profile data, post data, custom post data - it would be fantastic is many of the tools you offer supplied a mean to connect with Formidable forms and leverage this end-user accessible, forms & form data management plugin - might be worth taking a look at and touch base with Stephanie over there.. she is fantastically helpful - and its a great tool.. my two cents worth)

  • shpr

    Being able to add custom fields (and passing those user_meta values to the site registration) is critical in this instance

    I found this post & have a similar situation; I require custom fields on registration (currently using Buddypress)...

    I see this post is 8months old & there have been many updates to the plugin....

    Is the process still the same (as described above) to include custom fields such as checkboxes, textfields & dropdowns?

    Ref: https://premium.wpmudev.org/forums/topic/ultimate-facebook-fb-registration-form-using-custom-fields-eg-tc-checkbox-fields-not-included-in-fb?replies=1#post-241299