//get number of contributed hardware articles $num_art = count_user_posts($public_user_ID); //get number of comments global $wpdb; $where = 'WHERE comment_approved = 1 AND user_id = ' . $public_user_ID; $num_com = $wpdb->get_var("SELECT COUNT( * ) AS total\n\t FROM {$wpdb->comments}\n\t {$where}"); //first steps to implement karma //$karma = $num_com * 3 + $num_art * 50; #if (function_exists('cp_getPoints')) #$karma = cp_getPoints( $public_user_ID ); //$num_com * 3 + $num_art * 50; $subscriptions = $wp_subscribe_reloaded->get_subscriptions('email', 'equals', $email, 'dt', 'DESC'); #echo 'Username: '******'<br />'; #echo 'User email: ' . $current_user->user_email . '<br />'; #echo 'User first name: ' . $current_user->user_firstname . '<br />'; #echo 'User last name: ' . $current_user->user_lastname . '<br />'; $rank_level = lhg_get_rank_level($public_user_ID); $karma_rank_total = lhg_get_karma_threshold($rank_level); if (function_exists('cp_module_ranks_getRank')) { $rank_txt = cp_module_ranks_getRank($public_user_ID); } //if ($karma < 1000){ $karma_rank_total = 1000; $rank_level = 2; } //if ($karma < 100) { $karma_rank_total = 100 ; $rank_level = 1; } $max_rank_levels = 7; $squares_full = '<div class="square_full"></div>'; $squares_empty = '<div class="square_empty"></div>'; $squares = '<br><div class="squarebar">'; $i = 0; while ($i < $rank_level) { $squares .= $squares_full; $i++; }
function lhg_comment_percent_bar($uid) { global $lang; if ($lang == "de") { return; } #$karma = cp_getPoints( $uid ); $karma = lhg_get_karma($uid); $level = lhg_get_rank_level($uid); $rank_txt = cp_module_ranks_getRank($public_user_ID); $max_rank = 3; $tooltip = lhg_user_tooltip($uid); $output = '<div class="comment_percent_bar">'; $output .= '<div class="rateline" style="border: 0px solid #000;" title="' . $tooltip . '"> <div style="float: left;"></div> <div class="outerbox" style="background-color: #fff; width: 54px; float: left; margin: 4px 0px; border: 1px solid #eee;"> <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 6px; width: ' . 100 * $level / $max_rank . '%;" > </div> </div> </div>'; //$output .= ''.$rank_txt.''; $output .= '</div>'; return $output; }