function lhg_get_rank_level($uid) { if (!function_exists('cp_getPoints')) { return; } #$karma = cp_getPoints( $uid ); $karma = lhg_get_karma($uid); if ($karma < 1000) { $karma_rank_total = 1000; $rank_level = 2; } if ($karma < 100) { $karma_rank_total = 100; $rank_level = 1; } return $rank_level; }
?> <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?> " method="post" id="post_list_form" name="post_list_form" onsubmit="if(this.sra[0].checked) return confirm('<?php _e('Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-reloaded'); ?> ')"> <fieldset style="border:0"> <?php if ($public_user_ID != 0) { # we have user data $user = get_userdata($public_user_ID); $email = $user->user_email; $karma = lhg_get_karma($public_user_ID); //$num_com * 3 + $num_art * 50; $displayname = $user->display_name; $avatar = get_avatar($public_user_ID, 96); } if ($public_user_ID == 0) { # we are limited to guser data $user_tmp = lhg_get_userdata_guid($guid); $user = $user_tmp[0]; $email = $user->emails; $karma = $user->karma_com + $user->karma_de; //$num_com * 3 + $num_art * 50; $displayname = $user->user_nicename; $avatar = $user->avatar; # make it bigger! $avatar = str_replace("s=40", "s=96", $avatar);
function lhg_greeting_widget() { global $txt_twt_flattr; global $txt_twt_paypal; global $txt_twt_statistic; global $txt_twt_userid; global $txt_twt_hwnum; global $txt_twt_commnum; global $txt_twt_payment; global $txt_twt_actnum; global $txt_twt_pending; global $txt_twt_payd; global $txt_twt_maintext1; global $txt_twt_maintext2; global $donation; global $txt_lhgdb_karmapoints; global $txt_lhgdb_numhwscan; global $txt_lhgdb_numhwscans; global $txt_lhgdb_karmadescr; global $txt_lhgdb_karmadescr_end; global $txt_lhgdb_karma_howto; global $txt_lhgdb_karma_1; global $txt_lhgdb_karma_2; global $txt_lhgdb_karma_3; global $txt_lhgdb_karma_4; #$args = array( # 'url' => $this->_feed_url, # 'items' => '3', # 'show_date' => 1, # 'show_summary' => 1, #); $logo_url = sprintf('http://www.linux-hardware-guide.de/avatars/lhg60-avatar.png', is_ssl() ? 's' : ''); $icon = includes_url('images/rss.png'); $avatar = get_avatar($public_user_ID, 96); echo '<div class="rss-widget">'; #echo '<img class="alignright" src="' . esc_url_raw( $logo_url ) . '" />'; echo '<div class="hwprofile-avatar alignright" title="Avatar" style="padding:30px 0 5px 10px;">' . $avatar . '</div>'; //echo "<h3>Willkommen bei Linux-Hardware-Guide.de</h3>"; global $current_user; get_currentuserinfo(); $userid = $current_user->ID; // Check for Flattr-ID $FL_USERNAME = get_the_author_meta('flattr-id', $userid); $FL_PAYPAL = get_the_author_meta('paypal', $userid); /* if ($FL_USERNAME == "") echo ' <div class="error"><p><strong>'.$txt_twt_flattr.' </strong></div> '; if ($FL_PAYPAL == "") echo ' <div class="error"><p><strong>'.$txt_twt_paypal.' </strong></div> '; */ # Number of owned posts $user_post_count = count_user_posts($userid); # Number of uploaded hardware scans $guserids = lhg_get_current_users_guids(); #error_log("DE: ".$guserids["de"]." COM: ".$guserids["com"]); if ($guserids["de"] > 0) { # if uid = 0 all unassigned scans would be counted global $lhg_price_db; $sql = "SELECT COUNT(id) FROM `lhgscansessions` WHERE wp_uid_de = \"" . $guserids["de"] . "\""; $num_hwscans_de = $lhg_price_db->get_var($sql); } if ($guserids["com"] > 0) { # if uid = 0 all unassigned scans would be counted global $lhg_price_db; $sql = "SELECT COUNT(id) FROM `lhgscansessions` WHERE wp_uid = \"" . $guserids["com"] . "\""; $num_hwscans_com = $lhg_price_db->get_var($sql); } $num_hwscans = $num_hwscans_de + $num_hwscans_com; #Fallback if ($num_hwscans_de + $num_hwscans_com == 0) { global $lhg_price_db; $sql = "SELECT COUNT(id) FROM `lhgscansessions` WHERE wp_uid = \"" . $userid . "\""; $num_hwscans = $lhg_price_db->get_var($sql); } if (function_exists('cp_getPoints')) { $karma = lhg_get_karma($userid); } #$karma = cp_getPoints( $userid ); //$num_com * 3 + $num_art * 50; $donation_target = get_user_meta($userid, 'user_donation_target', true); if ($donation_target == "") { $donation_target = 1; } $donation_target_text = $donation[$donation_target]["Name"]; $args = array('user_id' => $userid, 'count' => true); $comments = get_comments($args); $user_post_count = count_user_posts($userid); $txt_numhwscans = $txt_lhgdb_numhwscans; #"uploaded hardware scans"; if ($num_hwscans == 1) { $txt_numhwscans = $txt_lhgdb_numhwscan; } #"uploaded hardware scan"; echo ' <div class="inside"> <div class="table table_content"> <p class="sub"><h2>' . $txt_twt_statistic . '</h2></p> <table> <tr class="first"><td class="first b b-posts"> <strong>' . $karma . '</strong></a></td><td class="t posts">' . $txt_lhgdb_karmapoints . '</td></tr> <tr><td class="first b b-cats"> <strong>' . $num_hwscans . '</strong> </td><td class="t cats">' . $txt_numhwscans . '</td></tr> <tr class="first"><td class="first b b-posts">'; if (current_user_can('edit_posts')) { print '<a href="edit.php">'; } print '<strong>' . $user_post_count . '</strong>'; if (current_user_can('edit_posts')) { print '</a>'; } print '</td><td class="t pages">'; if (current_user_can('edit_posts')) { print '<a href="edit.php">'; } print $txt_twt_hwnum; if (current_user_can('edit_posts')) { print '</a>'; } print '</td></tr> <tr><td class="first b b-cats"> <a href="edit-comments.php"><strong>' . $comments . '</strong></a></td><td class="t cats"><a href="edit-comments.php">' . $txt_twt_commnum . '</a></td></tr> <p> </table> <p> ' . $txt_lhgdb_karmadescr . $donation_target_text . '. ' . $txt_lhgdb_karmadescr_end . ' </div> </div>'; //echo "<h2>Statistik:</h2>"; //echo '<p style="border-top: 1px solid #CCC; padding-top: 10px; font-weight: bold;">'; echo ' <div class="inside"> <div class="table table_content"> <p class="sub"><h2>' . $txt_lhgdb_karma_howto . '</h2></p> ' . $txt_lhgdb_karma_1 . ' <br> <tt>' . do_shortcode("[lhg_scancommand ]") . '</tt> <p> ' . $txt_lhgdb_karma_2 . ' <p>'; if ($karma < 50) { print $txt_lhgdb_karma_3 . ' ' . LHG_KARMA_edit_posts . ' ' . $txt_lhgdb_karma_4; } print '</div> </div>'; echo ' <div class="inside"> <div class="table table_content"> </div> </div>'; echo "</p>"; echo "</div>"; }