Example #1
0
 public static function downgrade_paypal_user($entry, $config, $transaction_id)
 {
     $paypal_config = self::get_paypal_config($entry['form_id'], $entry);
     if (!$paypal_config || !rgars($paypal_config, 'meta/update_user_action')) {
         return;
     }
     $user = GFUserData::get_user_by_entry_id($entry['id']);
     $user->set_role(rgars($paypal_config, 'meta/update_user_action'));
 }
Example #2
0
 /**
  * Maybe update user role of the specified lead and feed
  *
  * @param array $lead
  * @param Feed $feed
  */
 private function maybe_update_user_role($lead, $feed)
 {
     $user = false;
     // Gravity Forms User Registration Add-On
     if (class_exists('GFUserData')) {
         $user = GFUserData::get_user_by_entry_id($lead['id']);
     }
     if (false === $user) {
         $created_by = $lead[Pronamic_WP_Pay_Extensions_GravityForms_LeadProperties::CREATED_BY];
         $user = new WP_User($created_by);
     }
     if ($user && !empty($feed->user_role_field_id) && isset($lead[$feed->user_role_field_id])) {
         $value = $lead[$feed->user_role_field_id];
         $value = GFCommon::get_selection_value($value);
         $user->set_role($value);
     }
 }