function sp_notify($type, $text, $now = false) { global $spThisUser; # test for extreme condition if (empty($spThisUser->trackid)) { return; } $data = serialize(array($type, $text)); if ($now) { $spThisUser->notification = $data; sp_render_queued_notification(false); } else { spdb_query('UPDATE ' . SFTRACK . " SET notification='{$data}' WHERE id={$spThisUser->trackid}"); } }
function sp_ProfileEditMobile($tabSlug = 'profile', $menuSlug = 'overview') { # is this edit for current user of admin edit of user global $spVars, $spThisUser; if (!empty($spVars['member'])) { $userid = (int) $spVars['member']; } else { $userid = $spThisUser->ID; } if (empty($userid) || $spThisUser->ID != $userid && !$spThisUser->admin) { sp_notify(SPFAILURE, sp_text('Invalid profile request')); $out = sp_render_queued_notification(); $out .= '<div class="spMessage">'; $out .= apply_filters('sph_ProfileErrorMsg', sp_text('Sorry, an invalid profile request was detected. Do you need to log in?')); $out .= '</div>'; echo $out; return; } # see if query args used to specify tab and/or menu if (isset($_GET['ptab'])) { $tabSlug = sp_esc_str($_GET['ptab']); } if (isset($_GET['pmenu'])) { $menuSlug = sp_esc_str($_GET['pmenu']); } # set up the profile data global $spProfileUser; sp_SetupUserProfileData($userid); do_action('sph_profile_edit_before'); do_action('sph_ProfileStart'); $tabs = sp_profile_get_tabs(); if (!empty($tabs)) { do_action('sph_profile_edit_before_tabs'); echo '<div id="spProfileAccordion">'; echo "<div class='spProfileAccordionTab'>\n"; $firstTab = $firstMenu = ''; $tabSlugExist = $menuSlugExist = false; foreach ($tabs as $tab) { # do we need an auth check? $authCheck = empty($tab['auth']) ? true : sp_get_auth($tab['auth'], '', $userid); # is this tab being displayed and does user have auth to see it? if ($authCheck && $tab['display']) { if ($tab['slug'] == $tabSlug) { $tabSlugExist = true; } if (empty($firstTab)) { $firstTab = $tab['slug']; } echo '<h2 id="spProfileTabTitle-' . esc_attr($tab['slug']) . '">' . sp_filter_title_display($tab['name']) . "</h2>\n"; echo "<div id='spProfileTab-" . esc_attr($tab['slug']) . "' class='spProfileAccordionPane'>\n"; if (!empty($tab['menus'])) { echo "<div class='spProfileAccordionTab'>\n"; foreach ($tab['menus'] as $menu) { # do we need an auth check? $authCheck = empty($menu['auth']) ? true : sp_get_auth($menu['auth'], '', $userid); # is this menu being displayed and does user have auth to see it? if ($authCheck && $menu['display']) { if ($menu['slug'] == $menuSlug) { $menuSlugExist = true; } if (empty($firstMenu)) { $firstMenu = $menu['slug']; } $thisSlug = $menu['slug']; # this variable is used in the form action url # special checking for displaying menus $spProfileOptions = sp_get_option('sfprofile'); $spAvatars = sp_get_option('sfavatars'); $noPhotos = $menu['slug'] == 'edit-photos' && $spProfileOptions['photosmax'] < 1; # dont display edit photos if disabled $noAvatars = $menu['slug'] == 'edit-avatars' && !$spAvatars['sfshowavatars']; # dont display edit avatars if disabled $hideMenu = $noPhotos || $noAvatars; $hideMenu = apply_filters('sph_ProfileMenuHide', $hideMenu, $tab, $menu, $userid); if (!$hideMenu) { echo '<h2 id="spProfileMenuTitle-' . esc_attr($menu['slug']) . '">' . sp_filter_title_display($menu['name']) . "</h2>\n"; echo "<div id='spProfileMenu-" . esc_attr($menu['slug']) . "' class='spProfileAccordionPane'>\n"; if (!empty($menu['form']) && file_exists($menu['form'])) { echo "<div class='spProfileAccordionForm'>\n"; include_once $menu['form']; echo "</div>\n"; } else { echo sp_text('Profile form could not be found') . ': [' . $menu['name'] . ']<br />'; echo sp_text('You might try the forum - toolbox - housekeeping admin form and reset the profile tabs and menus and see if that helps'); } echo "</div>\n"; # menu pane } } } echo "</div>\n"; # menu accordion } echo "</div>\n"; # tab pane } } echo "</div>\n"; # tab accordion echo '</div>'; # profile accordion do_action('sph_profile_edit_after_tabs'); # inline js to create profile tabs global $firstTab, $firstMenu; $firstTab = $tabSlugExist ? $tabSlug : $firstTab; # if selected tab does not exist, use first tab $firstMenu = $menuSlugExist ? $menuSlug : $firstMenu; # if selected tab does not exist, use first menu in first tab # are we forcing password change on first login? if (isset($spThisUser->sp_change_pw) && $spThisUser->sp_change_pw) { $firstTab = 'profile'; $firstMenu = 'account-settings'; } add_action('wp_footer', 'sp_ProfileEditFooterMobile'); } do_action('sph_profile_edit_after'); }
<script type="text/javascript"> jQuery(document).ready(function() { setTimeout(function() { spjSetProfileDataHeight(); }, 500); }) </script> <?php die; } # check for tab press if (isset($_GET['tab'])) { # profile edit, so only admin or logged in user can view if (empty($userid) || $spThisUser->ID != $userid && !$spThisUser->admin) { sp_notify(SPFAILURE, sp_text('Invalid profile request')); $out .= sp_render_queued_notification(); $out .= '<div class="sfmessagestrip">'; $out .= apply_filters('sph_ProfileErrorMsg', sp_text('Sorry, an invalid profile request was detected. Do you need to log in?')); $out .= '</div>'; return $out; } # set up profile for requested user sp_SetupUserProfileData($userid); # get pressed tab and menu (if pressed) $thisTab = sp_esc_str($_GET['tab']); $thisMenu = isset($_GET['menu']) ? sp_esc_str($_GET['menu']) : ''; # get all the tabs meta info $tabs = sp_profile_get_tabs(); if (!empty($tabs)) { foreach ($tabs as $tab) { # find the pressed tab in the list of tabs
function sp_process_template() { global $spVars, $spGlobals, $spThisUser, $spNewPosts; # grab the pageview, checking to see if its a search page $pageview = $spVars['pageview']; # determine page template to load switch ($pageview) { case 'group': $tempName = sp_process_group_view(); break; case 'forum': $tempName = sp_process_forum_view(); break; case 'topic': $tempName = sp_process_topic_view(); break; case 'search': $tempName = sp_process_search_view(); break; case 'members': $tempName = sp_process_members_view(); break; case 'profileedit': $tempName = sp_process_profileedit_view(); break; case 'profileshow': $tempName = sp_process_profileshow_view(); break; case 'newposts': $tempName = sp_process_newposts_view(); break; default: $tempName = sp_process_default_view($pageview); break; } # allow plugins/themes access to the template name $tempName = apply_filters('sph_TemplateName', $tempName, $pageview); # allow output prior to SP display do_action('sph_BeforeDisplayStart', $pageview, $tempName); # SP display starts here # Any control data item inspection needed if (sp_current_user_can('SPF Manage Toolbox') && !empty($spThisUser->inspect)) { sp_display_inspector('control', ''); } # forum top anchor echo '<a id="spForumTop"></a>'; # Define the main forum container echo "\n\n<!-- Simple:Press display start -->\n\n"; echo '<div id="spMainContainer">'; # Create the sliding panel div needed for mobile display echo "<div id='spMobilePanel'></div>"; # allow output before the SP display do_action('sph_AfterDisplayStart', $pageview, $tempName); # load the pageview template if valid sp_load_template($tempName); # allow output after the SP display do_action('sph_BeforeDisplayEnd', $pageview, $tempName); # Display any queued messages sp_render_queued_notification(); echo '</div>'; echo "\n\n<!-- Simple:Press display end -->\n\n"; # forum bottom anchor echo '<a id="spForumBottom"></a>'; # SP display ends here # allow output after the SP display do_action('sph_AfterDisplayEnd', $pageview, $tempName); # Post display processing sp_post_display_processing($pageview); }