get_sidebar('profile-left'); ?> <div class="column fivecol"> <div class="element-title indented"> <h1><?php _e('My Settings', 'makery'); ?> </h1> </div> <?php ThemexInterface::renderTemplateContent('profile-settings'); ?> <form action="" method="POST" class="site-form"> <div class="message"> <?php ThemexInterface::renderMessages(themex_value('success', $_POST, false)); ?> </div> <table class="profile-fields"> <tbody> <tr> <th><?php _e('Notifications', 'makery'); ?> </th> <td> <div class="element-select"> <span></span> <?php echo ThemexInterface::renderOption(array('id' => 'notices', 'type' => 'select', 'value' => esc_attr(ThemexUser::$data['current']['settings']['notices']), 'options' => array('1' => __('Enabled', 'makery'), '0' => __('Disabled', 'makery')), 'wrap' => false)); ?>
/** * Resets password * * @access public * @param array $data * @return void */ public static function resetPassword($data) { global $wpdb, $wp_hasher; if (email_exists(sanitize_email($data['user_email']))) { $user = get_user_by('email', sanitize_email($data['user_email'])); do_action('lostpassword_post'); $login = $user->user_login; $email = $user->user_email; do_action('retrieve_password', $login); $allow = apply_filters('allow_password_reset', true, $user->ID); if (!$allow || is_wp_error($allow)) { ThemexInterface::$messages[] = __('Password recovery not allowed', 'academy'); } else { $key = wp_generate_password(20, false); do_action('retrieve_password_key', $login, $key); if (empty($wp_hasher)) { require_once ABSPATH . 'wp-includes/class-phpass.php'; $wp_hasher = new PasswordHash(8, true); } $hashed = $wp_hasher->HashPassword($key); $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $login)); $link = network_site_url('wp-login.php?action=rp&key=' . $key . '&login='******'login'); $message = ThemexCore::getOption('email_password', 'Hi, %username%! Click this link to reset your password %link%'); $keywords = array('username' => $user->user_login, 'link' => $link); if (themex_mail($email, __('Password Recovery', 'academy'), themex_keywords($message, $keywords))) { ThemexInterface::$messages[] = __('Password reset link is sent', 'academy'); } else { ThemexInterface::$messages[] = __('Error sending email', 'academy'); } } } else { ThemexInterface::$messages[] = __('Invalid email address', 'academy'); } ThemexInterface::renderMessages(); die; }
?> <h1><?php the_title(); ?> </h1> <?php the_content(); ?> <div class="quiz-listing"> <form id="quiz_form" action="<?php the_permalink(); ?> " method="POST"> <div class="message"> <?php ThemexInterface::renderMessages(ThemexLesson::$data['progress']); ?> </div> <?php $counter = 0; foreach (ThemexLesson::$data['quiz']['questions'] as $key => $question) { $counter++; ?> <div class="quiz-question <?php echo $question['type']; ?> "> <div class="question-title"> <div class="question-number"><?php echo $counter; ?>
/** * Submits user message * * @access public * @param int $ID * @param array $data * @return void */ public static function submitMessage($ID, $data) { $user = intval(themex_value('user_id', $data)); if (!empty($user)) { $message = sanitize_text_field(themex_value('message', $data)); if (empty($message)) { ThemexInterface::$messages[] = '"' . __('Message', 'makery') . '" ' . __('field is required', 'makery'); } if (empty(ThemexInterface::$messages)) { $subject = __('New Message', 'makery'); $content = ThemexCore::getOption('email_message', 'Sender: %user%<br />Message: %message%'); $receiver = get_userdata($user); $sender = get_userdata($ID); $keywords = array('user' => '<a href="' . get_author_posts_url($sender->ID) . '">' . $sender->user_login . '</a>', 'message' => wpautop($message)); $content = themex_keywords($content, $keywords); themex_mail($receiver->user_email, $subject, $content, $sender->user_email); ThemexInterface::$messages[] = __('Message has been successfully sent', 'makery'); ThemexInterface::renderMessages(true); } else { ThemexInterface::renderMessages(); } } die; }
/** * Submits shop report * * @access public * @param array $data * @return void */ public static function submitReport($data) { $shop = intval(themex_value('shop_id', $data)); if (!empty($shop)) { $reason = sanitize_text_field(themex_value('reason', $data)); if (empty($reason)) { ThemexInterface::$messages[] = '"' . __('Reason', 'makery') . '" ' . __('field is required', 'makery'); } if (empty(ThemexInterface::$messages)) { $subject = __('Shop Report', 'makery'); $content = ThemexCore::getOption('email_shop_report', 'Sender: %user%<br />Shop: %shop%<br />Reason: %reason%'); $user = get_userdata(get_current_user_id()); $keywords = array('user' => '<a href="' . get_author_posts_url($user->ID) . '">' . $user->user_login . '</a>', 'shop' => '<a href="' . get_permalink($shop) . '">' . get_the_title($shop) . '</a>', 'reason' => wpautop($reason)); $content = themex_keywords($content, $keywords); themex_mail(get_option('admin_email'), $subject, $content, $user->user_email); ThemexInterface::$messages[] = __('Report has been successfully sent', 'makery'); ThemexInterface::renderMessages(true); } else { ThemexInterface::renderMessages(); } } die; }
/** * Submits form data * * @access public * @return void */ public static function submitData() { self::refresh(); parse_str($_POST['data'], $data); if (isset($data['slug']) && self::isActive($data['slug'])) { if (isset(self::$data[$data['slug']]['captcha'])) { session_start(); $posted_code = md5($data['captcha']); $session_code = $_SESSION['captcha']; if ($session_code != $posted_code) { ThemexInterface::$messages[] = __('The verification code is incorrect', 'academy'); } } foreach (self::$data[$data['slug']]['fields'] as $field) { $ID = themex_sanitize_key($field['name']); $field['name'] = themex_get_string($ID, 'name', $field['name']); if ((!isset($data[$ID]) || trim($data[$ID]) == '') && !isset($field['optional']) && $field['type'] != 'checkbox') { ThemexInterface::$messages[] = '"' . $field['name'] . '" ' . __('field is required', 'academy'); } else { if ($field['type'] == 'number' && !is_numeric($data[$ID])) { ThemexInterface::$messages[] = '"' . $field['name'] . '" ' . __('field can only contain numbers', 'academy'); } if ($field['type'] == 'email' && !is_email($data[$ID])) { ThemexInterface::$messages[] = __('You have entered an invalid email address', 'academy'); } } } if (!empty(ThemexInterface::$messages)) { ThemexInterface::renderMessages(); } else { $email = get_option('admin_email'); $subject = __('Contact', 'academy'); $message = ''; foreach (self::$data[$data['slug']]['fields'] as $field) { $ID = themex_sanitize_key($field['name']); $field['name'] = themex_get_string($ID, 'name', $field['name']); if ($field['type'] == 'select') { $field['options'] = themex_get_string($ID, 'options', $field['options']); $items = explode(',', $field['options']); if (isset($items[$data[$ID] - 1])) { $data[$ID] = $items[$data[$ID] - 1]; } else { $data[$ID] = '–'; } } else { if ($field['type'] == 'textarea') { $data[$ID] = nl2br($data[$ID]); } } $message .= '<strong>' . $field['name'] . '</strong>: ' . $data[$ID] . '<br />'; } if (themex_mail($email, $subject, $message) && isset(self::$data[$data['slug']]['message'])) { $message = themex_get_string($data['slug'], 'message', self::$data[$data['slug']]['message']); ThemexInterface::$messages[] = $message; } ThemexInterface::renderMessages(true); } } die; }