function tcapi_get_coder($atts, $handle = "") { $handle = clean_pre($handle); $userKey = get_option('api_user_key'); $coder_profile = get_member_profile($userKey, $handle); $coder_ratings = $coder_profile->ratingsSummary; $coder_handle = $coder_profile->handle; if ($coder_handle != "") { $coder_color = $coder_ratings[0]->colorStyle; $coder_max_rating = 'NA'; $siteURL = site_url(); if (count($coder_ratings) > 0) { foreach ($coder_ratings as $coder_rating) { $cur_rating = $coder_rating->rating; if ($coder_max_rating == 'NA' || $coder_max_rating < $cur_rating) { $coder_max_rating = $cur_rating; $coder_color = $coder_rating->colorStyle; } } } if ($coder_profile->isPM) { $coder_color = "color:#FF9900"; } return '<a class="tc_coder coder" href="' . $siteURL . '/member-profile/' . $coder_handle . '" style="' . $coder_color . '">' . $coder_handle . '</a>'; } return $handle; }
function get_member_basic_data_shortcode($atts, $content = null) { extract(shortcode_atts(array("width" => ''), $atts)); if ($width != "") { $mainDivWidth = $width != "" ? "width:" . $width . "px;" : ""; } $data = get_member_profile($content); $memberSince = substr($data->memberSince, 0, 10); $arrRating = $data->ratingSummary; $ratingColor = ""; $rating = 0; for ($i = 0; $i < count($arrRating); $i++) { if ($arrRating[$i]->rating > $rating) { $ratingColor = $arrRating[$i]->colorStyle; $rating = $arrRating[$i]->rating; } } $ret = ''; if ($data != "Error in processing request") { $ret .= '<div style="' . $mainDivWidth . '" class="shortcodeMainDiv">'; $ret .= ' <div class="memberProfilePicture">'; if (isset($data->photoLink)) { $ret .= ' <img src="http://www.topcoder.com' . $data->photoLink . '" alt="" width="141" height="140" />'; } else { $ret .= ' <img src="' . plugins_url("TcApi-hookup") . '/includes/i/member-placeholder.png" alt="" width="141" height="140" />'; } $ret .= ' </div>'; $ret .= ' <p class="memberProfile"><span class="handle" id="handle" style="' . $ratingColor . '" >' . $data->handle . '</span></p>'; $ret .= ' <p id="memberSince" class="memberProfile"><label>Member Since</label><span class="alignRight">' . $memberSince . '</span></p>'; $ret .= ' <p id="country" class="memberProfile"><label>Country</label><span class="alignCenter">' . $data->country . '</span></p>'; $ret .= ' </div>'; } return $ret; }
function get_member_profile_ajax_controller() { $userkey = get_option('api_user_key'); $handle = $_GET["handle"]; $memberProfile = get_member_profile($handle); if (isset($memberProfile)) { wp_send_json($memberProfile); } else { wp_send_json_error(); } }
function get_member_profile_ajax_controller() { $userkey = get_option('api_user_key'); $handle = $_GET["handle"]; $memberProfile = get_member_profile($userkey, $handle); if ($memberProfile != null) { echo json_encode($memberProfile); } die; }