get_username($member_id_of); if ((is_null($username)) || (is_guest($member_id_of))) { warn_exit(do_lang_tempcode('MEMBER_NO_EXIST')); } } $tabs = array(); $only_tab = get_param_string('only_tab', null); $hooks = find_all_hooks('systems', 'profiles_tabs'); if (isset($hooks['edit'])) { // Editing must go first, so changes reflect in the renders of the tabs $hooks = array('edit' => $hooks['edit']) + $hooks; } foreach (array_keys($hooks) as $hook) { if (($only_tab === null) || (preg_match('#(^|,)' . preg_quote($hook, '#') . '(,|$)#', $only_tab) != 0)) { require_code('hooks/systems/profiles_tabs/' . $hook); $ob = object_factory('Hook_profiles_tabs_' . $hook); if ($ob->is_active($member_id_of, $member_id_viewing)) { $tabs[$hook] = $ob->render_tab($member_id_of, $member_id_viewing, (preg_match('#(^|,)' . preg_quote($hook, '#') . '(,|$)#', $only_tab) == 0) && !browser_matches('ie6') && !browser_matches('ie7') && has_js()); } } } if (!is_null($only_tab)) { $_unsorted = $tabs; $tabs = array(); foreach (explode(',', $only_tab) as $tab) { if (isset($_unsorted[$tab])) { $tabs[$tab] = $_unsorted[$tab]; } } } else { sort_maps_by($tabs, 2); } require_javascript('profile'); require_javascript('ajax'); // AJAX should load up any scripts embedding in tabs without an issue, but some browsers or optimisers (e.g. Cloudflare) may have issues - so we'll load stuff here $scripts = array( // TODO: Amend in v11 'ajax', 'ajax_people_lists', 'checking', 'editing', 'multi', 'notifications', 'posting', 'tree_list', 'modernizr', 'widget_color', 'widget_date', ); foreach ($scripts as $script) { require_javascript($script); } $_tabs = array(); $i = 0; foreach ($tabs as $hook => $tab) { if ($only_tab === $hook) { $title = get_screen_title($tab[0], false); } if ($tab[1] !== null) { //$tab[1]->handle_symbol_preprocessing(); $tab[1] = $tab[1]->evaluate(); // So that SETs run early, thus things can be moved outside tabs } $_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_CODE' => $hook, 'TAB_ICON' => $tab[3], 'TAB_CONTENT' => $tab[1], 'TAB_FIRST' => $i == 0, 'TAB_LAST' => $i + 1 == count($tabs)); $i++; } return do_template('CNS_MEMBER_PROFILE_SCREEN', array('_GUID' => '2f33348714723492105c4717974c8f4c', 'TITLE' => $title, 'TABS' => $_tabs, 'MEMBER_ID' => strval($member_id_of))); }