function uoltt_api_v1_user_dict(WP_REST_Request $request) { require_once SC_USER_DIR . "/library/sc_user_misc.class.php"; $misc = new sc_user_misc(); $search = $request->get_param("search"); $sort = $request->get_param("sort"); $order = $request->get_param("order"); $users = $misc->get_users($search, $sort, $order, TRUE); $users = array_values($users); $dict = array(); for ($i = 0; $i < sizeof($users); $i++) { $dict[$users[$i]["ID"]] = $users[$i]; } return array("users" => $dict); }
public function user_ships() { error_reporting(E_ALL); global $sapi; require_once SC_USER_DIR . "/library/sc_user_misc.class.php"; $misc = new sc_user_misc(); if (empty($_GET['user'])) { $sapi->error("Please set the 'user' variable in order to use this feature"); } if (is_numeric($_GET['user'])) { $ships = $misc->get_user_ships($_GET['user']); $userid = $_GET['user']; } else { $users = $misc->get_users($_GET['user']); $userdata = array_values($users); $userid = $userdata[0]['ID']; if (empty($users)) { $sapi->error("user not found"); } $ships = $misc->get_user_ships($userid); // grabbing first result } return array("user" => $userid, "ships" => $ships); }
public function verified_user() { global $scdb; require_once SC_USER_DIR . "/library/sc_user_misc.class.php"; $misc = new sc_user_misc(); $user_data = $misc->get_users($this->ltt_id, NULL, NULL, true); //$usr = $user_data['users'][$this->ltt_id]; $usr = array_values($user_data); $usr = $usr[0]; ?> <tr> <th><label for="sc1">Star Citizen Moniker/Handle</label></th> <td> <input type="text" name="sc1" id="sc1" class="regular-text" value="<?php echo $usr['SC Handle']; ?> " /><br /> <span class="description">Enter your Star Citizen Moniker</span> </td> </tr> <tr> <th><label for="forum">LinusTechTips.com User</label></th> <td> <input type="text" name="forum" id="forum" class="regular-text" value="<?php echo $usr['LTT Name']; ?> " /><br /> <span class="description">Enter your LinusTechTips.com Username</span> </td> </tr> <tr> <th><label for="sc2">Star Citizen Name</label></th> <td> <input type="text" name="sc2" id="sc2" class="regular-text" value="<?php echo $usr['SC Name']; ?> " /><br /> <span class="description">Enter your Star Citizen Name</span> </td> </tr> <tr> <th><label for="rank">UOLTT Rank</label></th> <td> <input <?php $this->disabled(); ?> type="text" name="rank" id="rank" class="regular-text sc-rank" value="<?php echo $usr['Rank']['military']; ?> " /><br /> <span class="description">Your Star Citizen Rank</span> </td> </tr> <tr> <th><label for="role">UOLTT Role</label></th> <td> <input <?php $this->disabled(); ?> type="text" name="uoltt_role" id="uoltt_role" class="regular-text sc-role" value="<?php echo $usr['Role']; ?> " /><br /> <span class="description">Your UOLTT Role</span> </td> </tr> <tr> <th><label for="uoltt_member_status">UOLTT Membership Status</label></th> <td> <input disabled type="text" name="uoltt_member_status" id="uoltt_member_status" class="regular-text" value="<?php echo esc_attr(get_the_author_meta('uoltt_member_status', $this->user_id)); ?> " /><br /> <span class="description">Your UOLTT Membership Status</span> </td> </tr> <tr> <th><label for="ships">Owned Ships</label></th> <td> <?php $ships = $usr['Ships']; if (!empty($ships)) { foreach ($ships as $ship) { ?> <input type="text" id="ships" name="ships[]" class="regular-text sc-ships" value="<?php echo $ship; ?> "><br> <?php } } else { ?> <input type="text" id="ships" name="ships[]" class="regular-text sc-ships" value="You have no ships"> <?php } ?> <input type="button" class="button button-primary" id="add_ship_button" value="Add Ship"> <span class="description">The ships you own (blank entries will be deleted)</span> </td> </tr> <tr> <th><label for="sc_profile_visibility">UOLTT Profile Visibility</label></th> <td> <?php $name = esc_attr(get_the_author_meta('sc_profile_visibility', $this->user_id)); ?> <select name='sc_profile_visibility'> <option <?php $this->option_selected("Public", $name); ?> value='Public'>Public</option> <option <?php $this->option_selected("UOLTT Only", $name); ?> value='UOLTT Only'>UOLTT Only</option> </select><br> <span class="description">Toggle to switch between publicly available and visible UOLTT members only</span> </td> </tr> <?php }
<td>Global Search:</td> <td> <input <?php echo "value='" . $text . "'"; ?> type="text" name="text_search"> </td> </tr> </table> <input type="submit" class="button button-primary" name="search" value="Search"> </form> <br> <table class="widefat" cellspacing="0"> <?php global $wpdb; $sc_users = $misc->get_users($text, $sort, $order, $a['show_private']); $sc_users = array_values($sc_users); if (!$a['show_private']) { $users = get_users(array('meta_key' => 'sc_profile_visibility', 'meta_value' => 'UOLTT Only')); foreach ($users as $user) { unset($sc_users[get_user_meta($user->ID, 'nameUID', true)]); } } if (!$a['show_private']) { $sc_users = array_slice($sc_users, 0, 25); } $sc_users = array_values($sc_users); $first = reset($sc_users); if (!empty($first)) { // get row headings echo "<tr>";