?> <h3><?php if (0 == $wp_user_search->first_user && $wp_user_search->total_users_for_query <= 50) { printf(__('%3$s shown below'), $wp_user_search->first_user + 1, min($wp_user_search->first_user + $wp_user_search->users_per_page, $wp_user_search->total_users_for_query), $wp_user_search->total_users_for_query); } else { printf(__('%1$s – %2$s of %3$s shown below'), $wp_user_search->first_user + 1, min($wp_user_search->first_user + $wp_user_search->users_per_page, $wp_user_search->total_users_for_query), $wp_user_search->total_users_for_query); } ?> </h3> <?php if ($wp_user_search->results_are_paged()) { ?> <div class="user-paging-text"><p><?php $wp_user_search->page_links(); ?> </p></div> <?php } ?> <form action="" method="post" name="updateusers" id="updateusers"> <?php wp_nonce_field('bulk-users'); ?> <table class="widefat"> <?php foreach ($roleclasses as $role => $roleclass) { uksort($roleclass, "strnatcasecmp"); ?>
function manage_avatar_cache() { global $wpdb; $msg = ''; // Show commenter avatars too? $all = @$_GET['act'] == 'all'; // Check table updates... if (isset($_GET['user_id'])) { $msg = __('User Photo', 'avatars') . ' ' . (empty($_GET['avatar']) ? __('removed', 'avatars') : __('updated', 'avatars')) . '.'; update_user_meta($_GET['user_id'], 'avatar', $_GET['avatar']); update_user_meta($_GET['user_id'], 'twitter_id', $_GET['twitter_id']); } // Check form submission and update options... if (isset($_POST['submit'])) { $options_update = array('size' => $_POST['size'], 'scale' => $_POST['scale'], 'resize' => $_POST['resize'], 'upsize' => $_POST['upsize'], 'snapshots' => $_POST['snapshots'], 'in_posts' => $_POST['in_posts'], 'credit' => $_POST['credit'], 'twitter' => $_POST['twitter'], 'default' => $_POST['default'], 'upload_dir' => $_POST['upload_dir'], 'url_wrap' => $_POST['url_wrap'], 'name' => $_POST['name'], 'location' => $_POST['location'], 'legacy' => $_POST['legacy'], 'widget_enabled' => $_POST['widget_enabled'], 'upload_allowed' => $_POST['upload_allowed']); if ($this->networked) { update_site_option('plugin_avatars', $options_update); } else { update_option('plugin_avatars', $options_update); update_option('show_avatars', $_POST['show_avatars'] == 'on' ? 1 : 0); update_option('avatar_rating', $_POST['avatar_rating']); update_option('avatar_default', $_POST['wavatar']); } $msg = __('Options saved', 'avatars'); } // Get options and set form action var if ($this->networked) { $this->avatar_options = get_site_option('plugin_avatars'); $form_action = $_SERVER['PHP_SELF'] . '?page=add_local_avatar&updated=true'; } else { $this->avatar_options = get_option('plugin_avatars'); $wavatar = get_option('avatar_default'); $form_action = $_SERVER['PHP_SELF'] . '?page=' . basename(__FILE__) . '&updated=true'; } // Output any action message (note, can only be from a POST or GET not both). if (!empty($msg)) { echo "<div id='message' class='updated fade'><p>", $msg, "</p></div>"; } ?> <script language="Javascript"> function set_input_values(num) { var h = document.getElementById('href-' + num); h.href = h.href + '&avatar=' + document.getElementById('avatar-' + num).value; h.href = h.href + '&twitter_id=' + document.getElementById('twitter_id-' + num).value; } </script> <div class="wrap"> <span id='icon-users' class='icon32'></span><h2><?php _e('User Photo Settings', 'avatars'); ?> </h2> <h3><?php _e('User Photos', 'avatars'); ?> </h3> <?php // Do not show the table of this site's users/commentors if Avatars are disabled, instead place a hyperlink for them to enable it. if (!get_option('show_avatars')) { _e('Photos / Avatars have been disabled for this site. Enable avatars under <a href="/wp-admin/options-discussion.php">Settings > Discussion</a>', "avatars"); } else { $user_search = new WP_User_Search('', $_GET['userspage'], ''); // Do we have to page the results? if ($user_search->total_users_for_query > $user_search->users_per_page) { if ($this->networked) { $paging_base = basename($this->requestURI) . '&%_%'; } else { $paging_base = 'users.php?page=profiles.php&%_%'; } $user_search->paging_text = paginate_links(array('total' => ceil($user_search->total_users_for_query / $user_search->users_per_page), 'current' => $user_search->page, 'base' => $paging_base, 'format' => 'userspage=%#%')); } // How many per page (for commenters, if shown)? $per_page = $user_search->users_per_page; if ($user_search->results_are_paged()) { ?> <div class="tablenav"> <div class="tablenav-pages"><?php $user_search->page_links(); ?> </div> </div> <?php } ?> <table class='widefat'> <thead> <tr> <th><?php _e('Username', 'avatars'); ?> </th> <th><?php _e('Name (Nickname)', 'avatars'); ?> </th> <th><?php _e('e-Mail', 'avatars'); ?> </th> <th><?php _e('Twitter ID', 'avatars'); ?> </th> <th><?php _e('Local', 'avatars'); ?> </th> <th style="text-align: center;"><?php _e('Photo', 'avatars'); ?> </th> <th><?php _e('Type', 'avatars'); ?> </th> <th><?php _e('Action', 'avatars'); ?> </th> </tr> </thead> <tbody> <?php $i = 0; foreach ($user_search->get_results() as $id) { $user = new WP_User($id); printf('<tr%s>', $i % 2 == 0 ? " class='alternate'" : ""); printf('<td><a href="user-edit.php?user_id=%s">%s</a></td>', $id, $user->user_login); printf('<td>%s %s%s</td>', $user->first_name, $user->last_name, empty($user->nickname) ? '' : ' (' . $user->nickname . ')'); printf('<td><a href="mailto:%1$s">%1$s</a></td>', $user->user_email); printf('<td><input type="text" value="%s" id="twitter_id-%d" /></td>', $user->twitter_id, $i); printf('<td><input type="text" value="%s" size="35" id="avatar-%d" /></td>', $user->avatar, $i); printf('<td style="text-align: center;">%s</td>', get_avatar($id)); printf('<td>%s</td>', $this->get_avatar_type()); printf('<td><a href="%1$s&user_id=%2$s" class="edit" onclick="set_input_values(%3$d);" id="href-%3$d">%4$s</a></td>', $this->requestURI, $id, $i, __('Update', 'avatars')); echo "</tr>\n"; $i++; } ?> </tbody> </table> <?php if ($user_search->results_are_paged()) { ?> <div class="tablenav"> <div class="tablenav-pages"><?php $user_search->page_links(); ?> </div> </div> <?php } ?> <p><?php if (!$all) { echo __("Not showing photos for commenters.", 'avatars'), " <a href='" . $this->requestURI . "&act=all'>", __('Click here', 'avatars'), '</a> ', __("to show commenter avatars.", 'avatars'); } else { echo __("Showing avatars for commenters.", 'avatars'), " <a href='" . $this->requestURI . "'>", __('Click here', 'avatars'), '</a> ', __("to hide commenter photos.", 'avatars'); } ?> </p> <?php $com_page = isset($_GET['comspage']) ? $_GET['comspage'] : 1; if ($all) { $total = $wpdb->get_var("select count(distinct comment_author_email) from {$wpdb->comments} where comment_author_email != ''"); $limit_start = ($com_page - 1) * $per_page; $coms = $wpdb->get_results("select comment_author_email EML, comment_author ATH, count(comment_content) CNT from {$wpdb->comments} where comment_author_email != '' group by comment_author_email order by CNT DESC limit {$limit_start}, {$per_page}"); if ($total > $per_page) { $paging_text = paginate_links(array('total' => ceil($total / $per_page), 'current' => $com_page, 'base' => 'users.php?page=profiles.php&act=all&%_%', 'format' => 'comspage=%#%')); } if ($coms) { ?> <h3><?php _e('Commenter Photos', 'avatars'); ?> </h3> <?php if ($paging_text) { ?> <div class="tablenav"> <div class="tablenav-pages"><?php echo $paging_text; ?> </div> </div> <?php } ?> <table class='widefat'> <thead> <tr><th><?php _e('Name', 'avatars'); ?> </th><th><?php _e('e-Mail', 'avatars'); ?> </th><th style="text-align: center;"><?php _e('Comments', 'avatars'); ?> </th><th style="text-align: center;"><?php _e('Photo', 'avatars'); ?> </th></tr> </thead> <tbody> <?php $i = 0; foreach ($coms as $com) { if (!empty($com->EML)) { printf('<tr%s>', $i % 2 == 0 ? " class='alternate'" : ""); printf('<td>%s</td>', $com->ATH); printf('<td><a href="mailto:%1$s">%1$s</a></td>', $com->EML); printf('<td class="num">%s</td>', $com->CNT); printf('<td style="text-align: center;">%s</td>', get_avatar($com->EML)); echo "</tr>\n"; $i++; } } ?> </tbody> </table> <?php if ($paging_text) { ?> <div class="tablenav"> <div class="tablenav-pages"><?php echo $paging_text; ?> </div> </div> <?php } } } ?> <?php } // end if ?> <h3><?php _e('Photo Options', 'avatars'); ?> </h3> <form method="post" action="<?php echo $form_action; ?> "> <table class='form-table'> <?php // Do not repeat Settings > Discussion options in networked mode. if (!$this->networked) { ?> <tr> <td><label for="show_avatars"><?php _e('Show avatars:', 'avatars'); ?> </label><br /><small><?php _e('Repeated from <i>Settings » Discussion</i>', 'avatars'); ?> </small></td> <td><input type="checkbox" name="show_avatars" <?php echo get_option('show_avatars') ? 'checked' : ''; ?> /></td> <td><small><?php _e('Enable Photos.', 'avatars'); ?> </small></td> </tr> <tr> <td><?php _e('Photo rating:', 'avatars'); ?> <br /><small><?php _e('Repeated from <i>Settings » Discussion</i>', 'avatars'); ?> </small></td> <td> <input type='radio' name='avatar_rating' value='G' <?php echo get_option('avatar_rating') == 'G' ? 'checked="checked"' : ''; ?> /> G <br /> <input type='radio' name='avatar_rating' value='PG' <?php echo get_option('avatar_rating') == 'PG' ? 'checked="checked"' : ''; ?> /> PG<br /> <input type='radio' name='avatar_rating' value='R' <?php echo get_option('avatar_rating') == 'R' ? 'checked="checked"' : ''; ?> /> R <br /> <input type='radio' name='avatar_rating' value='X' <?php echo get_option('avatar_rating') == 'X' ? 'checked="checked"' : ''; ?> /> X </td> <td> <small>- <?php _e('Suitable for all audiences', 'avatars'); ?> </small><br /> <small>- <?php _e('Possibly offensive, usually for audiences 13 and above', 'avatars'); ?> </small><br /> <small>- <?php _e('Intended for adult audiences above 17', 'avatars'); ?> </small><br /> <small>- <?php _e('Even more mature than above', 'avatars'); ?> </small> </td> </tr> <?php } ?> <tr> <td><label for="idAvatarSize"><?php _e('Size:', 'avatars'); ?> </label></td> <td style="width: 70px;"><select id="idAvatarSize" name='size'><?php for ($i = 10; $i <= 100; $i = $i + 10) { echo "<option value='{$i}'"; if ($i == $this->avatar_options['size']) { echo " selected"; } echo ">{$i}</option>"; } ?> </select></td> <td><label for="idAvatarSize">px</label></td> </tr> <?php if (class_exists('SimpleXMLElement')) { ?> <tr> <td><label for="idTwitter"><?php _e('Twitter Photo:', 'avatars'); ?> </label></td> <td><input type="checkbox" id="idTwitter" name="twitter" <?php echo $this->avatar_options['twitter'] == 'on' ? 'checked' : ''; ?> /></td> <td><small><label for="idTwitter"> <?php _e('Try to use <a href="http://twitter.com/" target="_blank">Twitter</a> avatar if no local is avatar defined.', 'avatars'); echo ' ', __('Order of precedence is; <i>Local</i>, <i>Twitter</i>, <i>Global</i>.', 'avatars'); ?> </label></small></td> </tr> <?php } if (!$this->networked) { ?> <tr> <td><?php _e('Gravatar default:', 'avatars'); ?> <br /><small><?php _e('Enhanced repeat from <i>Settings » Discussion</i>', 'avatars'); ?> </small></td> <td><?php echo get_avatar($wavatar, $this->avatar_options['size'], $wavatar); ?> </td> <td> <select name='wavatar'> <?php $avatar_defaults = array('custom' => __('none', 'avatars'), 'mystery' => __('Mystery Man'), 'blank' => __('Blank'), 'gravatar_default' => __('Gravatar Logo'), 'identicon' => __('Identicon'), 'wavatar' => __('Wavatar'), 'monsterid' => __('MonsterID'), 'retro' => __('Retro')); $avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults); $avatar_list = ''; foreach ($avatar_defaults as $default_key => $default_name) { $selected = $wavatar == $default_key ? 'selected' : ''; $avatar_list .= "\n\t<option value='" . esc_attr($default_key) . "' {$selected} >" . $default_name . "</option>"; } echo apply_filters('default_avatar_select', $avatar_list); ?> </select> <br /> <small><?php _e('Give users without Global or Local avatars a unique avatar.', 'avatars'); ?> </small> </td> </tr> <?php } ?> <tr> <td><label for="idAvatarDefault"><?php _e('Default image:', 'avatars'); ?> </label></td> <td><?php echo get_avatar('', '', $this->avatar_options['default']); ?> </td> <td> <input type='text' name='default' id="idAvatarDefault" value='<?php echo $this->avatar_options['default']; ?> ' size='70' /> <br /> <small><?php _e('The default avatar (a working URI) for users without Global or Local avatars. Used for trackbacks.', 'avatars'); ?> </small> </td> </tr> <tr> <td><label for="idAvatarSnapshots"><?php _e('Use Snapshots:', 'avatars'); ?> </label></td> <td><input type="checkbox" id="idAvatarSnapshots" name="snapshots" <?php echo $this->avatar_options['snapshots'] == 'on' ? 'checked' : ''; ?> /></td> <td><label for="idAvatarSnapshots"><small><?php _e('If you have enabled', 'avatars'); ?> <a href="http://www.snap.com">snapshots</a>, <?php _e('clearing this will disable them for avatar links.', 'avatars'); ?> </small></label></td> </tr> <tr> <td><label for="idAvatarInPosts"><?php _e('Photos in posts:', 'avatars'); ?> </label></td> <td><input type="checkbox" name="in_posts" id="idAvatarInPosts" <?php echo $this->avatar_options['in_posts'] == 'on' ? 'checked' : ''; ?> /></td> <td><label for="idAvatarInPosts"><small><?php _e('Replaces', 'avatars'); ?> </small><code><!-- avatar <b>e-mail</b> --></code><small> <?php _e('with an avatar for that email address in post content.', 'avatars'); ?> </small></label></td> </tr> <tr> <td><label for="idAvatarUploadAllowed"><?php _e('User uploads:', 'avatars'); ?> </label></td> <td><input type="checkbox" id="idAvatarUploadAllowed" name="upload_allowed" <?php echo $this->avatar_options['upload_allowed'] == 'on' ? 'checked' : ''; ?> /></td> <td> <input type='text' id="idAvatarUploadDir" name='upload_dir' value='<?php echo $this->avatar_options['upload_dir']; ?> ' size='70' /> <br /> <small><label for="idAvatarUploadDir"><?php _e('If allowed, use this directory for user avatar uploads, e.g.', 'avatars'); ?> <code>/avatars</code>. <?php _e('Must have write access and is relative to ', 'avatars'); ?> <code><?php echo $this->avatar_root(); ?> </code>.</label></small> <br /> <label for="idAvatarLegacy">Or, use legacy (v7.3 and lower) <code>$_SERVER['DOCUMENT_ROOT']</code> method </label><input type="checkbox" id="idAvatarLegacy" name="legacy" <?php echo $this->avatar_options['legacy'] == 'on' ? 'checked' : ''; ?> />, <?php _e('this option often helps when using sub-domains.', 'avatars'); ?> </td> </tr> <tr> <td><label for="idAvatarResize"><?php _e('Resize uploads:', 'avatars'); ?> </label></td> <td><input type="checkbox" id="idAvatarResize" name="resize" <?php if ($this->avatar_options['upload_allowed'] != 'on') { echo 'disabled="true"'; } ?> <?php echo $this->avatar_options['resize'] == 'on' ? 'checked' : ''; ?> /></td> <td> <label for="idAvatarResize"><small><?php _e('Non-square uploads will be cropped.', 'avatars'); ?> </small></label> <br /> <input type="checkbox" id="idAvatarUpsize" name="upsize" <?php echo $this->avatar_options['upsize'] == 'on' ? 'checked' : ''; ?> /> <label for="idAvatarUpsize"><?php _e('pad images smaller than <i>resize</i> set below with a white background? This option stops small images becoming pixelated.'); ?> </label> </td> </tr> <tr> <td><label for="idAvatarResizeSize"><?php _e('Resize uploads size:', 'avatars'); ?> </label></td> <td><select name='scale' id="idAvatarResize" <?php if ($this->avatar_options['resize'] != 'on' || $this->avatar_options['upload_allowed'] != 'on') { echo 'disabled="true"'; } ?> ><?php if (empty($this->avatar_options['scale'])) { $def = true; } else { $def = false; } for ($i = $this->avatar_options['size']; $i <= 200; $i = $i + 10) { echo "<option value='{$i}'"; if ($i == $this->avatar_options['scale'] || $def && $i == SCALED_SIZE) { echo " selected"; } echo ">{$i}</option>"; } ?> </select></td> <td><label for="idAvatarResize">px</label></td> </tr> <tr> <?php if (file_exists(ABSPATH . '/wp-content/plugins/profile/avatars-widget.php')) { ?> <td><?php _e('Enable user profile widget:', 'avatars'); ?> </td> <td><input type="checkbox" name="widget_enabled" <?php echo $this->avatar_options['widget_enabled'] == 'on' ? 'checked' : ''; ?> /></td> <td><small><?php _e('Enable the user profile widget; configure the widget at <i>Appearance » Widgets</i>.', 'avatars'); ?> </small></td> <?php } else { ?> <td colspan="3"></td> <?php } ?> </tr> <tr> <td><label for="idWrapAvatar"><?php _e('Wrap Photos with URL:', 'avatars'); ?> </label></td> <td><input type="checkbox" id="idWrapAvatar" name="url_wrap" <?php echo $this->avatar_options['url_wrap'] == 'on' ? 'checked' : ''; ?> /></td> <td><small><label for="idWrapAvatar"><?php _e("Wrap Photo with URL (from User's profile or Comment form data).", 'avatars'); ?> </label></small></td> </tr> <tr> <td><label for="idNickName"><?php _e('Nickname:', 'avatars'); ?> </label></td> <td><input type="checkbox" name="name" <?php echo $this->avatar_options['name'] == 'on' ? 'checked' : ''; ?> id="idNickName" /></td> <td> <input type='text' name='location' value='<?php echo empty($this->avatar_options['location']) ? 'website' : $this->avatar_options['location']; ?> ' size='10' id="idNickLocation" /> <br /> <small><label for="idNickLocation"><?php _e("User's nickname used for avatar titles (tooltip).", 'avatars'); ?> </label></small> </td> </tr> </table> <p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php _e('Update Photo Options', 'avatars'); ?> " /></p> </form> </div> <style type="text/css"> table.form-table td { border-bottom: 1px solid #e3e3e3; padding-bottom: 1.25em !important; vertical-align: top; } </style> <?php }
<?php if ( $wp_user_search->get_results() ) : ?> <?php if ( $wp_user_search->is_search() ) : ?> <p><a href="users.php"><?php _e('« Back to All Users'); ?></a></p> <?php endif; ?> <h3><?php if ( 0 == $wp_user_search->first_user && $wp_user_search->total_users_for_query <= 50 ) printf(__('%3$s shown below'), $wp_user_search->first_user + 1, min($wp_user_search->first_user + $wp_user_search->users_per_page, $wp_user_search->total_users_for_query), $wp_user_search->total_users_for_query); else printf(__('%1$s – %2$s of %3$s shown below'), $wp_user_search->first_user + 1, min($wp_user_search->first_user + $wp_user_search->users_per_page, $wp_user_search->total_users_for_query), $wp_user_search->total_users_for_query); ?></h3> <?php if ( $wp_user_search->results_are_paged() ) : ?> <div class="user-paging-text"><p><?php $wp_user_search->page_links(); ?></p></div> <?php endif; ?> <form action="" method="post" name="updateusers" id="updateusers"> <?php wp_nonce_field('bulk-users') ?> <table class="widefat"> <?php foreach($roleclasses as $role => $roleclass) { uksort($roleclass, "strnatcasecmp"); ?> <tbody> <tr> <?php if ( !empty($role) ) : ?> <th colspan="7"><h3><?php echo $wp_roles->role_names[$role]; ?></h3></th> <?php else : ?> <th colspan="7"><h3><em><?php _e('No role for this blog'); ?></h3></th>
</form> </div> <form class="search-form" action="" method="get"> <p class="search-box"> <label class="screen-reader-text" for="user-search-input"><?php _e( 'Search Users' ); ?>:</label> <input type="text" id="user-search-input" name="usersearch" value="<?php echo esc_attr($wp_user_search->search_term); ?>" /> <input type="submit" value="<?php esc_attr_e( 'Search Users' ); ?>" class="button" /> </p> </form> <form id="posts-filter" action="" method="get"> <div class="tablenav"> <?php if ( $wp_user_search->results_are_paged() ) : ?> <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div> <?php endif; ?> <div class="alignleft actions"> <select name="action"> <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> <?php if ( !is_multisite() && current_user_can('delete_users') ) { ?> <option value="delete"><?php _e('Delete'); ?></option> <?php } else { ?> <option value="remove"><?php _e('Remove'); ?></option> <?php } ?> </select> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> <label class="screen-reader-text" for="new_role"><?php _e('Change role to…') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to…') ?></option><?php wp_dropdown_roles(); ?></select> <input type="submit" value="<?php esc_attr_e('Change'); ?>" name="changeit" class="button-secondary" /> <?php wp_nonce_field('bulk-users'); ?>