/**
  * List's all the posts by the user
  *
  * @global object $wpdb
  * @global object $userdata
  */
 function post_listing($post_type)
 {
     global $post;
     $pagenum = isset($_GET['pagenum']) ? intval($_GET['pagenum']) : 1;
     //delete post
     if (isset($_REQUEST['action']) && $_REQUEST['action'] == "del") {
         $this->delete_post();
     }
     //show delete success message
     if (isset($_GET['msg']) && $_GET['msg'] == 'deleted') {
         echo '<div class="success">' . __('Post Deleted', 'wpuf') . '</div>';
     }
     $args = array('author' => get_current_user_id(), 'post_status' => array('draft', 'future', 'pending', 'publish', 'private'), 'post_type' => $post_type, 'posts_per_page' => wpuf_get_option('per_page', 'wpuf_dashboard', 10), 'paged' => $pagenum);
     $original_post = $post;
     $dashboard_query = new WP_Query(apply_filters('wpuf_dashboard_query', $args));
     $post_type_obj = get_post_type_object($post_type);
     wpuf_load_template('dashboard.php', array('post_type' => $post_type, 'userdata' => wp_get_current_user(), 'dashboard_query' => $dashboard_query, 'post_type_obj' => $post_type_obj, 'post' => $post, 'pagenum' => $pagenum));
     wp_reset_postdata();
     $this->user_info();
 }
Exemple #2
0
 /**
  * Shows the login form
  *
  * @return string
  */
 function login_form()
 {
     $login_page = $this->get_login_url();
     if (false === $login_page) {
         return;
     }
     ob_start();
     if (is_user_logged_in()) {
         wpuf_load_template('logged-in.php', array('user' => wp_get_current_user()));
     } else {
         $action = isset($_GET['action']) ? $_GET['action'] : 'login';
         $args = array('action_url' => $login_page);
         switch ($action) {
             case 'lostpassword':
                 $this->messages[] = __('Please enter your username or email address. You will receive a link to create a new password via email.', 'wpuf');
                 wpuf_load_template('lost-pass-form.php', $args);
                 break;
             case 'rp':
             case 'resetpass':
                 if (isset($_GET['reset']) && $_GET['reset'] == 'true') {
                     printf('<div class="wpuf-message">' . __('Your password has been reset. %s', 'wpuf') . '</div>', sprintf('<a href="%s">%s</a>', $this->get_action_url('login'), __('Log In', 'wpuf')));
                     return;
                 } else {
                     $this->messages[] = __('Enter your new password below..', 'wpuf');
                     wpuf_load_template('reset-pass-form.php', $args);
                 }
                 break;
             default:
                 if (isset($_GET['checkemail']) && $_GET['checkemail'] == 'confirm') {
                     $this->messages[] = __('Check your e-mail for the confirmation link.', 'wpuf');
                 }
                 if (isset($_GET['loggedout']) && $_GET['loggedout'] == 'true') {
                     $this->messages[] = __('You are now logged out.', 'wpuf');
                 }
                 wpuf_load_template('login-form.php', $args);
                 break;
         }
     }
     return ob_get_clean();
 }