/**
 * Adds an error message to the login form if captcha validation fails
 *
 * @since 1.0.0
 * @return void
 */
function wpum_recaptcha_error_message()
{
    if (isset($_GET['captcha']) && $_GET['captcha'] == 'failed_captcha') {
        $args = array('id' => 'wpum-login-captcha-failed', 'type' => 'error', 'text' => __('Captcha validation failed.', 'wpumre'));
        $warning = wpum_message($args, true);
    }
}
示例#2
0
/**
 * Display error message above wpum registration form.
 * @return void
 */
function wpel_display_error_messages()
{
    if (isset($_GET['registration_error']) && $_GET['registration_error'] !== '') {
        $error_code = $_GET['registration_error'];
        $message = __('Something went wrong.');
        switch ($error_code) {
            case 'existing_user_login':
                $message = __('Your Envato username is already registered. If you already have an account, please login with that account.');
                break;
            case 'existing_user_email':
                $message = __('Your Envato email address is already registered. If you already have an account, please login with that account.');
                break;
            case 'envato_offline':
                $message = __('There seems to be a problem with Envato. Please try again later or manually register an account.');
                break;
        }
        $settings = array('id' => 'envato-registration-error', 'type' => 'error', 'text' => $message);
        wpum_message($settings);
    }
}
示例#3
0
<!-- start directory -->
<div id="wpum-user-directory-<?php 
echo $directory_args['directory_id'];
?>
" class="wpum-user-directory directory-<?php 
echo $directory_args['directory_id'];
?>
">

	<!-- Start Users list -->
	<?php 
do_action('wpum_before_user_directory', $directory_args);
if (!empty($directory_args['user_data'])) {
    echo '<ul class="wpum-user-listings">';
    foreach ($directory_args['user_data'] as $user) {
        // Load single-user.php template to display each user individually
        get_wpum_template("directory/single-user.php", array('user' => $user));
    }
    echo "</ul>";
} else {
    $args = array('id' => 'wpum-no-user-found', 'type' => 'notice', 'text' => __('No users have been found', 'wpum'));
    $warning = wpum_message($args, true);
}
do_action('wpum_after_user_directory', $directory_args);
?>

	<!-- end users list -->

</div>
<!-- end directory -->
			<div class="wpum-single-comment" id="wpum-comment-<?php 
        echo $comment->comment_ID;
        ?>
">

			<?php 
        // Get Comment details
        $comment_content = wp_trim_words($comment->comment_content, $num_words = 13, $more = null);
        $the_post = get_the_title($comment->comment_post_ID);
        $the_permalink = get_post_permalink($comment->comment_post_ID);
        $the_date = get_comment_date(get_option('date_format'), $comment->comment_ID);
        ?>

			<p><?php 
        printf(_x('"%s" on <a href="%s">%s</a>, %s.', 'This text displays the comments left by the user on his profile page.', 'wpum'), $comment_content, $the_permalink, $the_post, $the_date);
        ?>
</p>

			</div>

		<?php 
    }
} else {
    // Display error message
    $args = array('id' => 'wpum-comments-not-found', 'type' => 'notice', 'text' => sprintf(__('%s has not made any comment yet.', 'wpum'), $user_data->display_name));
    wpum_message($args);
}
?>

</div>
示例#5
0
/**
 * Checks if profiles are available.
 *
 * @uses wpum_is_single_profile
 * @uses wpum_guests_can_view_profiles
 * @uses wpum_members_can_view_profiles
 * @since 1.0.0
 * @return bool
 */
function wpum_can_access_profile()
{
    $pass = true;
    // Check if not logged in and on profile page - no given user
    if (!is_user_logged_in() && !wpum_is_single_profile()) {
        // Display error message
        $args = array('id' => 'wpum-guests-disabled', 'type' => 'notice', 'text' => sprintf(__('This content is available to members only. Please <a href="%s">login</a> or <a href="%s">register</a> to view this area.', 'wpum'), wpum_get_core_page_url('login'), wpum_get_core_page_url('register')));
        wpum_message($args);
        $pass = false;
    }
    // Block guests on single profile page if option disabled
    if (!is_user_logged_in() && wpum_is_single_profile() && !wpum_guests_can_view_profiles()) {
        // Display error message
        $args = array('id' => 'wpum-guests-disabled', 'type' => 'notice', 'text' => sprintf(__('This content is available to members only. Please <a href="%s">login</a> or <a href="%s">register</a> to view this area.', 'wpum'), wpum_get_core_page_url('login'), wpum_get_core_page_url('register')));
        wpum_message($args);
        $pass = false;
    }
    // Block members on single profile page if option disabled
    if (is_user_logged_in() && wpum_is_single_profile() && !wpum_members_can_view_profiles() && !wpum_is_own_profile()) {
        // Display error message
        $args = array('id' => 'wpum-no-access', 'type' => 'notice', 'text' => __('You are not authorized to access this area.', 'wpum'));
        wpum_message($args);
        $pass = false;
    }
    return apply_filters('wpum_can_access_profile', $pass);
}
/**
 * Display update messages on the account page.
 *
 * @since 1.0.0
 * @access public
 * @return void
 */
