Home > facebook > How to let user select role upon registration in Facebook-AWD?

How to let user select role upon registration in Facebook-AWD?

February 21Hits:5
Advertisement

I would like to use the plugin Facebook-AWD plugin.

My site would provide two ways of registration (normal and register with Facebook). Users must select their role, ie: buyer and seller.

With normal registration, I can achieve this easily but if my users choose to register with Facebook-AWD they can't select between roles as the plugin is set up to register user with default role:

'role'=>get_option('default_role'); 

How can achieve this by adding a hook or action or filter to the plugin in order to preserve the plugin core for future update?

public function register_user() {     $username = sanitize_user($this->me['first_name'], true);     $i = '';     while (username_exists($username . $i)) {         $i = absint($i);         $i++;     }     $username = $username . $i;     $userdata = array(         'user_pass' => wp_generate_password(),          'user_login' => $username,          'user_nicename' => $username,          'user_email' => $this->me['email'],          'display_name' => $this->me['name'],          'nickname' => $username,          'first_name' => $this->me['first_name'],          'last_name' => $this->me['last_name'],          'role' => get_option('default_role')     );     $userdata = apply_filters('AWD_facebook_register_userdata', $userdata);     $new_user = wp_insert_user($userdata);     //Test the creation                              if (isset($new_user->errors)) {         wp_die($this->Debug($new_user->errors));     }     if (is_int($new_user)) {         //send email new registration         wp_new_user_notification($new_user, $userdata['user_pass']);         return $new_user;     }      return false; } 

Answers

The plugin offers an entry point for this manipulation:

$userdata = apply_filters('AWD_facebook_register_userdata', $userdata);

So, now it's a matter of you filling up the fictional function in this example:

add_filter( 'AWD_facebook_register_userdata', 'user_role_wpse_87863', 10, 1 );

function user_role_wpse_87863 ( $userdata )
{
    $userdata['role'] = your_way_of_getting_the_role();

    return $userdata;
}

Related:

Related Articles

  • How to let user select role upon registration in Facebook-AWD?February 21

    I would like to use the plugin Facebook-AWD plugin. My site would provide two ways of registration (normal and register with Facebook). Users must select their role, ie: buyer and seller. With normal registration, I can achieve this easily but if my

  • Roles at registration (classipress)May 11

    I have a classipress site and want to have the user choose upon registering with the site if they are a teacher, or student. These will be different roles. I have been trying to get roles at registration plugin to work because it is basically what I

  • Role based registrationNovember 1

    I have two roles on my site: Visitor, the normal user who can register on our site without any admin approval procedure Business role, the business user who can register and add their business to our site, with admin approval. Can anyone suggest how

  • let the user choose role upon registrationNovember 7

    I'd like to let the front-end user to choose user role upon registration. When the register form submit, I'd like it to redirect to the respective profile page concerning with their chosen role. I use profile2 module and profile2 registration path mo

  • Assign a role upon registration Drupal 7March 12

    I'd like to assign a specific role when a new user registers on my site using the regular registration form, beyond that of just "authenticated user". How can I do this? --------------Solutions------------- This is easily accomplished using the

  • Give use a role during registration using Rules and Profile 2February 23

    I am using Profile 2 module to add selection of roles during registration. So a user select a role (selecting a radio button) and then a rule fires to give the user the role he selected. The issue is that the role is not assigned to the user. Any hel

  • How to allow user of certain role to create user only of selected roles?March 10

    I have few profiles. One profile per role. I've created few registration paths by Profile2 Registration Path module. I have an issue with permissions, for example I want allow user of role A, to create users of roles A or B, but because Profile2 Regi

  • assign role after registration (male female)January 5

    I need users to check male/female option when creating an account. Then I need to automatically assign a role male/female to the users. How can this be achieved? Is there any module which I can use? --------------Solutions------------- You can add a

  • Store anonymous user selection temporarily until registrationFebruary 23

    I want to let my first time visitors to first select a city, which will control what they see in my site, so it should be stored where I can see it everywhere (views, search and when posting content) until the user registers which then I store it in

  • How to reload the role specific registration form on validation errors?August 28

    I test a solution for separate registration for different roles and it works very well. But the validation part/function (see bellow) on errors reloads/reuses the generic registration link and not the role specific link, e.g. http://example.com/wp-lo

  • How to let selected role submit multiple data for 1 node?December 13

    I want to do a product price compare site. So a product is a node and product can have many different price at different store. I want to allow selected user's role able to submit new price or new store from time to time but I want them to submit dat

  • Set user role on registration so can upload file to own media library area

    Set user role on registration so can upload file to own media library areaApril 14

    I need my users to be able to upload files to the media library and therefore need to somehow automatically set the user role to something other than the default "subscriber" when they register. I know in Settings > General you can set the 'N

  • Add content link not showing for selected role user in Drupal 7 with workbenchJune 8

    I am using Drupal 7 After installed and enabled the four workbench modules Workbench Workbench Access Workbench Moderation Workbench Moderation Note I am not able to see the add content link for a Basic content type which I have given permission to n

  • Multiple role based registration in mvc4 c# aspxFebruary 15

    I have 5 roles of users.They are Admin,Distributor,Micro-distributor,Dealer and User.Admin has the privilege of accessing all pages of other user and all CRUD operations on it.All these users have different fields from others.If dealer register his d

  • How to create a dedicated folder for specific role via registrationDecember 11

    I need to include an option in registration page so that user can enter a name for the folder that we can create for them (like this: http://MyDomain.com/User_named_folder or page). I saw this in Buddypress which it shows in its registration page whe

  • How set role at registration based on email?December 23

    I'm looking for a way to set all users that register with specific domain extensions to be given a non default role. For example if a user signs up with a '.co.uk' address then their role could be Author rather than the default Subscriber. Does anyon

  • windows phone 8.1 app registration through facebookJanuary 15

    I want to integrate facebook login in my app for registration i am following this link but not able to understand how to get the Windows Store ID in step 1.2.. can anyone please help.. --------------Solutions------------- So the windows store id can

  • Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?December 15

    Would it be possible to create a wp user by signin up with Facebook connect? (And through Twitter app, and eventually other major social networks? Facebook is most important, then Twitter, the rest are not so important) - User fills form with one cli

  • Add user to Fan page after website registration using FacebookMarch 28

    As we all know we can use Facebook to simplify registration and sign-in process to our website. My question is, is it possible to automatically make a user a fan of a Fan page after he uses the Facebook registration/sign-in at our website? ----------

  • Evidence that requiring registration using facebook/twitter/google on a public terminal increases abandonment rates?

    Evidence that requiring registration using facebook/twitter/google on a public terminal increases abandonment rates?July 16

    I am working on a registration application which would be used in a live "museum" type experience. Essentially, to enter the museum you need to register for a personal account to receive a ticket. I am considering tapping Facebook/Twitter/Google

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.429 s.