Exemplo n.º 1
0
 /**
  * Does the party with the specified user name exist?
  */
 public static function does_party_exist($user_name)
 {
     $party_data = EntityAPI::get_by_field('party', 'user_name', $user_name);
     if (isset($party_data['id'])) {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public static function do_reset_content_user_password($user_name)
 {
     // 1. Verify that the user name exists in the system
     $user_party_data = EntityAPI::get_by_field('party', 'user_name', $user_name);
     if (!isset($user_party_data['id'])) {
         return array('has_errors' => true, 'message' => "Sorry the username you provided is not registered");
     }
     // 2. Load the person associated with the party
     $user_person_data = EntityAPI::get_by_field('person', 'person_party', $user_party_data['id']);
     if (!isset($user_person_data['id'])) {
         return array('has_errors' => true, 'message' => "Sorry could not load the data for specified individual");
     }
     // Build the content user data
     $content_user_data = array('user_pass' => SecurityAPI::generate_password(), 'last_name' => $user_person_data['last_name'], 'first_name' => $user_person_data['first_name'], 'user_login' => $user_party_data['user_name']);
     MailAPI::do_send_user_password_email($content_user_data, array());
     return array('has_errors' => false, 'content_user' => $content_user_data);
 }
 /**
  * 
  */
 public static function edit_individual($content_user_data, $party_data)
 {
     $entity_data = EntityAPI::get_by_field('person', 'person_party', $party_data['id']);
     if (!isset($entity_data['id'])) {
         return EntityAPIUtils::init_error($content_user_data, 'Could not find the specified individual');
     }
     $entity_data['edit_mode'] = false;
     $entity_data['email'] = $content_user_data['user_login'];
     $entity_data['last_name'] = $content_user_data['last_name'];
     $entity_data['first_name'] = $content_user_data['first_name'];
     if (isset($content_user_data['description'])) {
         $entity_data['description'] = $content_user_data['description'];
     }
     if (isset($content_user_data['display_name'])) {
         $entity_data['display_name'] = $content_user_data['display_name'];
     }
     $entity_data = PartyAPI::do_edit_individual($entity_data, $party_data);
     return $entity_data;
 }
Exemplo n.º 4
0
 /**
  * Just a helper method to reduce amount of ugly typing
  */
 public static function get_by_email($user_name)
 {
     return EntityAPI::get_by_field('party', 'user_name', $user_name);
 }