/** * Update the WordPress user profile based on the GF User Registration create feed * * @since 1.11 * * @param array $form Gravity Forms form array * @param string $entry_id Gravity Forms entry ID * @return void */ public function update_user($form = array(), $entry_id = 0) { if (!class_exists('GFAPI') || !class_exists('GFUser') || empty($entry_id)) { return; } $entry = GFAPI::get_entry($entry_id); /** * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on * @since 1.11 * @param array $entry Gravity Forms entry * @param array $form Gravity Forms form */ $entry = apply_filters('gravityview/edit_entry/user_registration/entry', $entry, $form); /** * @since 1.14 */ $config = GFUser::get_active_config($form, $entry); /** * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration * @since 1.14 * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form * @param[in] array $form Gravity Forms form array * @param[in] array $entry Gravity Forms entry being edited */ $config = apply_filters('gravityview/edit_entry/user_registration/config', $config, $form, $entry); $this->_user_before_update = get_userdata($entry['created_by']); // The priority is set to 3 so that default priority (10) will still override it add_filter('send_password_change_email', '__return_false', 3); add_filter('send_email_change_email', '__return_false', 3); // Trigger the User Registration update user method GFUser::update_user($entry, $form, $config); remove_filter('send_password_change_email', '__return_false', 3); remove_filter('send_email_change_email', '__return_false', 3); }
/** * Update the WordPress user profile based on the GF User Registration create feed * * @since 1.11 * * @param array $form Gravity Forms form array * @param string $entry_id Gravity Forms entry ID * @return void */ public function update_user($form = array(), $entry_id = 0) { if (!class_exists('GFAPI') || !class_exists('GFUser') || empty($entry_id)) { return; } $entry = GFAPI::get_entry($entry_id); /** * @filter `gravityview/edit_entry/user_registration/entry` Modify entry details before updating the user via User Registration add-on * @since 1.11 * @param array $entry Gravity Forms entry * @param array $form Gravity Forms form */ $entry = apply_filters('gravityview/edit_entry/user_registration/entry', $entry, $form); /** * @since 1.14 */ $config = GFUser::get_active_config($form, $entry); /** * @filter `gravityview/edit_entry/user_registration/preserve_role` Keep the current user role or override with the role defined in the Create feed * @since 1.15 * @param[in,out] boolean $preserve_role Preserve current user role Default: true * @param[in] array $config Gravity Forms User Registration feed configuration for the form * @param[in] array $form Gravity Forms form array * @param[in] array $entry Gravity Forms entry being edited */ $preserve_role = apply_filters('gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry); if ($preserve_role) { $config['meta']['role'] = 'gfur_preserve_role'; } /** * Make sure the current display name is not changed with the update user method. * @since 1.15 */ $config['meta']['displayname'] = $this->match_current_display_name($entry['created_by']); /** * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration * @since 1.14 * @param[in,out] array $config Gravity Forms User Registration feed configuration for the form * @param[in] array $form Gravity Forms form array * @param[in] array $entry Gravity Forms entry being edited */ $config = apply_filters('gravityview/edit_entry/user_registration/config', $config, $form, $entry); $is_create_feed = $config && rgars($config, 'meta/feed_type') === 'create'; // Only update if it's a create feed if (!$is_create_feed) { return; } // The priority is set to 3 so that default priority (10) will still override it add_filter('send_password_change_email', '__return_false', 3); add_filter('send_email_change_email', '__return_false', 3); // Trigger the User Registration update user method GFUser::update_user($entry, $form, $config); remove_filter('send_password_change_email', '__return_false', 3); remove_filter('send_email_change_email', '__return_false', 3); }
function __construct($signup) { // @alex: not sure this is a good thing to do? foreach ($signup as $key => $value) { $this->{$key} = $value; } $this->meta = unserialize($signup->meta); $this->lead = RGFormsModel::get_lead($this->meta['lead_id']); $this->form = RGFormsModel::get_form_meta($this->lead['form_id']); $this->config = GFUser::get_active_config($this->form, $this->lead); }