/** * Standard modular render function for profile tab hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return array A triple: The tab title, the tab contents, the suggested tab order */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { require_lang('points'); $title = do_lang_tempcode('POINTS'); $order = 40; if ($leave_to_ajax_if_possible) { return array($title, NULL, $order); } require_code('points3'); require_css('points'); $content = points_profile($member_id_of, $member_id_viewing); return array($title, $content, $order); }
/** * The UI for a points profile. * * @param ?MEMBER The member the points profile of which is being viewed (NULL: read from GET parameter 'id') * @return tempcode The UI */ function points_profile($member_id_of = NULL) { if (is_null($member_id_of)) { $member_id_of = get_param_integer('id', get_member()); } $name = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of); if (is_null($name) || is_guest($member_id_of)) { warn_exit(do_lang_tempcode('USER_NO_EXIST')); } $title = get_page_title('_POINTS', true, array(escape_html($name))); if (get_forum_type() == 'ocf') { $url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id_of, true, true); if (is_object($url)) { $url = $url->evaluate(); } return redirect_screen($title, $url . '#tab__points', ''); } $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=points&filter=' . strval($member_id_of); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('USER_POINT_FIND')))); // Previous/Next links $max_rows = $GLOBALS['FORUM_DRIVER']->get_members(); $page_num = intval(floor(floatval($member_id_of - 1) / 1.0)) + 1; $num_pages = intval(ceil(floatval($max_rows) / 1.0)); $tempid = $GLOBALS['FORUM_DRIVER']->get_previous_member($member_id_of); if (is_null($tempid)) { $previous_link = new ocp_tempcode(); } else { $previous_link = build_url(array('page' => '_SELF', 'type' => 'member', 'id' => $tempid), '_SELF'); } $tempid = $GLOBALS['FORUM_DRIVER']->get_next_member($member_id_of); if (is_null($tempid)) { $next_link = new ocp_tempcode(); } else { $next_link = build_url(array('page' => '_SELF', 'type' => 'member', 'id' => $tempid), '_SELF'); } $browse = do_template('NEXT_BROWSER_BROWSE_NEXT', array('_GUID' => '188c059239b39ca8ee70f85b38019490', 'PREVIOUS_LINK' => $previous_link, 'NEXT_LINK' => $next_link, 'PAGE_NUM' => integer_format($page_num), 'NUM_PAGES' => integer_format($num_pages))); require_code('points3'); $content = points_profile($member_id_of, get_member()); return do_template('POINTS_SCREEN', array('TITLE' => $title, 'CONTENT' => $content, 'BROWSE' => $browse)); }