Guest User

Private Messages For WordPress: Non-Admin PM to admin ONLY

a guest
Nov 15th, 2012
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. // Get all users of blog
  2.                     if (current_user_can('manage_options')):
  3.                         ## Original Code:
  4.                         //$users = $wpdb->get_results( "SELECT * FROM $wpdb->users ORDER BY display_name ASC" );
  5.                         $users = get_users('orderby=nicename');
  6.                     else:
  7.                         $users = get_users('orderby=nicename&role=administrator');
  8.                     endif;                     
  9.  
  10.  
  11.  
  12.  
  13.                     if ( $option['type'] == 'autosuggest' )
  14.                     { // if auto suggest feature is turned on
  15.                         ?>
  16.                         <input id="recipient" type="text" name="recipient" class="large-text" />
  17.                         <?php
  18.  
  19.                     }
  20.                     else
  21.                     { // classic way: select recipient from dropdown list
  22.                         ?>
  23.                         <select name="recipient[]" multiple="multiple" size="5">
  24.                             <?php
  25.                             foreach ( $users as $user )
  26.                             {
  27.                                 $selected = ( $user->user_nicename == $recipient ) ? ' selected="selected"' : '';
  28.                                 echo "<option value='$user->user_nicename'$selected>$user->user_nicename</option>";
  29.                             }
  30.                             ?>
  31.                         </select>
  32.                         <?php
  33.                     }
Add Comment
Please, Sign In to add comment