コード例 #1
0
 /**
  * Display widget content.
  *
  * @access private
  * @since 1.0.0
  * @return void
  */
 public function widget($args, $instance)
 {
     ob_start();
     echo $args['before_widget'];
     echo $args['before_title'];
     echo $instance['title'];
     echo $args['after_title'];
     if ($instance['profile'] == 1) {
         $instance['profile'] = true;
     }
     get_wpum_template('recently-registered.php', array('amount' => $instance['amount'], 'link_to_profile' => $instance['profile']));
     echo $args['after_widget'];
     $output = ob_get_clean();
     echo $output;
 }
コード例 #2
0
 /**
  * Output the form.
  *
  * @access public
  * @since 1.0.0
  * @return void
  */
 public static function output($atts = array())
 {
     // Get fields
     self::get_password_fields();
     if (isset($_POST['submit_wpum_password'])) {
         // Show errors from fields
         self::show_errors();
         // Show confirmation messages
         self::show_confirmations();
     }
     // Display template
     if (is_user_logged_in()) {
         get_wpum_template('already-logged-in.php', array('args' => $atts));
         // Show psw form if not logged in
     } else {
         get_wpum_template('forms/password-form.php', array('atts' => $atts, 'form' => self::$form_name, 'user_fields' => self::get_fields('user'), 'password_fields' => self::get_fields('password')));
     }
 }
コード例 #3
0
            esc_attr_e($key, 'wpum');
            ?>
">
					<label for="<?php 
            esc_attr_e($key, 'wpum');
            ?>
"><?php 
            echo esc_html($field['label']);
            ?>
</label>
					<div class="field <?php 
            echo $field['required'] ? 'required-field' : '';
            ?>
">
						<?php 
            get_wpum_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field));
            ?>
					</div>
				</fieldset>
			<?php 
        }
        ?>
			<!-- End Password User Fields -->

		<?php 
    }
    ?>

		<?php 
    do_action('wpum_after_inside_password_form_template', $atts);
    ?>
コード例 #4
0
ファイル: functions.php プロジェクト: pierreglardon/gdv-ttc
/**
 * Displays the html of a field within a form.
 *
 * @since 1.0.0
 * @return mixed
 */
function wpum_get_field_input_html($key, $field)
{
    if (wpum_field_type_exists($field['type'])) {
        $object = wpum_get_field_type_object($field['type']);
        if (method_exists($object->class, "input_html")) {
            echo call_user_func($object->class . "::input_html", $key, $field);
        } else {
            get_wpum_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field));
        }
    } else {
        echo __('This field type has no output', 'wpum');
    }
}
コード例 #5
0
 /**
  * Output the form.
  *
  * @access public
  * @since 1.0.0
  * @return void
  */
 public static function output($atts = array())
 {
     // Get fields
     self::get_update_password_fields();
     if (isset($_POST['submit_wpum_update_password'])) {
         // Show errors from fields
         self::show_errors();
         // Show confirmation messages
         self::show_confirmations();
     }
     // Display template
     if (is_user_logged_in()) {
         get_wpum_template('forms/password-update-form.php', array('form' => self::$form_name, 'password_fields' => self::get_fields('password_update')));
     } else {
         echo wpum_login_form();
     }
 }
コード例 #6
0
ファイル: functions.php プロジェクト: pierreglardon/gdv-ttc
 /**
  * Display login form.
  *
  * @since 1.0.0
  * @access public
  * @return string
  */
 function wpum_login_form($args = array())
 {
     $defaults = array('echo' => true, 'redirect' => wpum_get_login_redirect_url(), 'form_id' => null, 'label_username' => wpum_get_username_label(), 'label_password' => __('Password', 'wpum'), 'label_remember' => __('Remember Me', 'wpum'), 'label_log_in' => __('Login', 'wpum'), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'login_link' => 'yes', 'psw_link' => 'yes', 'register_link' => 'yes');
     // Parse incoming $args into an array and merge it with $defaults
     $args = wp_parse_args($args, $defaults);
     // Show already logged in message
     if (is_user_logged_in()) {
         get_wpum_template('already-logged-in.php', array('args' => $args));
         // Show login form if not logged in
     } else {
         get_wpum_template('forms/login-form.php', array('args' => $args));
         // Display helper links
         do_action('wpum_do_helper_links', $args['login_link'], $args['register_link'], $args['psw_link']);
     }
 }
コード例 #7
0
ファイル: functions.php プロジェクト: pierreglardon/gdv-ttc
 /**
  * Display overview of the current user profile.
  *
  * @since 1.0.0
  * @access public
  * @return void.
  */
 function wpum_current_user_overview()
 {
     $current_user = wp_get_current_user();
     get_wpum_template('user-overview.php', array('current_user' => $current_user));
 }
コード例 #8
0
 /**
  * Output the form.
  *
  * @access public
  * @since 1.0.0
  * @return void
  */
 public static function output($atts = array())
 {
     // Get the tabs
     $current_account_tab = wpum_get_current_account_tab();
     $all_tabs = array_keys(wpum_get_account_page_tabs());
     // Get fields
     self::get_profile_fields();
     // Display template
     if (is_user_logged_in()) {
         if (isset($_POST['submit_wpum_profile'])) {
             // Show errors from fields
             self::show_errors();
         }
         get_wpum_template('account.php', array('atts' => $atts, 'form' => self::$form_name, 'fields' => self::get_fields('profile'), 'user_id' => self::$user->ID, 'current_tab' => $current_account_tab, 'all_tabs' => $all_tabs));
         // Show login form if not logged in
     } else {
         echo wpum_login_form();
     }
 }
コード例 #9
0
ファイル: actions.php プロジェクト: pierreglardon/gdv-ttc
/**
 * Adds total number of users found on top of the directory.
 *
 * @since 1.0.0
 * @param array   $directory_args directory arguments.
 * @return void
 */
function wpum_directory_topbar($directory_args)
{
    get_wpum_template("directory/top-bar.php", array('users_found' => $directory_args['users_found'], 'directory_id' => $directory_args['directory_id']));
}
コード例 #10
0
/**
 * Display content of the first tab into the account page.
 *
 * @since 1.0.0
 * @access public
 * @return void
 */
function wpum_show_account_edit_form($current_tab, $all_tabs, $form, $fields, $user_id, $atts)
{
    get_wpum_template('forms/account-form.php', array('atts' => $atts, 'form' => $form, 'fields' => $fields, 'user_id' => $user_id));
}
コード例 #11
0
ファイル: actions.php プロジェクト: pierreglardon/gdv-ttc
/**
 * Display user name in profile.php template.
 *
 * @since 1.0.0
 * @param object $user_data holds WP_User object
 * @access public
 * @return void
 */
function wpum_profile_show_user_links($user_data)
{
    $output = get_wpum_template('profile/profile-links.php', array('user_data' => $user_data));
    echo $output;
}
コード例 #12
0
 /**
  * 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')));
     }
 }
コード例 #13
0
 /**
  * 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;
 }
コード例 #14
0
/**
 * Display a message loading the message.php template file.
 *
 * @since 1.0.0
 * @param string  $id   html ID attribute.
 * @param string  $type message type: success/notice/error.
 * @param string  $text the text of the message.
 * @return void
 */
function wpum_message($args)
{
    $defaults = array('id' => 'wpum-notice', 'type' => 'success', 'text' => '');
    // Parse incoming $args into an array and merge it with $defaults
    $args = wp_parse_args($args, $defaults);
    echo get_wpum_template('message.php', array('id' => $args['id'], 'type' => $args['type'], 'text' => $args['text']));
}
コード例 #15
0
ファイル: tabs.php プロジェクト: pierreglardon/gdv-ttc
/**
 * Load content for the "comments" tab.
 * 
 * @since 1.0.0
 * @access public
 * @param object $user_data holds WP_User object
 * @param array $tabs holds all the registered tabs
 * @param string $current_tab_slug the slug of the current tab
 * @return void
 */
function wpum_profile_tab_content_comments($user_data, $tabs, $current_tab_slug)
{
    echo get_wpum_template('profile/profile-comments.php', array('user_data' => $user_data, 'tabs' => $tabs, 'slug' => $current_tab_slug));
}
コード例 #16
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 -->
コード例 #17
0
        if (is_array($field['value'])) {
            ?>
			<?php 
            foreach ($field['value'] as $value) {
                ?>
				<?php 
                get_wpum_template('form-fields/uploaded-file-html.php', array('key' => $key, 'name' => 'current_' . $field_name, 'value' => $value, 'field' => $field, 'field_name' => $field_name));
                ?>
			<?php 
            }
            ?>
		<?php 
        } elseif ($value = $field['value']) {
            ?>
			<?php 
            get_wpum_template('form-fields/uploaded-file-html.php', array('key' => $key, 'name' => 'current_' . $field_name, 'value' => $value, 'field' => $field, 'field_name' => $field_name));
            ?>
		<?php 
        }
        ?>
	<?php 
    }
    ?>
</div>
<?php 
}
?>

<input type="file" class="<?php 
echo esc_attr(implode(' ', $classes));
?>
コード例 #18
0
 /**
  * Output the form.
  *
  * @access public
  * @since 1.2.0
  * @return void
  */
 public static function output($atts = array())
 {
     // Get fields.
     self::get_group_fields();
     if (isset($_POST['submit_wpum_group_form'])) {
         // Show errors from fields.
         self::show_errors();
         // Show confirmation messages.
         self::show_confirmations();
     }
     $args = array('atts' => $atts, 'form' => self::$form_name, 'group_id' => self::get_group_id(), 'group_fields' => self::get_fields('custom-group'));
     get_wpum_template('forms/group-form.php', $args);
 }