Example #1
0
 private function save_notification()
 {
     $info = wpl_request::getVar('info');
     wpl_notifications::save_notification($info);
     $message = __('Operation was successful.', WPL_TEXTDOMAIN);
     $response = array('success' => 1, 'message' => $message);
     echo json_encode($response);
     exit;
 }
Example #2
0
 /**
  * Sends welcome email to user after registeration
  * @author Howard <*****@*****.**>
  * @static
  * @param array $params
  * @return boolean
  */
 public static function user_registered($params)
 {
     $replacements = $params[0];
     $notification = new wpl_notifications('email');
     $notification->prepare(5, $replacements);
     /** Disabled **/
     if (!$notification->notification_data['enabled']) {
         return false;
     }
     $user = wpl_users::get_user($params[0]['user_id']);
     $replacements['name'] = isset($user->data->wpl_data) ? $user->data->wpl_data->first_name : $user->data->display_name;
     $replacements['password'] = $params[0]['password'];
     $replacements['username'] = $user->data->user_login;
     $link = wpl_global::get_wp_site_url();
     $replacements['site_address'] = '<a target="_blank" href="' . $link . '">' . $link . '</a>';
     $notification->replacements = $notification->set_replacements($replacements);
     $notification->rendered_content = $notification->render_notification_content();
     $notification->recipients = $notification->set_recipients(array($user->data->user_email));
     $notification->send();
     return true;
 }
Example #3
0
 public function modify()
 {
     $this->notification = wpl_notifications::get_notifications("AND `id`='" . wpl_db::escape($this->id) . "'", 'loadObject');
     $this->additional_memberships = explode(',', $this->notification->additional_memberships);
     $this->additional_users = explode(',', $this->notification->additional_users);
     $this->additional_emails = explode(',', $this->notification->additional_emails);
     $this->users = wpl_users::get_wpl_users();
     $this->memberships = wpl_users::get_wpl_memberships();
     $this->memberships_array = self::unset_additional_receipts($this->additional_memberships, $this->memberships);
     $this->users_array = self::unset_additional_receipts($this->additional_users, $this->users);
     $this->template_path = wpl_notifications::get_template_path($this->notification->template);
     $this->template = wpl_notifications::get_template_content($this->template_path, true);
     $this->template = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' . $this->template;
     parent::render($this->tpl_path, $this->tpl);
 }
Example #4
0
 /**
  * User Contact activity. It's for contacting to user directly from profile show page
  * @author Howard <*****@*****.**>
  * @static
  * @param type $params
  * @return boolean
  */
 public static function contact_profile($params)
 {
     $replacements = $params[0];
     $notification = new wpl_notifications('email');
     $notification->prepare(3, $replacements);
     /** Disabled **/
     if (!$notification->notification_data['enabled']) {
         return false;
     }
     $user = wpl_users::get_user($params[0]['user_id']);
     $notification->replacements = $notification->set_replacements($replacements);
     $notification->rendered_content = $notification->render_notification_content();
     $notification->recipients = $notification->set_recipients(array($user->data->user_email));
     $notification->send();
     return true;
 }