Advertisement
Guest User

Members Page

a guest
Jul 26th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.38 KB | None | 0 0
  1. <?php
  2.  
  3. add_action('admin_menu', 'wpu_admin_menu');
  4.  
  5. add_action('wp_head', 'noindex_users');
  6.  
  7. add_action('wp_head', 'wpu_styles');
  8.  
  9. add_filter('the_content', 'wpu_get_users', 1);
  10.  
  11.  
  12.  
  13. function wpu_get_users($content) {  
  14.  
  15.     if(is_page(get_option('wpu_page_id'))) {
  16.  
  17.        
  18.  
  19.         if(isset($_GET['uid'])) {
  20.  
  21.             display_user();
  22.  
  23.         } else {
  24.  
  25.             echo $content;
  26.  
  27.             display_user_list();
  28.  
  29.         }
  30.  
  31.     } else {
  32.  
  33.         //display the content
  34.  
  35.         return $content;
  36.  
  37.     }
  38.  
  39. }
  40.  
  41.  
  42.  
  43. function wpu_get_roles()
  44.  
  45. {
  46.  
  47.     global $wpdb;
  48.  
  49.    
  50.  
  51.     $administrator = get_option('wpu_roles_admin');
  52.  
  53.     $subscriber = get_option('wpu_roles_subscriber');
  54.  
  55.     $author = get_option('wpu_roles_author');
  56.  
  57.     $editor = get_option('wpu_roles_editor');
  58.  
  59.     $contributor = get_option('wpu_roles_contributor');
  60.  
  61.    
  62.  
  63.     $rolelist = array('administrator'=>$administrator, 'subscriber'=>$subscriber, 'author'=>$author, 'editor'=>$editor, 'contributor'=>$contributor);
  64.  
  65.    
  66.  
  67.     $roles = array();
  68.  
  69.    
  70.  
  71.     foreach($rolelist as $key=>$value)
  72.  
  73.     {
  74.  
  75.         if($value == 'yes')
  76.  
  77.             array_push($roles, $key);
  78.  
  79.         else
  80.  
  81.         {}
  82.  
  83.     }
  84.  
  85.    
  86.  
  87.     if (empty($roles))
  88.  
  89.         $roles = array('administrator', 'subscriber', 'author', 'editor', 'contributor');
  90.  
  91.  
  92.  
  93.     $searches = array();
  94.  
  95.  
  96.  
  97.     foreach ( $roles as $role )
  98.  
  99.         $searches[] = "$wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE '%$role%'";
  100.  
  101.        
  102.  
  103.     //create a string for use in a MySQL statement
  104.  
  105.     $meta_values = implode(' OR ', $searches);
  106.  
  107.    
  108.  
  109.     return $meta_values;
  110.  
  111. }
  112.  
  113.  
  114.  
  115. function display_user_list() {
  116.  
  117.  
  118.  
  119.     // if $_GET['page'] defined, use it as page number
  120.  
  121.     if(isset($_GET['page'])) {
  122.  
  123.         $page = $_GET['page'];
  124.  
  125.     } else {
  126.  
  127.         // by default we show first page
  128.  
  129.         $page = 1;
  130.  
  131.     }
  132.  
  133.     $limit = get_option('wpu_users_per');
  134.  
  135.    
  136.  
  137.     // counting the offset
  138.  
  139.     $offset = ($page - 1) * $limit;
  140.  
  141.    
  142.  
  143.     // Get the authors from the database ordered by user nicename
  144.  
  145.     global $wpdb;
  146.  
  147.     $meta_values = wpu_get_roles();
  148.  
  149.    
  150.  
  151.     $query = "SELECT $wpdb->users.ID, $wpdb->users.user_nicename FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $meta_values ORDER BY $wpdb->users.user_nicename LIMIT $offset, $limit";
  152.  
  153.     $author_ids = $wpdb->get_results($query);
  154.  
  155.    
  156.  
  157.        
  158.  
  159.     $output = '';
  160.  
  161.  
  162.  
  163.     // Loop through each author
  164.  
  165.     foreach($author_ids as $author) {
  166.  
  167.  
  168.  
  169.         // Get user data
  170.  
  171.         $curauth = get_userdata($author->ID);
  172.  
  173.  
  174.  
  175.         $output .= get_user_listing($curauth);
  176.  
  177.     }
  178.  
  179.          
  180.  
  181.     echo $output;
  182.  
  183.  
  184.  
  185.     // how many rows we have in database
  186.  
  187.     $totalitems = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users WHERE ID = ANY (SELECT user_id FROM $wpdb->usermeta WHERE $meta_values)");
  188.  
  189.  
  190.  
  191.     $adjacents = 3;
  192.  
  193.  
  194.  
  195.     $concat = wpu_concat_index();
  196.  
  197.  
  198.  
  199.     echo getPaginationString($page, $totalitems, $limit, $adjacents, $concat);
  200.  
  201. }
  202.  
  203.  
  204.  
  205. function getPaginationString($page = 1, $totalitems, $limit = 15, $adjacents = 1, $concat)
  206.  
  207. {      
  208.  
  209.     //defaults
  210.  
  211.     if(!$adjacents) $adjacents = 1;
  212.  
  213.     if(!$limit) $limit = 15;
  214.  
  215.     if(!$page) $page = 1;
  216.  
  217.    
  218.  
  219.     //other vars
  220.  
  221.     $prev = $page - 1;                                  //previous page is page - 1
  222.  
  223.     $next = $page + 1;                                  //next page is page + 1
  224.  
  225.     $lastpage = ceil($totalitems / $limit);             //lastpage is = total items / items per page, rounded up.
  226.  
  227.     $lpm1 = $lastpage - 1;                              //last page minus 1
  228.  
  229.    
  230.  
  231.     /*
  232.  
  233.         Now we apply our rules and draw the pagination object.
  234.  
  235.         We're actually saving the code to a variable in case we want to draw it more than once.
  236.  
  237.     */
  238.  
  239.     $pagination = "";
  240.  
  241.     if($lastpage > 1)
  242.  
  243.     {  
  244.  
  245.         $pagination .= "<div class=\"wpu-pagination\"";
  246.  
  247.         $pagination .= ">";
  248.  
  249.  
  250.  
  251.         //previous button
  252.  
  253.         if ($page > 1)
  254.  
  255.             $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$prev\">« prev</a>";
  256.  
  257.         else
  258.  
  259.             $pagination .= "<span class=\"wpu-disabled\">« prev</span>";  
  260.  
  261.        
  262.  
  263.         //pages
  264.  
  265.         if ($lastpage < 7 + ($adjacents * 2))   //not enough pages to bother breaking it up
  266.  
  267.         {  
  268.  
  269.             for ($counter = 1; $counter <= $lastpage; $counter++)
  270.  
  271.             {
  272.  
  273.                 if ($counter == $page)
  274.  
  275.                     $pagination .= "<span class=\"wpu-current\">$counter</span>";
  276.  
  277.                 else
  278.  
  279.                     $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$counter\">$counter</a>";                  
  280.  
  281.             }
  282.  
  283.         }
  284.  
  285.         elseif($lastpage >= 7 + ($adjacents * 2))   //enough pages to hide some
  286.  
  287.         {
  288.  
  289.             //close to beginning; only hide later pages
  290.  
  291.             if($page < 1 + ($adjacents * 3))       
  292.  
  293.             {
  294.  
  295.                 for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
  296.  
  297.                 {
  298.  
  299.                     if ($counter == $page)
  300.  
  301.                         $pagination .= "<span class=\"wpu-current\">$counter</span>";
  302.  
  303.                     else
  304.  
  305.                         $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$counter\">$counter</a>";                  
  306.  
  307.                 }
  308.  
  309.                 $pagination .= "<span class=\"wpu-elipses\">...</span>";
  310.  
  311.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$lpm1\">$lpm1</a>";
  312.  
  313.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$lastpage\">$lastpage</a>";    
  314.  
  315.             }
  316.  
  317.             //in middle; hide some front and some back
  318.  
  319.             elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
  320.  
  321.             {
  322.  
  323.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=1\">1</a>";
  324.  
  325.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=2\">2</a>";
  326.  
  327.                 $pagination .= "<span class=\"wpu-elipses\">...</span>";
  328.  
  329.                 for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
  330.  
  331.                 {
  332.  
  333.                     if ($counter == $page)
  334.  
  335.                         $pagination .= "<span class=\"wpu-current\">$counter</span>";
  336.  
  337.                     else
  338.  
  339.                         $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$counter\">$counter</a>";                  
  340.  
  341.                 }
  342.  
  343.                 $pagination .= "...";
  344.  
  345.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$lpm1\">$lpm1</a>";
  346.  
  347.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$lastpage\">$lastpage</a>";    
  348.  
  349.             }
  350.  
  351.             //close to end; only hide early pages
  352.  
  353.             else
  354.  
  355.             {
  356.  
  357.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=1\">1</a>";
  358.  
  359.                 $pagination .= "<a href=\"" . get_permalink() . $concat . "page=2\">2</a>";
  360.  
  361.                 $pagination .= "<span class=\"wpu-elipses\">...</span>";
  362.  
  363.                 for ($counter = $lastpage - (1 + ($adjacents * 3)); $counter <= $lastpage; $counter++)
  364.  
  365.                 {
  366.  
  367.                     if ($counter == $page)
  368.  
  369.                         $pagination .= "<span class=\"wpu-current\">$counter</span>";
  370.  
  371.                     else
  372.  
  373.                         $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$counter\">$counter</a>";                  
  374.  
  375.                 }
  376.  
  377.             }
  378.  
  379.         }
  380.  
  381.        
  382.  
  383.         //next button
  384.  
  385.         if ($page < $counter - 1)
  386.  
  387.             $pagination .= "<a href=\"" . get_permalink() . $concat . "page=$next\">next »</a>";
  388.  
  389.         else
  390.  
  391.             $pagination .= "<span class=\"wpu-disabled\">next »</span>";
  392.  
  393.         $pagination .= "</div>\n";
  394.  
  395.     }
  396.  
  397.    
  398.  
  399.     return $pagination;
  400.  
  401.  
  402.  
  403. }
  404.  
  405.  
  406.  
  407. function wpu_concat_index()
  408.  
  409. {
  410.  
  411.     $url = $_SERVER['REQUEST_URI'];
  412.  
  413.     $permalink = get_permalink(get_the_id());
  414.  
  415.    
  416.  
  417.     if(strpos($permalink, '?'))
  418.  
  419.         return '&';
  420.  
  421.     else
  422.  
  423.         return '?';
  424.  
  425. }
  426.  
  427.  
  428.  
  429. function wpu_concat_single()
  430.  
  431. {
  432.  
  433.     $url = $_SERVER['REQUEST_URI'];
  434.  
  435.     $permalink = get_permalink(get_the_id());
  436.  
  437.    
  438.  
  439.     if(strpos($permalink, '?'))
  440.  
  441.         return '&';
  442.  
  443.     else
  444.  
  445.         return '?';
  446.  
  447. }
  448.  
  449.  
  450.  
  451. function get_user_listing($curauth) {  
  452.  
  453.     global $post;
  454.  
  455.     $concat = wpu_concat_single();
  456.  
  457.     $created = date("F jS, Y", strtotime($curauth->user_registered));
  458.  
  459.    
  460.  
  461.     $html = "<div class=\"wpu-user\">\n";
  462.  
  463.     if (get_option('wpu_image_list')) {
  464.  
  465.         if(get_option('wpu_avatars') == "gravatars") {
  466.  
  467.             $gravatar_type = get_option('wpu_gravatar_type');
  468.  
  469.             $gravatar_size = get_option('wpu_gravatar_size');
  470.  
  471.             $display_gravatar = get_avatar($curauth->user_email, $gravatar_size, $gravatar_type);
  472.  
  473.             $html .= "<div class=\"wpu-avatar\"><a href=\"" . get_permalink($post->ID) . $concat . "uid=$curauth->ID\" title=\"$curauth->display_name\">$display_gravatar</a></div>\n";
  474.  
  475.         } elseif (get_option('wpu_avatars') == "userphoto") {
  476.  
  477.             if(function_exists('userphoto_the_author_photo'))
  478.  
  479.             {
  480.  
  481.                 $html .= "<div class=\"wpu-avatar\"><a href=\"" . get_permalink($post->ID) . $concat . "uid=$curauth->ID\" title=\"$curauth->display_name\">" . userphoto__get_userphoto($curauth->ID, USERPHOTO_THUMBNAIL_SIZE, "", "", array(), "") . "</a></div>\n";
  482.  
  483.             }
  484.  
  485.         }
  486.  
  487.     }
  488.  
  489.     $html .= "<div class=\"wpu-id\"><strong>$curauth->display_name</strong></div>\n";
  490.  
  491.     $html .= "<div class=\"wpu-links\"><a href=\"" . get_permalink($post->ID) . $concat . "uid=$curauth->ID\" title=\"View this author's post\">View posts and comments by $curauth->display_name</a></div>\n";
  492.  
  493.  
  494.     $html .= "<p><strong>Joined on:</strong>  " . $created . "</p>";
  495.  
  496.     if (get_option('wpu_description_list')) {
  497.  
  498.         if ($curauth->description) {
  499.  
  500.             if (get_option('wpu_description_limit')) {
  501.  
  502.                 $desc_limit = get_option('wpu_description_limit');
  503.  
  504.                 $html .=  "<div class=\"wpu-about\">" . substr($curauth->description, 0, $desc_limit) . " [...]</div>\n";
  505.  
  506.             } else {
  507.  
  508.                 $html .=  "<div class=\"wpu-about\">" . $curauth->description . "</div>\n";
  509.  
  510.             }
  511.  
  512.         }
  513.  
  514.     }
  515.  
  516.     $html .= "</div>";
  517.  
  518.     return $html;
  519.  
  520. }
  521.  
  522.  
  523.  
  524. function display_user() {  
  525.  
  526.     global $post;
  527.  
  528.    
  529.  
  530.     if (isset($_GET['uid'])) {
  531.  
  532.         $uid = $_GET['uid'];
  533.  
  534.         $curauth = get_userdata($uid);
  535.  
  536.     }
  537.  
  538.    
  539.  
  540.     if ( $curauth ) {
  541.  
  542.         $recent_posts = get_posts( array( 'numberposts' => -1, 'author' => $curauth->ID ) );
  543.  
  544.         $recent_comments = wpu_recent_comments($uid);
  545.  
  546.                
  547.  
  548.         $html = "<span><a href=" . get_permalink($post->ID) . ">&laquo; View other members</a></span>\n";
  549.  
  550.        
  551.  
  552.         $html .= "<h2>$curauth->display_name</h2>\n";
  553.  
  554.        
  555.  
  556.         if (get_option('wpu_image_profile')) {
  557.  
  558.             if(get_option('wpu_avatars') == "gravatars") {
  559.  
  560.                 $html .= "<p><a href=\"http://en.gravatar.com/\" title=\"Get your own avatar.\">" . get_avatar($curauth->user_email, '96', $gravatar) . "</a></p>\n";
  561.  
  562.             } elseif (get_option('wpu_avatars') == "userphoto") {
  563.  
  564.                 if(function_exists('userphoto_the_author_photo'))
  565.  
  566.                 {
  567.  
  568.                     $html .= "<p>" . userphoto__get_userphoto($curauth->ID, USERPHOTO_FULL_SIZE, "", "", array(), "") . "</p>\n";
  569.  
  570.                 }
  571.  
  572.             }
  573.  
  574.         }
  575.  
  576.    
  577.  
  578.         if ($curauth->user_url && $curauth->user_url != "http://") {
  579.  
  580.             $html .= "<p><strong>Website:</strong> <a href=\"$curauth->user_url\" rel=\"nofollow\">$curauth->user_url</a></p>\n";
  581.  
  582.         }
  583.  
  584.        
  585.  
  586.         if (get_option('wpu_description_profile')) {
  587.  
  588.             if ($curauth->description) {
  589.  
  590.                 $html .= "<p><strong>Profile:</strong></p>\n";
  591.  
  592.                 $html .= "<p>$curauth->description</p>\n";
  593.  
  594.             }
  595.  
  596.         }
  597.  
  598.        
  599.  
  600.         if ($recent_posts) {
  601.  
  602.             $html .= "<h3>Posts by $curauth->display_name</h3>\n";
  603.  
  604.             $html .= "<ul>\n";
  605.  
  606.             foreach( $recent_posts as $post )
  607.  
  608.             {
  609.  
  610.                 setup_postdata($post);
  611.  
  612.                            
  613.  
  614.                 $html .= "<li><a href=" . get_permalink($post->ID) . ">" . $post->post_title . "</a></li>";
  615.  
  616.             }
  617.  
  618.             $html .= "</ul>\n";
  619.            
  620.            
  621.  
  622.         }
  623.  
  624.        
  625.  
  626.         wp_reset_query();
  627.  
  628.         echo "<div id=\"wpu-profile\">
  629.  
  630.         ";
  631.  
  632.         echo $html;
  633.        
  634.         ?>
  635.        
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.         <h3>Comments by <? echo $curauth->display_name; ?></h3> <? echo '</br>'; ?>
  643.            
  644.         <?  global $wpdb;
  645. $id=$_GET['uid'];
  646.  
  647. $comments = get_comments( array( 'user_id' => $id) );
  648. foreach( $comments as $comment ) {
  649. $post_id = $comment->comment_post_ID;
  650. $post = get_post( $post_id );
  651. setup_postdata( $post ); ?>
  652.  
  653. <a href="<?php echo get_permalink($post); ?>"><?php echo get_the_title($post); ?></a> </br>
  654.  
  655. <?
  656.         echo '<blockqoute style="font: 14px/22px normal helvetica, sans-serif;
  657.  margin-top: 10px;
  658.  margin-bottom: 10px;
  659.  margin-left: 50px;
  660.  padding-left: 15px;
  661.  border-left: 3px solid #ccc;">'; echo  $comment->comment_content;echo '</blockqoute>';
  662. echo '</br>';echo '</br>';
  663.  
  664.  
  665. }   echo '</br>';
  666.        
  667.        
  668.  
  669.         echo "</div>
  670.  
  671.         ";
  672.  
  673.  
  674.  
  675.     }
  676.  
  677. }
  678.  
  679.  
  680.  
  681. function wpu_recent_comments($uid)
  682.  
  683. {
  684.  
  685.     global $wpdb;
  686.  
  687.    
  688.  
  689.     $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_post_ID, SUBSTRING(comment_content, 1, 150) AS comment_content
  690.  
  691.     FROM $wpdb->comments
  692.  
  693.     WHERE user_id = %s
  694.  
  695.     ORDER BY comment_ID DESC
  696.  
  697.     LIMIT 10
  698.  
  699.     ", $uid ) );
  700.  
  701.  
  702.  
  703.     return $comments;
  704.  
  705. }
  706.  
  707.  
  708.  
  709. function noindex_users() {
  710.  
  711.     if(is_page(get_option('wpu_page_id')) && get_option('wpu_noindex_users') == 'yes') {
  712.  
  713.         if($_GET['uid'] == "")
  714.  
  715.             echo '  <meta name="robots" content="noindex, follow"/>
  716.  
  717.             ';
  718.  
  719.     }
  720.  
  721. }
  722.  
  723.  
  724.  
  725. // 2.0 Feature
  726.  
  727. function wpu_styles() {
  728.  
  729.     if(is_page(get_option('wpu_page_id'))) {
  730.  
  731.         echo '<link href="' . get_bloginfo ( 'wpurl' ) . '/wp-content/plugins/wordpress-users/wpu-styles.css" rel="stylesheet" type="text/css" />
  732.  
  733.         ';
  734.  
  735.     }
  736.  
  737. }
  738.  
  739.  
  740.  
  741. function wpu_admin_menu() {  
  742.  
  743.     add_options_page('WordPress Users Options', 'WordPress Users', 'manage_options', __FILE__, 'wpu_admin');
  744.  
  745. }
  746.  
  747.  
  748.  
  749. function wpu_admin() {
  750.  
  751.     if($_POST['wpu_hidden'] == 'Y') {
  752.  
  753.         //Form data sent
  754.  
  755.         $pageid = $_POST['wpu_page_id'];
  756.  
  757.         update_option('wpu_page_id', $pageid);
  758.  
  759.            
  760.  
  761.         $usersperpage = $_POST['wpu_users_per'];
  762.  
  763.         update_option('wpu_users_per', $usersperpage);
  764.  
  765.            
  766.  
  767.         $avatars = $_POST['wpu_avatars'];
  768.  
  769.         update_option('wpu_avatars', $avatars);
  770.  
  771.        
  772.  
  773.         $gravatar_type = $_POST['wpu_gravatar_type'];
  774.  
  775.         update_option('wpu_gravatar_type', $gravatar_type);
  776.  
  777.            
  778.  
  779.         $gravatar_size = $_POST['wpu_gravatar_size'];
  780.  
  781.         update_option('wpu_gravatar_size', $gravatar_size);
  782.  
  783.        
  784.  
  785.         $noindex_users = $_POST['wpu_noindex_users'];
  786.  
  787.         update_option('wpu_noindex_users', $noindex_users);
  788.  
  789.        
  790.  
  791.         $roles_admin = $_POST['wpu_roles_admin'];
  792.  
  793.         update_option('wpu_roles_admin', $roles_admin);
  794.  
  795.        
  796.  
  797.         $roles_editor = $_POST['wpu_roles_editor'];
  798.  
  799.         update_option('wpu_roles_editor', $roles_editor);
  800.  
  801.        
  802.  
  803.         $roles_author = $_POST['wpu_roles_author'];
  804.  
  805.         update_option('wpu_roles_author', $roles_author);
  806.  
  807.        
  808.  
  809.         $roles_contributor = $_POST['wpu_roles_contributor'];
  810.  
  811.         update_option('wpu_roles_contributor', $roles_contributor);
  812.  
  813.        
  814.  
  815.         $roles_subscriber = $_POST['wpu_roles_subscriber'];
  816.  
  817.         update_option('wpu_roles_subscriber', $roles_subscriber);
  818.  
  819.        
  820.  
  821.         $image_list = $_POST['wpu_image_list'];
  822.  
  823.         update_option('wpu_image_list', $image_list);
  824.  
  825.        
  826.  
  827.         $description_list = $_POST['wpu_description_list'];
  828.  
  829.         update_option('wpu_description_list', $description_list);
  830.  
  831.        
  832.  
  833.         $image_profile = $_POST['wpu_image_profile'];
  834.  
  835.         update_option('wpu_image_profile', $image_profile);
  836.  
  837.        
  838.  
  839.         $description_profile = $_POST['wpu_description_profile'];
  840.  
  841.         update_option('wpu_description_profile', $description_profile);
  842.  
  843.        
  844.  
  845.         $desc_limit = $_POST['wpu_description_limit'];
  846.  
  847.         update_option('wpu_description_limit', $desc_limit);
  848.  
  849.     ?>  
  850.  
  851.         <div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div>
  852.  
  853.     <?php  
  854.  
  855.     } else {
  856.  
  857.         //Normal page display
  858.  
  859.         $pageid = get_option('wpu_page_id');
  860.  
  861.         $usersperpage = get_option('wpu_users_per');
  862.  
  863.         $gravatar_type = get_option('wpu_gravatar_type');
  864.  
  865.         $gravatar_size = get_option('wpu_gravatar_size');
  866.  
  867.         $noindex_users = get_option('wpu_noindex_users');
  868.  
  869.         $image_list = get_option('wpu_image_list');
  870.  
  871.         $description_list = get_option('wpu_description_list');
  872.  
  873.         $image_profile = get_option('wpu_image_profile');
  874.  
  875.         $description_profile = get_option('wpu_description_profile');
  876.  
  877.         $desc_limit = get_option('wpu_description_limit');
  878.  
  879.        
  880.  
  881.         if (empty($usersperpage))   $usersperpage = 10;
  882.  
  883.         if(get_option('wpu_avatars') == 1) {
  884.  
  885.             if (empty($gravatar_type))  $gravatar_type = "mystery";
  886.  
  887.             if (empty($gravatar_size))  $gravatar_size = 80;
  888.  
  889.         }
  890.  
  891.     }
  892.  
  893. ?>
  894.  
  895.    
  896.  
  897.     <div class="wrap">
  898.  
  899.         <h2><?php _e('WordPress Users Options') ?></h2>
  900.  
  901.            
  902.  
  903.         <form name="wpu_admin_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
  904.  
  905.             <input type="hidden" name="wpu_hidden" value="Y">
  906.  
  907.             <table>
  908.  
  909.                 <tr>
  910.  
  911.                     <td>&nbsp;</td>
  912.  
  913.                     <td>&nbsp;</td>
  914.  
  915.                     <td></td>
  916.  
  917.                 </tr>
  918.  
  919.                 <tr>
  920.  
  921.                     <td><?php _e("Page ID: " ); ?>&nbsp;</td>
  922.  
  923.                     <td colspan="2"><input type="text" name="wpu_page_id" value="<?php echo $pageid; ?>" size="3">&nbsp; ID of the page on which you want to display the user directory.</td>
  924.  
  925.                 </tr>
  926.  
  927.                 <tr>
  928.  
  929.                     <td>&nbsp;</td>
  930.  
  931.                     <td>&nbsp;</td>
  932.  
  933.                     <td></td>
  934.  
  935.                 </tr>
  936.  
  937.                 <tr>
  938.  
  939.                     <td><?php _e("Users Per Page: " ); ?>&nbsp;</td>
  940.  
  941.                     <td colspan="2"><input type="text" name="wpu_users_per" value="<?php echo $usersperpage; ?>" size="3">&nbsp; How many users you want to display at once.</td>
  942.  
  943.                 </tr>
  944.  
  945.                 <tr>
  946.  
  947.                     <td>&nbsp;</td>
  948.  
  949.                     <td>&nbsp;</td>
  950.  
  951.                     <td></td>
  952.  
  953.                 </tr>
  954.  
  955.                 <tr>
  956.  
  957.                     <td><?php _e("Noindex User Listings: " ); ?>&nbsp;</td>
  958.  
  959.                     <td colspan="2"><input name="wpu_noindex_users" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_noindex_users')); ?> />&nbsp; Insert robots noindex meta tag on user listings to prevent search engine indexing.</td>
  960.  
  961.                 </tr>
  962.  
  963.                 <tr>
  964.  
  965.                     <td>&nbsp;</td>
  966.  
  967.                     <td>&nbsp;</td>
  968.  
  969.                     <td></td>
  970.  
  971.                 </tr>
  972.  
  973.                 <tr>
  974.  
  975.                     <td colspan="3">
  976.  
  977.                         <h3>Select Which Users to Display</h3>
  978.  
  979.                         <p><small><strong>Note:</strong> If no options are selected, all users will be displayed.</small></p>
  980.  
  981.                     </td>
  982.  
  983.                 </tr>
  984.  
  985.                 <tr>
  986.  
  987.                     <td colspan="3"><input name="wpu_roles_admin" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_admin')); ?> />&nbsp; <?php _e("Administrator" ); ?></td>
  988.  
  989.                 </tr>
  990.  
  991.                 <tr>
  992.  
  993.                     <td>&nbsp;</td>
  994.  
  995.                     <td>&nbsp;</td>
  996.  
  997.                     <td></td>
  998.  
  999.                 </tr>
  1000.  
  1001.                 <tr>
  1002.  
  1003.                     <td colspan="3"><input name="wpu_roles_editor" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_editor')); ?> />&nbsp; <?php _e("Editors" ); ?></td>
  1004.  
  1005.                 </tr>
  1006.  
  1007.                 <tr>
  1008.  
  1009.                     <td>&nbsp;</td>
  1010.  
  1011.                     <td>&nbsp;</td>
  1012.  
  1013.                     <td></td>
  1014.  
  1015.                 </tr>
  1016.  
  1017.                 <tr>
  1018.  
  1019.                     <td colspan="3"><input name="wpu_roles_author" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_author')); ?> />&nbsp; <?php _e("Authors" ); ?></td>
  1020.  
  1021.                 </tr>
  1022.  
  1023.                 <tr>
  1024.  
  1025.                     <td>&nbsp;</td>
  1026.  
  1027.                     <td>&nbsp;</td>
  1028.  
  1029.                     <td></td>
  1030.  
  1031.                 </tr>
  1032.  
  1033.                 <tr>
  1034.  
  1035.                     <td colspan="3"><input name="wpu_roles_contributor" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_contributor')); ?> />&nbsp; <?php _e("Contribtors" ); ?></td>
  1036.  
  1037.                 </tr>
  1038.  
  1039.                 <tr>
  1040.  
  1041.                     <td>&nbsp;</td>
  1042.  
  1043.                     <td>&nbsp;</td>
  1044.  
  1045.                     <td></td>
  1046.  
  1047.                 </tr>
  1048.  
  1049.                 <tr>
  1050.  
  1051.                     <td colspan="3"><input name="wpu_roles_subscriber" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_roles_subscriber')); ?> />&nbsp; <?php _e("Subscribers" ); ?></td>
  1052.  
  1053.                 </tr>
  1054.  
  1055.                 <tr>
  1056.  
  1057.                     <td>&nbsp;</td>
  1058.  
  1059.                     <td>&nbsp;</td>
  1060.  
  1061.                     <td></td>
  1062.  
  1063.                 </tr>
  1064.  
  1065.                 <tr>
  1066.  
  1067.                     <td colspan="3"><h3>Profile Options</h3></td>
  1068.  
  1069.                 </tr>
  1070.  
  1071.                 <tr>
  1072.  
  1073.                     <td colspan="3"><input name="wpu_image_list" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_image_list')); ?> />&nbsp; <?php _e("Display user images on directory page." ); ?></td>
  1074.  
  1075.                 </tr>
  1076.  
  1077.                 <tr>
  1078.  
  1079.                     <td>&nbsp;</td>
  1080.  
  1081.                     <td>&nbsp;</td>
  1082.  
  1083.                     <td></td>
  1084.  
  1085.                 </tr>
  1086.  
  1087.                 <tr>
  1088.  
  1089.                     <td colspan="3"><input name="wpu_description_list" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_description_list')); ?> />&nbsp; <?php _e("Display user descriptions on directory page." ); ?></td>
  1090.  
  1091.                 </tr>
  1092.  
  1093.                 <tr>
  1094.  
  1095.                     <td>&nbsp;</td>
  1096.  
  1097.                     <td>&nbsp;</td>
  1098.  
  1099.                     <td></td>
  1100.  
  1101.                 </tr>
  1102.  
  1103.                 <tr>
  1104.  
  1105.                     <td>&nbsp;</td>
  1106.  
  1107.                     <td>&nbsp;</td>
  1108.  
  1109.                     <td></td>
  1110.  
  1111.                 </tr>
  1112.  
  1113.                 <tr>
  1114.  
  1115.                     <td colspan="3"><input name="wpu_image_profile" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_image_profile')); ?> />&nbsp; <?php _e("Display user images on profile page." ); ?></td>
  1116.  
  1117.                 </tr>
  1118.  
  1119.                 <tr>
  1120.  
  1121.                     <td>&nbsp;</td>
  1122.  
  1123.                     <td>&nbsp;</td>
  1124.  
  1125.                     <td></td>
  1126.  
  1127.                 </tr>
  1128.  
  1129.                 <tr>
  1130.  
  1131.                     <td colspan="3"><input name="wpu_description_profile" type="checkbox" value="yes" <?php checked('yes', get_option('wpu_description_profile')); ?> />&nbsp; <?php _e("Display user descriptions on profile page." ); ?></td>
  1132.  
  1133.                 </tr>
  1134.  
  1135.                 <tr>
  1136.  
  1137.                     <td>&nbsp;</td>
  1138.  
  1139.                     <td>&nbsp;</td>
  1140.  
  1141.                     <td></td>
  1142.  
  1143.                 </tr>
  1144.  
  1145.                 <tr>
  1146.  
  1147.                     <td>&nbsp;</td>
  1148.  
  1149.                     <td>&nbsp;</td>
  1150.  
  1151.                     <td></td>
  1152.  
  1153.                 </tr>
  1154.  
  1155.                 <tr>
  1156.  
  1157.                     <td colspan="3"><input type="text" name="wpu_description_limit" value="<?php echo $desc_limit; ?>" size="3">&nbsp; <?php _e("Number of characters to display of user description on the directory page." ); ?></td>
  1158.  
  1159.                 </tr>
  1160.  
  1161.                 <tr>
  1162.  
  1163.                     <td colspan="3">
  1164.  
  1165.                         <p><small><strong>Note:</strong> If no limit is specified, entire user description will be displayed.</small></p>
  1166.  
  1167.                     </td>
  1168.  
  1169.                 </tr>
  1170.  
  1171.                 <tr>
  1172.  
  1173.                     <td>&nbsp;</td>
  1174.  
  1175.                     <td>&nbsp;</td>
  1176.  
  1177.                     <td></td>
  1178.  
  1179.                 </tr>
  1180.  
  1181.                 <tr>
  1182.  
  1183.                     <td colspan="3"><h3>Avatar Options</h3></td>
  1184.  
  1185.                 </tr>
  1186.  
  1187.                 <tr>
  1188.  
  1189.                     <td><?php _e("Avatar Type: " ); ?></td>
  1190.  
  1191.                     <td colspan="2"><input id="wpu_avatars_gravatars" type="radio" name="wpu_avatars" value="gravatars" <?php checked('gravatars', get_option('wpu_avatars')); ?> /> Gravatars</td>
  1192.  
  1193.                 </tr>
  1194.  
  1195.                 <tr>
  1196.  
  1197.                     <td></td>
  1198.  
  1199.                     <td colspan="2"><input id="wpu_avatars_userphoto" type="radio" name="wpu_avatars" value="userphoto" <?php checked('userphoto', get_option('wpu_avatars')); ?> /> User Photo</td>
  1200.  
  1201.                 </tr>
  1202.  
  1203.                 <tr>
  1204.  
  1205.                     <td>&nbsp;</td>
  1206.  
  1207.                     <td>&nbsp;</td>
  1208.  
  1209.                     <td></td>
  1210.  
  1211.                 </tr>
  1212.  
  1213.                 <tr>
  1214.  
  1215.                     <td colspan="3"><strong>Gravatar Options:</strong></td>
  1216.  
  1217.                 </tr>
  1218.  
  1219.                 <tr>
  1220.  
  1221.                     <td>&nbsp;</td>
  1222.  
  1223.                     <td>&nbsp;</td>
  1224.  
  1225.                     <td></td>
  1226.  
  1227.                 </tr>
  1228.  
  1229.                 <tr>
  1230.  
  1231.                     <td><?php _e("Gravatar Type: " ); ?>&nbsp;</td>
  1232.  
  1233.                     <td><input type="text" name="wpu_gravatar_type" value="<?php echo $gravatar_type; ?>" size="15">&nbsp; Gravatar type - ex. mystery, blank, gravatar_default, identicon, wavatar, monsterid</td>
  1234.  
  1235.                 </tr>
  1236.  
  1237.                 <tr>
  1238.  
  1239.                     <td>&nbsp;</td>
  1240.  
  1241.                     <td>&nbsp;</td>
  1242.  
  1243.                     <td></td>
  1244.  
  1245.                 </tr>
  1246.  
  1247.                 <tr>
  1248.  
  1249.                     <td><?php _e("Gravatar Size: " ); ?>&nbsp;</td>
  1250.  
  1251.                     <td><input type="text" name="wpu_gravatar_size" value="<?php echo $gravatar_size; ?>" size="2"> px &nbsp; Size of gravatar in the user listings.</td>
  1252.  
  1253.                 </tr>
  1254.  
  1255.                 <tr>
  1256.  
  1257.                     <td colspan="3"><p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options') ?>" /></p></td>
  1258.  
  1259.                 </tr>
  1260.  
  1261.             </table>
  1262.  
  1263.         </form>
  1264.  
  1265.     </div>
  1266.  
  1267.  
  1268.  
  1269.  
  1270. <?php
  1271.  
  1272. }
  1273.  
  1274. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement