function go_extra_profile_fields($user) { ?> <h3><?php echo go_return_options('go_class_a_name') . ' and ' . go_return_options('go_class_b_name'); ?> </h3> <table id="go_user_form_table"> <th><?php echo go_return_options('go_class_a_name'); ?> </th><th><?php echo go_return_options('go_class_b_name'); ?> </th> <tbody id="go_user_form_table_body"> <?php if (get_user_meta($user->ID, 'go_classifications', true)) { foreach (get_user_meta($user->ID, 'go_classifications', true) as $keyu => $valueu) { ?> <tr> <td> <?php $class_a = get_option('go_class_a', false); if ($class_a) { ?> <select name="class_a_user[]"><option name="<?php echo $keyu; ?> " value="<?php echo $keyu; ?> "><?php echo $keyu; ?> </option> <option value="go_remove">Remove</option> <?php foreach ($class_a as $key => $value) { echo "<option name='{$value}' value='{$value}'>{$value}</option>"; } ?> </select> <?php } ?> </td> <td> <?php $class_b = get_option('go_class_b', false); if ($class_b) { ?> <select name="class_b_user[]"><option name="<?php echo $valueu; ?> " value="<?php echo $valueu; ?> "><?php echo $valueu; ?> </option> <option value="go_remove">Remove</option> <?php foreach ($class_b as $key => $value) { echo "<option name='{$value}' value='{$value}'>{$value}</option>"; } ?> </select> <?php } ?> </td> </tr> <?php } } ?> </tbody> <tr> <td><button onclick="go_add_class();" type="button">+</button></td> </tr> </table> <?php if (get_option('go_focus_switch', true) == 'On') { echo "<h3>User " . go_return_options('go_focus_name') . "</h3>" . go_display_user_focuses($user->ID) . ""; } ?> <script type="text/javascript" language="javascript"> function go_add_class() { jQuery.ajax({ type: 'post', url: MyAjax.ajaxurl, data: { action: 'go_user_option_add', go_clipboard_class_a_choice: jQuery( '#go_clipboard_class_a_choice' ).val() }, success: function( html ) { jQuery( '#go_user_form_table_body' ).append( html ); } }); } </script> <?php }
function go_clipboard_intable() { global $wpdb; $class_a_choice = $_POST['go_clipboard_class_a_choice']; $table_name_user_meta = $wpdb->prefix . 'usermeta'; $table_name_go = $wpdb->prefix . 'go'; $uid = $wpdb->get_results("SELECT user_id \n\t\tFROM {$table_name_user_meta} \n\t\tWHERE meta_key = '{$wpdb->prefix}capabilities' \n\t\tAND meta_value NOT LIKE '%administrator%'"); print_r($uid); foreach ($uid as $id) { foreach ($id as $value) { $class_a = get_user_meta($value, 'go_classifications', true); if ($class_a) { if ($class_a[$class_a_choice]) { $user_data_key = get_userdata($value); $user_login = $user_data_key->user_login; $user_display = $user_data_key->display_name; $user_first_name = $user_data_key->user_firstname; $user_last_name = $user_data_key->user_lastname; $user_url = $user_data_key->user_url; $user_focuses = go_display_user_focuses($value); $focus_name = get_option('go_focus_name'); $focuses = get_option('go_focus'); $focuses_list = ''; $focuses_list = "<option value='No {$focus_name}' " . (empty($user_focuses) || $user_focuses == "No {$focus_name}" ? "selected" : "") . ">No {$focus_name}</option>"; foreach ($focuses as $focus) { $focuses_list .= "<option value='{$focus}' " . ($focus == $user_focuses ? "selected" : "") . ">{$focus}</option>"; } $bonus_currency = go_return_bonus_currency($value); $penalty = go_return_penalty($value); $currency = go_return_currency($value); $points = go_return_points($value); $badge_count = go_return_badge_count($value); go_get_rank($value); global $current_rank; echo "<tr id='user_{$value}'>\n\t\t\t\t\t\t\t<td><input class='go_checkbox' type='checkbox' name='go_selected' value='{$value}'/></td>\n\t\t\t\t\t\t\t<td><span><a href='#' onclick='go_admin_bar_stats_page_button("{$value}");'>{$user_login}</a></td>\n\t\t\t\t\t\t\t<td>{$class_a[$class_a_choice]}</td>\n\t\t\t\t\t\t\t<td><a href='{$user_url}' target='_blank'>{$user_last_name}, {$user_first_name}</a></td>\n\t\t\t\t\t\t\t<td>{$user_display}</td>\n\t\t\t\t\t\t\t<td>{$current_rank}</td>\n\t\t\t\t\t\t\t" . (go_return_options('go_focus_switch') == 'On' ? "<td><select class='go_focus' onchange='go_user_focus_change("{$value}", this);'>{$focuses_list}</select</td>" : "") . "\n\t\t\t\t\t\t\t<td class='user_points'>{$points}</td>\n\t\t\t\t\t\t\t<td class='user_currency'>{$currency}</td>\n\t\t\t\t\t\t\t<td class='user_bonus_currency'>{$bonus_currency}</td>\n\t\t\t\t\t\t\t<td class='user_penalty'>{$penalty}</td>\n\t\t\t\t\t\t\t<td class='user_badge_count'>{$badge_count}</td>\n\t\t\t\t\t\t </tr>"; } } } } die; }
function go_admin_bar_stats() { global $wpdb; $table_name_go = $wpdb->prefix . "go"; if (!empty($_POST['uid'])) { $current_user = get_userdata($_POST['uid']); } else { $current_user = wp_get_current_user(); } ?> <input type="hidden" id="go_stats_hidden_input" value="<?php echo !empty($_POST['uid']) ? $_POST['uid'] : null; ?> "/> <?php $user_fullname = $current_user->first_name . ' ' . $current_user->last_name; $user_login = $current_user->user_login; $user_display_name = $current_user->display_name; $user_id = $current_user->ID; $user_website = $current_user->user_url; $current_user_id = $current_user->ID; $user_avatar = get_avatar($current_user_id, 161); $user_focuses = go_display_user_focuses($current_user_id); // option names $points_name = go_return_options('go_points_name'); $currency_name = go_return_options('go_currency_name'); $bonus_currency_name = go_return_options('go_bonus_currency_name'); $penalty_name = go_return_options('go_penalty_name'); $minutes_name = go_return_options('go_minutes_name'); // user pnc go_get_rank($current_user_id); $current_points = go_return_points($current_user_id); $current_currency = go_return_currency($current_user_id); $current_bonus_currency = go_return_bonus_currency($current_user_id); $current_penalty = go_return_penalty($current_user_id); $current_minutes = go_return_minutes($current_user_id); global $current_rank; global $current_rank_points; global $next_rank; global $next_rank_points; $display_current_rank_points = $current_points - $current_rank_points; $display_next_rank_points = $next_rank_points - $current_rank_points; $percentage_of_level = $display_current_rank_points / $display_next_rank_points * 100; ?> <div id='go_stats_lay'> <div id='go_stats_gravatar'><?php echo $user_avatar; ?> </div> <div id='go_stats_header'> <div id='go_stats_user_info'> <?php echo "{$user_fullname}<br/>{$user_login}<br/><a href='{$user_website}' target='_blank'>{$user_display_name}</a><br/><div id='go_stats_user_points'><span id='go_stats_user_points_value'>{$current_points}</span> {$points_name}</div><div id='go_stats_user_currency'><span id='go_stats_user_currency_value'>{$current_currency}</span> {$currency_name}</div><div id='go_stats_user_bonus_currency'><span id='go_stats_user_bonus_currency_value'>{$current_bonus_currency}</span> {$bonus_currency_name}</div>{$current_penalty} {$penalty_name}<br/>{$current_minutes} {$minutes_name}"; ?> </div> <div id='go_stats_user_rank'><?php echo $current_rank; ?> </div> <div id='go_stats_user_progress'> <div id="go_stats_progress_text_wrap"> <div id='go_stats_progress_text'><?php echo "<span id='go_stats_user_progress_top_value'>{$display_current_rank_points}</span>/<span id='go_stats_user_progress_bottom_value'>{$display_next_rank_points}</span>"; ?> </div> </div> <div id='go_stats_progress_fill' style='width: <?php echo $percentage_of_level; ?> %;<?php $color = barColor($current_bonus_currency, $current_penalty); echo "background-color: {$color}"; if ($percentage_of_level >= 98) { echo "border-radius: 15px"; } ?> '></div> </div> <?php if (go_return_options('go_focus_switch') == 'On') { ?> <div id='go_stats_user_focuses'><?php echo !empty($user_focuses) ? $user_focuses : ''; ?> </div> <?php } ?> <div id='go_stats_user_tabs'> <!-- <a href='javascript:;' id="go_stats_body_progress" class='go_stats_body_selectors' tab='progress'> WEEKLY PROGRESS </a> | --> <?php $is_admin = current_user_can('manage_options'); if ($is_admin) { ?> <a href='javascript:;' id='go_stats_admin_help' class='go_stats_body_selectors' tab='help'> HELP </a> | <?php } ?> <a href='javascript:;' id="go_stats_body_tasks" class='go_stats_body_selectors' tab='tasks'> <?php echo strtoupper(go_return_options('go_tasks_plural_name')); ?> </a> | <a href='javascript:;' id="go_stats_body_items" class='go_stats_body_selectors' tab='items'> <?php echo strtoupper(go_return_options('go_inventory_name')); ?> </a> | <a href='javascript:;' id="go_stats_body_rewards" class='go_stats_body_selectors' tab='rewards'> REWARDS </a> | <a href='javascript:;' id="go_stats_body_minutes" class='go_stats_body_selectors' tab='minutes'> <?php echo strtoupper($minutes_name); ?> </a> | <a href='javascript:;' id="go_stats_body_penalties" class='go_stats_body_selectors' tab='penalties'> <?php echo strtoupper($penalty_name); ?> </a> | <a href='javascript:;' id="go_stats_body_badges" class='go_stats_body_selectors' tab='badges'> <?php echo strtoupper(go_return_options('go_badges_name')); ?> </a> | <a href='javascript:;' id="go_stats_body_leaderboard" class='go_stats_body_selectors' tab='leaderboard'> <?php echo strtoupper(go_return_options('go_leaderboard_name')); ?> </a> </div> </div> <div id='go_stats_body'></div> </div> <?php die; }