moderated;
return $awaiting_mod;
}
function usp_update_count() {
$update_plugins = get_option( 'update_plugins' );
$update_count = count( $update_plugins->response );
return $update_count;
}
function usp_tree() {
global $usp_language;
global $usp_avatar;
// Publish Posts
if (current_user_can('publish_posts')) {
echo '
'.$usp_language['add_post'].'';
// Edit Posts
if (current_user_can('edit_posts')) {
echo ''; }
else echo ''; }
//Page
if (current_user_can('edit_pages')) {
echo ''.$usp_language['add_page'].'';}
//Comments
if (current_user_can('moderate_comments')) {
echo ''.$usp_language['mng_comm'].'';}
//Categories
if (current_user_can('manage_categories')) {
echo ''.$usp_language['mng_cat'].'';}
//Links
if (current_user_can('manage_links')) {
echo ''.$usp_language['mng_link'].'';}
//User
if (current_user_can('edit_users')) {
echo ''.$usp_language['users'].'';}
//Manage Options
if (current_user_can('manage_options')) {
echo ''.$usp_language['options'].'';}
//Themes
if (current_user_can('switch_themes')) {
echo ''.$usp_language['switch_themes'].'';}
//Switch Themes & Widget
if (current_user_can('edit_themes')) {
echo ''.$usp_language['edit_themes'].'';
echo '';}
//Profile
echo ''.$usp_language['profile'].'';
if ($usp_avatar == true or function_exists('get_userextra')){
echo '';}
else echo '';
//Exit
echo ''.$usp_language['logout'].'';
}
function usp_tree_ng() {
global $usp_language;
$awaiting_mod = usp_awaiting_mod_count();
if($awaiting_mod != 0) $awaiting_mod_display = 'display:inline;color:#800000;';
else $awaiting_mod_display = '';
$update_plugins = usp_update_count();
if($update_plugins != 0) $update_count_display = 'display:inline;color:#800000;';
else $update_count_display = '';
echo ''.$usp_language['dash_ng'].'';
// Publish
if (current_user_can('publish_posts')) echo ''.$usp_language['add_ng'].'';
//Manage
if (current_user_can('edit_post')) echo ''.$usp_language['mng_ng'].'';
//Comments
if (current_user_can('moderate_comments')) {
echo ''.$usp_language['comm_ng'].'';
echo ' ('.$awaiting_mod.')'; }
//Options
if (current_user_can('manage_options')) echo ''.$usp_language['options_ng'].'';
//User
if (current_user_can('edit_users')) echo ''.$usp_language['users'].'';
else echo ''.$usp_language['profile'].'';
//Design
if (current_user_can('switch_themes')) echo ''.$usp_language['design_ng'].'';
//Plugins
if (current_user_can('activate_plugins')) {
echo ''.$usp_language['plugins_ng'].'';
echo ' ('.$update_plugins.')'; }
//Exit
echo ''.$usp_language['logout'].'';
}
function usp_tree_small() {
global $usp_language;
echo ''.$usp_language['dash_ng'].'';
echo ''.$usp_language['profile'].'';
echo ''.$usp_language['logout'].'';
}
function usp_form() {
global $usp_language;
global $usp_show_register;
global $usp_login_mode;
if ($usp_login_mode == 'form') {
echo '
';
} else {
echo '';
}
}
function usp_notification() {
global $usp_language;
global $user_identity;
global $usp_notification_style;
if ($user_identity) {
$msg = '';
$awaiting_mod = usp_awaiting_mod_count();
$update_plugins = usp_update_count();
if ( $awaiting_mod != 0 and current_user_can('moderate_comments') ) {
$msg .= $usp_language['notifi_com'].': '.$awaiting_mod.'
';
$msgh = '';
$msgf = '
'; }
if ( $update_plugins !== 0 and current_user_can('activate_plugins') ) {
$msg .= $usp_language['notifi_plug'].': '.$update_plugins;
$msgh = '';
$msgf = '
'; }
echo $msgh.$msg.$msgf;
}
}
if ($usp_avatar == true) {
function usp_show_avatar($the_author, $the_author_name, $sizeW='', $sizeH='') {
global $usp_avatar_avatars_path;
global $usp_avatar_def_width;
global $usp_avatar_def_height;
global $usp_avatar_def_img;
//We learn what size it will be displayed avatars
if ($sizeW != '' and $sizeH != ''){ $usp_avatar_width = $sizeW; $usp_avatar_height = $sizeH; }
elseif ($sizeW != '' and $sizeH == '') { $usp_avatar_width = $sizeW; $usp_avatar_height = $sizeW; }
else { $usp_avatar_width = $usp_avatar_def_width; $usp_avatar_height = $usp_avatar_def_height; }
//Whether we learn if at the user of avatars if is not present - it is used by default.
$avatars_path = ABSPATH.$usp_avatar_avatars_path;
$wpress_url = get_bloginfo('url');
if(file_exists("$avatars_path/$the_author.jpg")) $the_avatar_jpg = $wpress_url.$usp_avatar_avatars_path.'/'.$the_author.'.jpg';
else $the_avatar_jpg = $wpress_url.$usp_avatar_def_img;
// We draw avatars
echo '
';
}
if(!function_exists('get_avatar')) :
function get_avatar($array='', $sizeW='', $sizeH=''){
global $wpdb;
global $usp_avatar_avatars_path;
$the_author_name = get_comment_author();
if($the_author_name == "" or $the_author_name == __('Anonymous')){ // Avatar for posts
$the_author = get_the_author_id();
$the_author_name = get_the_author();
usp_show_avatar($the_author, $the_author_name, $sizeW, $sizeH);}
else { // Avatar for comments - only for registered users
$the_comment_ID = get_comment_ID();
$string = "SELECT user_ID FROM $wpdb->comments WHERE comment_ID='".$the_comment_ID."'";
$the_author = $wpdb->get_var($string);
usp_show_avatar($the_author, $the_author_name, $sizeW, $sizeH);}
}
endif;
}
function UserSidebarPanel() {
global $usp_language;
global $usp_note;
global $user_identity;
global $user_ID;
global $usp_show_avatar;
if ($user_identity) {
echo ''.$user_identity.'
';
//Show avatar
if(function_exists('usp_show_avatar') and $usp_show_avatar == true) usp_show_avatar($user_ID, $user_identity);
//Show link tree
usp_tree();
echo '
';
//Show note
if ($usp_show_note == true & $usp_note != '') echo ''.$usp_note.'
';
echo '';}
else {
echo ''.$user_identity.'
';
echo '
';
//Show login form or simple link
usp_form();
echo '
';}
}
function usp_widget($args) {
global $usp_language;
global $usp_show_note;
global $usp_note;
global $user_identity;
global $user_ID;
global $usp_show_avatar;
global $usp_tree_mode;
extract($args);
if ($user_identity) {
//Show widget header and title (title = $user_identity)
echo $before_widget.$before_title.$user_identity.$after_title;
echo '';
//Show avatar
if(function_exists('usp_show_avatar') and $usp_show_avatar == true) usp_show_avatar($user_ID, $user_identity);
//Show link tree
if($usp_tree_mode == 'old') usp_tree();
elseif($usp_tree_mode == 'ng') usp_tree_ng();
elseif($usp_tree_mode == 'small')usp_tree_small();
echo '
';
//Show note
if ($usp_show_note == true & $usp_note != '') echo ''.$usp_note.'
';
//Show widget footer
echo $after_widget;
}
else {
//Show widget header and title (title = $usp_language['login'])
echo $before_widget.$before_title.$usp_language['login'].$after_title;
//Show login form or simple link
usp_form();
//Show widget footer
echo $after_widget;
}
}
?>