function gforms_autologin($user_id, $config, $entry, $password) { $form = RGFormsModel::get_form_meta($entry['form_id']); $user_login = apply_filters("gform_username_{$form['id']}", apply_filters('gform_username', GFUser::get_meta_value('username', $config, $form, $entry), $config, $form, $entry), $config, $form, $entry); $redirect_url = rgars($form, 'confirmation/url') ? rgars($form, 'confirmation/url') : get_bloginfo('home'); //pass the above to the wp_signon function $result = wp_signon(array('user_login' => $user_login, 'user_password' => $password, 'remember' => false)); if (!is_wp_error($result)) { wp_redirect($redirect_url); } }
function process_feed($feed) { if (class_exists('GF_User_Registration')) { parent::process_feed($feed); return; } $form = $this->get_form(); $entry = $this->get_entry(); remove_filter('gform_disable_registration', '__return_true'); GFUser::gf_create_user($entry, $form); // Make sure it's not run twice add_filter('gform_disable_registration', '__return_true'); }
/** * * 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 */ 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); /** * Modify the entry details before updating the user * * @since 1.11 * @param array $entry GF entry * @param array $form GF form */ $entry = apply_filters('gravityview/edit_entry/user_registration/entry', $entry, $form); // Trigger the User Registration update user method GFUser::update_user($entry, $form); }
public static function maybe_prepopulate_form($form) { $config = GFUserData::get_update_feed($form['id']); // if no feed, return form unmodified if (!$config) { return $form; } else { // if the user is not logged in, add action to hide form and display error message if (!is_user_logged_in()) { add_action('gform_get_form_filter_' . $form['id'], array('GFUser', 'hide_form')); return $form; } else { // prepopulate the form $form = GFUser::prepopulate_form($form, $config); } } return $form; }
<?php define('WP_INSTALLING', true); global $current_site; // include GF User Registration functionality require_once GFUser::get_base_path() . '/includes/signups.php'; GFUserSignups::prep_signups_functionality(); do_action('activate_header'); function do_activate_header() { do_action('activate_wp_head'); } add_action('wp_head', 'do_activate_header'); function wpmu_activate_stylesheet() { ?> <style type="text/css"> form { margin-top: 2em; } #submit, #key { width: 90%; font-size: 24px; } #language { margin-top: .5em; } .error { background: #f66; } span.h3 { padding: 0 8px; font-size: 1.3em; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; font-weight: bold; color: #333; } </style> <?php } add_action('wp_head', 'wpmu_activate_stylesheet'); get_header(); ?> <div id="content" class="widecolumn"> <?php
/** * 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 load_gfur_signup_functionality() { // include GF User Registration functionality require_once GFUser::get_base_path() . '/includes/signups.php'; GFUserSignups::prep_signups_functionality(); }
public static function handle_submission() { if (!wp_verify_nonce(rgpost('action_nonce'), 'action') && !check_admin_referer('action_nonce', 'action_nonce')) { die('You have failed...'); } require_once GFUser::get_base_path() . '/includes/signups.php'; GFUserSignups::prep_signups_functionality(); self::$errors = ''; self::$message = ''; $action = rgpost('single_action'); $action = !$action ? rgpost('action') != -1 ? rgpost('action') : rgpost('action2') : $action; $items = rgpost('item') ? array(rgpost('item')) : rgpost('items'); foreach ($items as $key) { switch ($action) { case 'delete': $success = GFUserSignups::delete_signup($key); if ($success) { self::$message = _n('Item deleted.', 'Items deleted.', count($items), 'graivtyformsuserregistration'); } else { self::$errors = _n('There was an issue deleting this item.', 'There was an issue deleting one or more selected items.', count($items), 'graivtyformsuserregistration'); } break; case 'activate': $userdata = GFUserSignups::activate_signup($key); if (!is_wp_error($userdata) && rgar($userdata, 'user_id')) { self::$message = _n('Item activated.', 'Items activated.', count($items), 'graivtyformsuserregistration'); } else { self::$errors = _n('There was an issue activating this item', 'There was an issue activating one or more selected items', count($items), 'graivtyformsuserregistration'); if (is_wp_error($userdata)) { $errors = reset($userdata->errors); self::$errors .= ": " . $errors[0]; } } break; } } }
if ($sys_use_ssl && !session_issecure()) { //force use of SSL for login header('Location: https://' . getStringFromServer('HTTP_HOST') . getStringFromServer('REQUEST_URI')); } if (!$theme_id || !is_numeric($theme_id)) { $theme_id = $HTML->getThemeIdFromName($sys_theme); } if (getStringFromRequest('submit')) { /* Adding call to library rather than logic that used to be coded in this page */ if (!form_key_is_valid(getStringFromRequest('form_key'))) { exit_form_double_submit(); } $new_user = new GFUser(); $register = $new_user->create($unix_name, $firstname, $lastname, $password1, $password2, $email, $mail_site, $mail_va, $language_id, $timezone, $jabber_address, $jabber_only, $theme_id, '', $address, $address2, $phone, $fax, $title, $ccode); if ($register) { echo $HTML->header(array('title' => 'Register Confirmation')); printf(_('<p>Congratulations. You have registered on %1$s. <p> You are now being sent a confirmation email to verify your email address. Visiting the link sent to you in this email will activate your account.'), $sys_name); echo $HTML->footer(array()); exit; } else { $feedback = $new_user->getErrorMessage(); } } $HTML->header(array('title' => 'User Account Registration')); if (isset($feedback)) { print "<p><span class=\"error\">{$feedback} {$register_error}</span>"; } if (!isset($timezone) || empty($timezone) || !eregi('^[-a-z0-9_/]*?$', $timezone)) {
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); }
/** * GGF function - add options section to user registration setting page * @since 1.2 */ function ggf_options_section($config, $form, $is_validation_error) { //get options $ggfSettings = $config['meta']['ggf_settings']; //address fields $address_fields = array(__('Street', 'GGF') => 'street', __('Apt', 'GGF') => 'apt', __('City', 'GGF') => 'city', __('State', 'GGF') => 'state', __('State long name', 'GGF') => 'state_long', __('Zipcode', 'GGF') => 'zipcode', __('Country', 'GGF') => 'country', __('Country long name', 'GGF') => 'country_long', __('Full Address', 'GGF') => 'address', __('Formatted Address', 'GGF') => 'formatted_address', __('Latitude', 'GGF') => 'lat', __('Longitude', 'GGF') => 'lng'); $gmwbp_use = isset($ggfSettings['address_fields']['gmwbp']['use']) && $ggfSettings['address_fields']['gmwbp']['use'] == 1 ? 'checked="checked"' : ''; if (function_exists('gmw_loaded') || class_exists('GEO_my_WP')) { $addons = get_option('gmw_addons'); if (!isset($addons['friends'])) { $message = '<span style="color:#666;font-weight:normal">' . __('You must activate "Friends Locator" add-on in GEO my WP\'s', 'GGF') . ' <a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gmw-add-ons">' . __('"Add-ons"', 'GGF') . '</a> ' . __('page', 'GGF') . '</a></span>'; $disabled = 'disabled="disabled"'; } else { $disabled = ''; $message = ''; } } else { $gmw_on = array(); $disabled = 'disabled="disabled"'; $message = '<span style="color:#666;font-weight:normal"> requires <a href="http://geomywp.com" target="_blank">GEO my WP</a> plugin</span>'; } ?> <div id="ggf_options" class="ggf_options"> <h3><?php _e('GEO Fields Options', 'GGF'); ?> </h3> <table> <tbody> <tr> <td colspan="2" class="gf_sub_settings_cell"> <div class="gf_animate_sub_settings"> <table> <tr> <th style="border: 1px solid #eee;background: #f7f7f7;padding:8px 5px;"><?php _e('Address Field', 'GGF'); ?> </th> <th style="border: 1px solid #eee;background: #f7f7f7;padding:8px 5px;"><?php _e('User Meta', 'GGF'); ?> </th> <?php if (class_exists('BuddyPress')) { ?> <th style="border: 1px solid #eee;background: #f7f7f7;padding:8px 5px;"><?php _e('Xprofile fields', 'GGF'); ?> </th> <?php } ?> </tr> <tbody> <?php foreach ($address_fields as $name => $value) { ?> <tr id="ggf_address_field_address" class="child_setting_row" style=""> <th style="text-transform:capitalize;text-align: left;font-weight: normal;min-width: 170px;"><?php echo $name; ?> </th> <td> <input type="text" id="ggf_user_meta_address_field_'.$value.'" name="ggf_settings[address_fields][user_meta_fields][<?php echo $value; ?> ]" size="25px" class="ggf_user_meta_address_field" value="<?php if (isset($ggfSettings['address_fields']['user_meta_fields'][$value])) { echo $ggfSettings['address_fields']['user_meta_fields'][$value]; } ?> "> </td> <?php if (class_exists('BuddyPress')) { ?> <td> <select name="ggf_settings[address_fields][bp_fields][<?php echo $value; ?> ]"> <option value="0"><?php _e('N/A', 'GGF'); ?> </option> <?php foreach (GFUser::get_buddypress_fields() as $field) { ?> <option value="<?php echo $field['value']; ?> " <?php if (isset($ggfSettings['address_fields']['bp_fields']) && $field['value'] == $ggfSettings['address_fields']['bp_fields'][$value]) { echo ' selected="selected"'; } ?> ><?php echo $field['name']; ?> </option> <?php } ?> </select> </td> <?php } ?> </tr> <?php } ?> </tbody> </table> </div> </td> </tr> </tbody> </table> </div> <div id="gmw_options" class="gmw_options"> <h3><?php _e('GEO my WP options', 'GGF'); ?> </h3> <div id="gmw_settings_use" class="margin_vertical_10" style=""> <label class="left_header"> <?php _e("Save members location with GEO my WP", "GGF"); ?> <a href="#" onclick="return false;" class="gf_tooltip tooltip" title="<?php _e('Saving member location to make it searchable with GEO my WP.', 'GGF'); ?> ">(?)</a> </label> <input type="hidden" value="0" name="ggf_settings[address_fields][gmwbp][use]" /> <input type="checkbox" id="gmw_gf_on" value="1" <?php echo $disabled; ?> name="ggf_settings[address_fields][gmwbp][use]" <?php echo $gmwbp_use; ?> /> <label for="gmw_settings_use" class="checkbox-label"><?php echo $message; ?> </label> </div> </div> <?php }
function process_add_on_feed($feed_add_on, $feed) { $form = $this->get_form(); $entry = $this->get_entry(); if (is_subclass_of($feed_add_on['class'], 'GFFeedAddOn')) { $add_on = call_user_func(array($feed_add_on['class'], 'get_instance')); $add_on->process_feed($feed, $entry, $form); } else { // Legacy add-ons switch ($feed_add_on['slug']) { case 'gravityformszapier': if (class_exists('GFZapier')) { GFZapier::send_form_data_to_zapier($entry, $form); } break; case 'gravityformsuserregistration': if (class_exists('GFUser')) { GFUser::gf_create_user($entry, $form); } break; } } }
function entry_detail_approval_box($form, $entry) { global $current_user; if (!isset($entry['approval_status'])) { return; } if (isset($_POST['gf_approvals_status']) && check_admin_referer('gf_approvals')) { $new_status = $_POST['gf_approvals_status']; gform_update_meta($entry['id'], 'approval_status_' . $current_user->ID, $new_status); $entry['approval_status_' . $current_user->ID] = $new_status; $entry_approved = true; $entry_rejected = false; foreach ($this->get_feeds($form['id']) as $feed) { if ($feed['is_active'] && $this->is_feed_condition_met($feed, $form, $entry)) { $approver = $feed['meta']['approver']; if (!empty($entry['approval_status_' . $approver])) { if ($entry['approval_status_' . $approver] != 'approved') { $entry_approved = false; } if ($new_status == 'rejected') { $entry_rejected = true; } } } } if ($entry_rejected) { gform_update_meta($entry['id'], 'approval_status', 'rejected'); $entry['approval_status'] = 'rejected'; do_action('gform_approvals_entry_rejected', $entry, $form); } elseif ($entry_approved) { gform_update_meta($entry['id'], 'approval_status', 'approved'); $entry['approval_status'] = 'approved'; // Integration with the User Registration Add-On if (class_exists('GFUser')) { GFUser::gf_create_user($entry, $form); } // Integration with the Zapier Add-On if (class_exists('GFZapier')) { GFZapier::send_form_data_to_zapier($entry, $form); } do_action('gform_approvals_entry_approved', $entry, $form); } $notifications_to_send = GFCommon::get_notifications_to_send('form_approval', $form, $entry); foreach ($notifications_to_send as $notification) { GFCommon::send_notification($notification, $form, $entry); } } $status = __('Pending Approval', 'gravityformsapprovals'); $approve_icon = '<i class="fa fa-check" style="color:green"></i>'; $reject_icon = '<i class="fa fa-times" style="color:red"></i>'; if ($entry['approval_status'] == 'approved') { $status = $approve_icon . ' ' . __('Approved', 'gravityformsapprovals'); } elseif ($entry['approval_status'] == 'rejected') { $status = $reject_icon . ' ' . __('Rejected', 'gravityformsapprovals'); } ?> <div class="postbox"> <h3><?php echo $status; ?> </h3> <div style="padding:10px;"> <ul> <?php $has_been_approved = false; $current_user_is_approver = false; foreach ($this->get_feeds($form['id']) as $feed) { if ($feed['is_active']) { $approver = $feed['meta']['approver']; if ($feed['is_active'] && $this->is_feed_condition_met($feed, $form, $entry)) { $user_info = get_user_by('id', $approver); $status = $entry['approval_status_' . $approver]; if ($status === false) { $status = 'pending'; } elseif ($status != 'pending') { $has_been_approved = true; } if ($status === false || $status == 'pending') { if ($current_user->ID == $approver) { $current_user_is_approver = true; } } echo '<li>' . $user_info->display_name . ': ' . $status . '</li>'; } } } if ($has_been_approved) { add_action('gform_entrydetail_update_button', array($this, 'remove_entrydetail_update_button'), 10); } ?> </ul> <div> <?php if ($current_user_is_approver) { ?> <form method="post" id="sidebar_form" enctype='multipart/form-data'> <?php wp_nonce_field('gf_approvals'); ?> <button name="gf_approvals_status" value="approved" type="submit" class="button"> <?php echo $approve_icon; ?> <?php _e('Approve', 'gravityformsapprovals'); ?> </button> <button name="gf_approvals_status" value="rejected" type="submit" class="button"> <?php echo $reject_icon; ?> <?php _e('Reject', 'gravityformsapprovals'); ?> </button> </form> <?php } ?> </div> </div> </div> <?php }
public function trigger_workflow_complete($form, $entry) { // Integration with the User Registration Add-On if (class_exists('GFUser')) { GFUser::gf_create_user($entry, $form); } // Integration with the Zapier Add-On if (class_exists('GFZapier')) { GFZapier::send_form_data_to_zapier($entry, $form); } GFAPI::send_notifications($form, $entry, 'workflow_complete'); }
/** * 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); }