function wpum_profile_update_messages()
{
    if (isset($_GET['updated']) && $_GET['updated'] == 'success') {
        $args = array('id' => 'wpum-profile-updated', 'type' => 'success', 'text' => apply_filters('wpum_account_update_success_message', __('Profile successfully updated.', 'wpum')));
        wpum_message($args);
    }
    if (isset($_GET['updated']) && $_GET['updated'] == 'error') {
        $args = array('id' => 'wpum-profile-error', 'type' => 'error', 'text' => apply_filters('wpum_account_update_error_message', __('Something went wrong.', 'wpum')));
        wpum_message($args);
    }
}
 /**
  * Output the form.
  *
  * @access public
  * @since 1.0.0
  * @return void
  */
 public static function output($atts = array())
 {
     // Get fields
     self::get_registration_fields();
     if (isset($_POST['submit_wpum_register'])) {
         // Show errors from fields
         self::show_errors();
         // Show confirmation messages
         self::show_confirmations();
     }
     // Display template
     if (!get_option('users_can_register')) {
         // Display error message
         $message = array('id' => 'wpum-registrations-disabled', 'type' => 'notice', 'text' => __('Registrations are currently disabled.', 'wpum'));
         wpum_message($message);
     } elseif (is_user_logged_in()) {
         get_wpum_template('already-logged-in.php', array('args' => $atts));
         // Show register form if not logged in
     } else {
         get_wpum_template('forms/registration-form.php', array('atts' => $atts, 'form' => self::$form_name, 'register_fields' => self::get_fields('register')));
     }
 }
 /**
  * User directory shortcode
  *
  * @access public
  * @since  1.0.0
  * @return $output shortcode output
  */
 public function wpum_user_directory($atts, $content = null)
 {
     extract(shortcode_atts(array('id' => null), $atts));
     ob_start();
     $directory_id = intval($id);
     // Check if directory exists
     $check_directory = get_post_status($directory_id);
     // Display error if something is wrong.
     if (!$id || $check_directory !== 'publish') {
         $args = array('id' => 'wpum-no-user-directory-id', 'type' => 'error', 'text' => __('Something went wrong, you have not set a directory ID or the directory is not published.', 'wpum'));
         $warning = wpum_message($args, true);
         return;
     }
     // Prepare Pagination
     $number = wpum_directory_profiles_per_page($directory_id);
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     if ($paged == 1) {
         $offset = 0;
     } else {
         $offset = ($paged - 1) * $number;
     }
     // Make the query
     $args = array('number' => $number, 'offset' => $offset, 'fields' => wpum_get_user_query_fields());
     $user_query = new WP_User_Query(apply_filters("wpum_user_directory_query", $args, $directory_id));
     // Detect which template we should be using.
     $template = "user-directory.php";
     $template_tag = wpum_directory_has_custom_template($directory_id);
     if ($template_tag) {
         $template = "user-directory-{$template_tag}.php";
     }
     // Build Pagination Count
     // Modify $number var if a custom amount is set from the frontend
     // This updates the pagination too.
     if (isset($_GET['amount']) && is_numeric($_GET['amount'])) {
         $number = $_GET['amount'];
     }
     $total_users = $user_query->total_users;
     $total_pages = ceil($total_users / $number);
     // Merge directory details in array
     $directory_args = array('user_data' => $user_query->get_results(), 'users_found' => $user_query->get_total(), 'total_users' => $total_users, 'total_pages' => $total_pages, 'directory_id' => $directory_id, 'paged' => $paged);
     // Load the template
     get_wpum_template($template, array('directory_args' => $directory_args));
     $output = ob_get_clean();
     return $output;
 }