Exemplo n.º 1
0
 /**
  * Returns admin ID of website
  * @author Howard R <*****@*****.**>
  * @static
  * @return int
  */
 public static function get_admin_id()
 {
     return wpl_users::get_id_by_email(wpl_global::get_wp_option('admin_email', NULL));
 }
Exemplo n.º 2
0
 /**
  * Sets recipients
  * @author Howard R <*****@*****.**>
  * @param array $recipients
  * @return array
  */
 public function set_recipients($recipients)
 {
     if (!is_array($recipients)) {
         $recipients = array($recipients);
     }
     $ex = trim($this->notification_data['additional_memberships']) != '' ? explode(',', $this->notification_data['additional_memberships']) : array();
     if (is_array($ex) and count($ex) >= 1) {
         foreach ($ex as $value) {
             array_push($recipients, $value);
         }
     }
     $ex = trim($this->notification_data['additional_users']) != '' ? explode(',', $this->notification_data['additional_users']) : array();
     if (is_array($ex) and count($ex) >= 1) {
         foreach ($ex as $value) {
             array_push($recipients, $value);
         }
     }
     $ex = trim($this->notification_data['additional_emails']) != '' ? explode(',', $this->notification_data['additional_emails']) : array();
     if (is_array($ex) and count($ex) >= 1) {
         foreach ($ex as $value) {
             array_push($recipients, $value);
         }
     }
     $emails = array();
     foreach ($recipients as $recipient) {
         /** user **/
         if (is_numeric($recipient) and $recipient >= 0) {
             $user_data = wpl_users::get_user($recipient);
             array_push($emails, array($user_data->ID, $user_data->user_email));
         } elseif (is_numeric($recipient) and $recipient < 0) {
             $users = wpl_users::get_wpl_users("AND `membership_id`='{$recipient}'");
             foreach ($users as $user) {
                 array_push($emails, array($user->ID, $user->user_email));
             }
         } elseif (is_string($recipient)) {
             $user_id = wpl_users::get_id_by_email($recipient);
             if (!$user_id) {
                 $user_id = 0;
             }
             array_push($emails, array($user_id, $recipient));
         }
     }
     return $emails;
 }