function spa_get_display_data()
{
    $sfdisplay = sp_get_option('sfdisplay');
    $sfcontrols = sp_get_option('sfcontrols');
    # Page title
    $sfoptions['sfnotitle'] = $sfdisplay['pagetitle']['notitle'];
    $sfoptions['sfbanner'] = sp_filter_url_display($sfdisplay['pagetitle']['banner']);
    # Stats
    $sfoptions['showtopcount'] = $sfcontrols['showtopcount'];
    $sfoptions['shownewcount'] = $sfcontrols['shownewcount'];
    $sfoptions['statsinterval'] = sp_get_option('sp_stats_interval') / 3600;
    # display in hours
    $sfoptions['sfdefunreadposts'] = $sfcontrols['sfdefunreadposts'];
    $sfoptions['sfusersunread'] = $sfcontrols['sfusersunread'];
    $sfoptions['sfmaxunreadposts'] = $sfcontrols['sfmaxunreadposts'];
    $sfoptions['sfsingleforum'] = $sfdisplay['forums']['singleforum'];
    $sfoptions['sfpagedtopics'] = $sfdisplay['topics']['perpage'];
    $sfoptions['sftopicsort'] = $sfdisplay['topics']['sortnewtop'];
    $sfoptions['sfpagedposts'] = $sfdisplay['posts']['perpage'];
    $sfoptions['sfsortdesc'] = $sfdisplay['posts']['sortdesc'];
    $sfoptions['sftoolbar'] = $sfdisplay['editor']['toolbar'];
    return $sfoptions;
}
function spa_get_messages_data()
{
    $sfcomps = array();
    # custom message for posts
    $sfpostmsg = array();
    $sfpostmsg = sp_get_option('sfpostmsg');
    $sflogin = array();
    $sflogin = sp_get_option('sflogin');
    $sfcomps['sfpostmsgtext'] = sp_filter_text_edit($sfpostmsg['sfpostmsgtext']);
    $sfcomps['sfpostmsgtopic'] = $sfpostmsg['sfpostmsgtopic'];
    $sfcomps['sfpostmsgpost'] = $sfpostmsg['sfpostmsgpost'];
    # custom editor message
    $sfcomps['sfeditormsg'] = sp_filter_text_edit(sp_get_option('sfeditormsg'));
    $sneakpeek = sp_get_sfmeta('sneakpeek', 'message');
    $adminview = sp_get_sfmeta('adminview', 'message');
    $userview = sp_get_sfmeta('userview', 'message');
    $sfcomps['sfsneakpeek'] = '';
    $sfcomps['sfadminview'] = '';
    $sfcomps['sfuserview'] = '';
    if (!empty($sneakpeek[0])) {
        $sfcomps['sfsneakpeek'] = sp_filter_text_edit($sneakpeek[0]['meta_value']);
    }
    if (!empty($adminview[0])) {
        $sfcomps['sfadminview'] = sp_filter_text_edit($adminview[0]['meta_value']);
    }
    if (!empty($userview[0])) {
        $sfcomps['sfuserview'] = sp_filter_text_edit($userview[0]['meta_value']);
    }
    $sfcomps['sfsneakredirect'] = sp_filter_url_display($sflogin['sfsneakredirect']);
    return $sfcomps;
}
function spUser_filter_item($item, $filter)
{
    if (is_array($item)) {
        return $item;
    }
    switch ($filter) {
        case 'title':
            $item = sp_filter_title_display($item);
            break;
        case 'email':
            $item = sp_filter_email_display($item);
            break;
        case 'url':
            $item = sp_filter_url_display($item);
            break;
        case 'text':
            $item = sp_filter_text_display($item);
            break;
        case 'name':
            $item = sp_filter_name_display($item);
            break;
        case 'signature':
            $item = sp_filter_signature_display($item);
            break;
    }
    return $item;
}
function spa_profiles_options_form()
{
    ?>
<script type="text/javascript">
	spjAjaxForm('sfoptionsform', '');
</script>
<?php 
    $sfoptions = spa_get_options_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=profiles-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=options';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfoptionsform" name="sfoptions">
	<?php 
    echo sp_create_nonce('forum-adminform_options');
    spa_paint_options_init();
    #== PROFILE OPTIONS Tab ============================================================
    spa_paint_open_tab(spa_text('Profiles') . ' - ' . spa_text('Profile Options'));
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Display Name Format'), true, 'display-name-format');
    spa_paint_checkbox(spa_text('Let member choose display name'), 'nameformat', $sfoptions['nameformat']);
    spa_paint_select_start(spa_text('Display name format if member cannot choose') . '<br />' . spa_text('(ignored if member allowed to choose)'), 'fixeddisplayformat', 'fixeddisplayformat');
    echo spa_display_name_format_options($sfoptions['fixeddisplayformat']);
    spa_paint_select_end();
    echo '<tr><td colspan="2"><br /><div class="sfoptionerror">';
    spa_etext('Warning: If you change the display name format, it may take some time on a large number of users to update them to the new format. Please be patient.');
    echo '</div><br />';
    echo '</td></tr>';
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Personal Photos'), true, 'personal-photos');
    spa_paint_input(spa_text('Maximum number of photos allowed'), 'photosmax', $sfoptions['photosmax'], false, false);
    spa_paint_input(spa_text('Maximum pixel width of photo display'), 'photoswidth', $sfoptions['photoswidth'], false, false);
    spa_paint_input(spa_text('Maximum pixel height of photo display'), 'photosheight', $sfoptions['photosheight'], false, false);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Signature Image Size'), true, 'sig-images');
    echo '<tr><td colspan="2">&nbsp;<u>' . spa_text('If you are allowing signature images (zero = not limited)') . ':</u></td></tr>';
    spa_paint_input(spa_text('Maximum signature width (pixels)'), 'sfsigwidth', $sfoptions['sfsigwidth']);
    spa_paint_input(spa_text('Maximum signature height (pixels)'), 'sfsigheight', $sfoptions['sfsigheight']);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('First Forum Visit'), true, 'first-forum-visit');
    spa_paint_checkbox(spa_text('Display profile form on login'), 'firstvisit', $sfoptions['firstvisit']);
    $show_password_fields = apply_filters('show_password_fields', true);
    if ($show_password_fields) {
        spa_paint_checkbox(spa_text('Force password change'), 'forcepw', $sfoptions['forcepw']);
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_profiles_options_left_panel');
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Display Profile Mode'), true, 'display-profile-mode');
    $values = array(spa_text('Popup window'), spa_text('Forum profile page'), spa_text('BuddyPress profile'), spa_text('WordPress author page'), spa_text('Other page'), spa_text('Mingle profile'));
    spa_paint_radiogroup(spa_text('Display profile information in'), 'displaymode', $values, $sfoptions['displaymode'], false, true);
    spa_paint_input(spa_text('URL for Other page'), 'displaypage', sp_filter_url_display($sfoptions['displaypage']), false, true);
    spa_paint_input(spa_text('Query String Variable Name'), 'displayquery', sp_filter_title_display($sfoptions['displayquery']), false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Profile Entry Form Mode'), true, 'profile-entry-form-mode');
    $values = array(spa_text('Forum profile form'), spa_text('WordPress profile form'), spa_text('BuddyPress profile'), spa_text('Other form'), spa_text('Mingle profile'));
    spa_paint_radiogroup(spa_text('Enter profile information In'), 'formmode', $values, $sfoptions['formmode'], false, true);
    spa_paint_input(spa_text('URL for Other page'), 'formpage', sp_filter_url_display($sfoptions['formpage']), false, true);
    spa_paint_input(spa_text('Query string variable name'), 'formquery', sp_filter_title_display($sfoptions['formquery']), false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Profile Overview Message'), true, 'profile-message');
    $submessage = spa_text('Text you enter here will be displayed to the User on their profile overview page');
    spa_paint_wide_textarea(spa_text('Profile overview message'), 'sfprofiletext', sp_filter_text_edit($sfoptions['sfprofiletext']), $submessage);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_profiles_options_right_panel');
    spa_paint_close_container();
    ?>
    	<div class="sfform-submit-bar">
    	   <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php 
    spa_etext('Update Profile Options');
    ?>
" />
    	</div>
	</form>
<?php 
    spa_paint_close_tab();
}
function spa_forums_edit_forum_form($forum_id)
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	jQuery('#forumrow-<?php 
    echo $forum_id;
    ?>
').addClass('inForm');
    	spjAjaxForm('sfforumedit<?php 
    echo $forum_id;
    ?>
', 'sfreloadfb');
    });
</script>
<?php 
    global $spPaths, $tab;
    $forum = spdb_table(SFFORUMS, "forum_id={$forum_id}", 'row');
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=editforum';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfforumedit<?php 
    echo $forum->forum_id;
    ?>
" name="sfforumedit<?php 
    echo $forum->forum_id;
    ?>
">
<?php 
    echo sp_create_nonce('forum-adminform_forumedit');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Manage Groups and Forums'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Forum Details'), false);
    $subforum = $forum->parent ? true : false;
    echo "<input type='hidden' name='cgroup_id' value='{$forum->group_id}' />";
    echo "<input type='hidden' name='cparent' value='{$forum->parent}' />";
    echo "<input type='hidden' name='cchildren' value='{$forum->children}' />";
    if (!$subforum && empty($forum->children)) {
        $mess = sp_text('This is a top-level forum with no sub-forums and on this panel you can change the forum Group it is a member of. If changed it will be moved to the target Forum Group.');
    } elseif (!$subforum && !empty($forum->children)) {
        $mess = sp_text('This is a top level forum with designated sub-forums and on this panel you can change the forum Group it is a member of. If changed it will be moved, along with the sub-forums, to the target Forum Group.');
    } elseif ($subforum && empty($forum->children)) {
        $mess = sp_text('This is a sub-forum and on this panel you can change the forum parent it belongs to. If changed it will be moved to become a sub-forum of the target Forum.');
    } else {
        $mess = sp_text('This is a sub-forum and also a parent to other sub-forums and on this panel you can change the forum parent it belongs to. If changed it will be moved, along with the sub-forums, to the target Forum.');
    }
    echo '<div class="sfoptionerror spaceabove">';
    echo "<p><b>{$mess}</b></br>";
    echo sp_text('For more flexible Group/Forum ordering and sub-forum promotion and demotion, please use the drag and drop interface on the Order Groups and Forums admin panel from the Forums Menu - or the Order Forums panel at Group level.') . '</p>';
    echo '</div>';
    # Top level forum...
    $style = $subforum ? ' style="display:none"' : ' style="display:block"';
    echo "<div {$style}>";
    spa_paint_select_start(spa_text('The group this forum belongs to'), 'group_id', '');
    echo spa_create_group_select($forum->group_id);
    spa_paint_select_end();
    echo '</div>';
    # sub-forum...
    $style = $subforum ? ' style="display:block"' : ' style="display:none"';
    echo "<div {$style}>";
    spa_paint_select_start(spa_text('Parent forum this subforum belongs to'), 'parent', '');
    echo spa_create_forum_select($forum->parent);
    spa_paint_select_end();
    echo '</div>';
    spa_paint_input(spa_text('Forum name'), 'forum_name', sp_filter_title_display($forum->forum_name), false, true);
    echo '<input type="hidden" name="forum_id" value="' . $forum->forum_id . '" />';
    $target = 'cforum_slug';
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&amp;sfnonce=' . wp_create_nonce('forum-ahah');
    echo "<div class='sp-form-row'>\n";
    echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Forum slug') . ':</div>';
    echo '<input type="text" class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="cforum_slug" id="cforum_slug" value="' . esc_attr($forum->forum_slug) . '" onchange="spjSetForumSlug(this, \'' . $ahahURL . '\', \'' . $target . '\', \'edit\');" />';
    echo '<div class="clearboth"></div>';
    echo '</div>';
    $tab++;
    spa_paint_input(spa_text('Description'), 'forum_desc', sp_filter_text_edit($forum->forum_desc), false, true);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Forum Options'), false);
    $target = 'cforum_slug';
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&amp;sfnonce=' . wp_create_nonce('forum-ahah');
    spa_paint_checkbox(spa_text('Locked'), 'forum_status', $forum->forum_status);
    spa_paint_checkbox(spa_text('Disable forum RSS feed so feed will not be generated'), 'forum_private', $forum->forum_rss_private);
    spa_paint_select_start(sprintf(spa_text('Featured Image for this forum %s(200px x 200px recommended)'), '<br>'), 'feature_image', '');
    spa_select_icon_dropdown('feature_image', spa_text('Select Feature Image'), SF_STORE_DIR . '/' . $spPaths['forum-images'] . '/', $forum->feature_image, false);
    spa_paint_select_end();
    echo '<div class="sfoptionerror spaceabove">';
    echo '<p><b>' . sp_text('Custom Icon Ordering') . '</b></br>';
    echo sp_text('When using custom forum or topic icons and multiple conditions exist, the following precedence is used:') . '</p>';
    echo sp_text('Locked') . '<br />';
    echo sp_text('Pinned') . '<br />';
    echo sp_text('Unread') . '<br />';
    echo sp_text('Custom') . '<br />';
    echo sp_text('Theme Default') . '<br />';
    echo '</div>';
    spa_paint_select_start(spa_text('Custom forum icon'), 'forum_icon', '');
    spa_select_icon_dropdown('forum_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->forum_icon, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom forum icon when new posts'), 'forum_icon_new', '');
    spa_select_icon_dropdown('forum_icon_new', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->forum_icon_new, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom forum icon when locked'), 'forum_icon_locked', '');
    spa_select_icon_dropdown('forum_icon_locked', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->forum_icon_locked, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon'), 'topic_icon', '');
    spa_select_icon_dropdown('topic_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon when new posts'), 'topic_icon_new', '');
    spa_select_icon_dropdown('topic_icon_new', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon_new, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon when locked'), 'topic_icon_locked', '');
    spa_select_icon_dropdown('topic_icon_locked', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon_locked, false);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Custom topic icon when pinned'), 'topic_icon_pinned', '');
    spa_select_icon_dropdown('topic_icon_pinned', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon_pinned, false);
    spa_paint_select_end();
    spa_paint_input(spa_text('Replacement external RSS URL') . '<br />' . spa_text('Default') . ': <strong>' . sp_build_url($forum->forum_slug, '', 0, 0, 0, 1) . '</strong>', 'forum_rss', sp_filter_url_display($forum->forum_rss), false, true);
    spa_paint_input(spa_text('Custom meta keywords (SEO option must be enabled)'), 'forum_keywords', '', false, true);
    spa_paint_wide_textarea('Special forum message to be displayed above forums', 'forum_message', sp_filter_text_edit($forum->forum_message));
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Extended Forum Options'), false);
    # As added by plugins
    do_action('sph_forum_edit_forum_options', $forum);
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
    		<input type="submit" class="button-primary" id="sfforumedit<?php 
    echo $forum->forum_id;
    ?>
" name="sfforumedit<?php 
    echo $forum->forum_id;
    ?>
" value="<?php 
    spa_etext('Update Forum');
    ?>
" />
    		<input type="button" class="button-primary" onclick="javascript:jQuery('#forum-<?php 
    echo $forum->forum_id;
    ?>
').html('');jQuery('#forumrow-<?php 
    echo $forum_id;
    ?>
').removeClass('inForm');" id="sfforumedit<?php 
    echo $forum->forum_id;
    ?>
" name="editforumcancel<?php 
    echo $forum->forum_id;
    ?>
" value="<?php 
    spa_etext('Cancel');
    ?>
" />
		</div>
	<?php 
    spa_paint_close_tab();
    ?>
	</form>
	<div class="sfform-panel-spacer"></div>
<?php 
}
function sp_PostIndexUserGooglePlus($args = '', $toolTip = '')
{
    global $spThisPost, $spThisPostUser;
    if ($spThisPostUser->guest) {
        return;
    }
    if (empty($spThisPostUser->googleplus)) {
        return;
    }
    $defs = array('tagId' => 'spPostIndexUserGooglePlus%ID%', 'tagClass' => 'spPostUserGooglePlus', 'icon' => 'sp_GooglePlus.png', 'iconClass' => 'spImg', 'targetNew' => 1, 'noFollow' => 0, 'echo' => 1, 'get' => 0);
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_PostIndexUserGooglePlus_args', $a);
    extract($a, EXTR_SKIP);
    # sanitize before use
    $tagId = esc_attr($tagId);
    $tagClass = esc_attr($tagClass);
    $icon = sanitize_file_name($icon);
    $iconClass = esc_attr($iconClass);
    $toolTip = esc_attr($toolTip);
    $targetNew = (int) $targetNew;
    $noFollow = (int) $noFollow;
    $echo = (int) $echo;
    $get = (int) $get;
    $tagId = str_ireplace('%ID%', $spThisPost->post_id, $tagId);
    if (filter_var($spThisPostUser->googleplus, FILTER_VALIDATE_URL)) {
        $url = sp_filter_url_display($spThisPostUser->googleplus);
    } else {
        $url = 'https://plus.google.com/u/' . $spThisPostUser->googleplus . '/' . $spThisPostUser->googleplus;
    }
    if ($get) {
        return $url;
    }
    $target = $targetNew ? ' target="_blank"' : '';
    $follow = $noFollow ? ' rel="nofollow"' : '';
    if (!empty($icon)) {
        $out = "<a id='{$tagId}' class='{$tagClass}' href='{$url}' title='{$toolTip}'{$target}{$follow}>";
        $out .= sp_paint_icon($iconClass, SPTHEMEICONSURL, $icon);
        $out .= "</a>\n";
    }
    $out = apply_filters('sph_PostIndexUserGooglePlus', $out, $a);
    if ($echo) {
        echo $out;
    } else {
        return $out;
    }
}
function spa_forums_edit_group_form($group_id)
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	jQuery('#grouprow-<?php 
    echo $group_id;
    ?>
').addClass('inForm');
    	spjAjaxForm('sfgroupedit<?php 
    echo $group_id;
    ?>
', 'sfreloadfb');
    });
</script>
<?php 
    global $spPaths;
    $group = $group = spdb_table(SFGROUPS, "group_id={$group_id}", 'row');
    spa_paint_options_init();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=editgroup';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfgroupedit<?php 
    echo $group->group_id;
    ?>
" name="sfgroupedit<?php 
    echo $group->group_id;
    ?>
">
<?php 
    echo sp_create_nonce('forum-adminform_groupedit');
    spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Manage Groups and Forums'), false);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Edit Group'), 'true', 'edit-forum-group');
    ?>
					<input type="hidden" name="group_id" value="<?php 
    echo $group->group_id;
    ?>
" />
					<input type="hidden" name="cgroup_name" value="<?php 
    echo sp_filter_title_display($group->group_name);
    ?>
" />
					<input type="hidden" name="cgroup_desc" value="<?php 
    echo sp_filter_text_edit($group->group_desc);
    ?>
" />
					<input type="hidden" name="cgroup_seq" value="<?php 
    echo $group->group_seq;
    ?>
" />
					<input type="hidden" name="cgroup_icon" value="<?php 
    echo esc_attr($group->group_icon);
    ?>
" />
					<input type="hidden" name="cgroup_rss" value="<?php 
    echo $group->group_rss;
    ?>
" />
					<input type="hidden" name="cgroup_message" value="<?php 
    echo sp_filter_text_edit($group->group_message);
    ?>
" />
<?php 
    spa_paint_input(spa_text('Group Name'), 'group_name', sp_filter_title_display($group->group_name), false, true);
    spa_paint_input(spa_text('Description'), 'group_desc', sp_filter_text_edit($group->group_desc), false, true);
    spa_paint_select_start(spa_text('Select Custom Icon'), 'group_icon', '');
    spa_select_icon_dropdown('group_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $group->group_icon, false);
    spa_paint_select_end();
    spa_paint_input(spa_text('Replacement external RSS URL') . '<br />' . spa_text('Default') . ': <strong>' . sp_get_sfqurl(sp_build_url('', '', 0, 0, 0, 1)) . 'group=' . $group->group_id . '</strong>', 'group_rss', sp_filter_url_display($group->group_rss), false, true);
    spa_paint_wide_textarea('Special group message to be displayed above forums', 'group_message', sp_filter_text_edit($group->group_message));
    do_action('sph_forums_edit_group_panel');
    spa_paint_close_fieldset();
    echo '<div class="sfoptionerror spaceabove">';
    echo sprintf(sp_text('To re-order your Groups, Forums and SubForums use the %s Order Groups and Forums %s option from the Forums Menu'), '<b>', '</b>');
    echo '</div>';
    spa_paint_close_panel();
    spa_paint_tab_right_cell();
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('Default User Group Permissions'), false);
    echo '<strong>' . spa_text('Set default usergroup permission sets for this group') . '</strong><br />';
    echo spa_text('Note - This will not will add or modify any current permissions. It is only a default setting for future forums created in this group.  Existing default usergroup settings will be shown in the drop down menus');
    # Permissions
    $usergroups = spa_get_usergroups_all();
    $roles = sp_get_all_roles();
    foreach ($usergroups as $usergroup) {
        echo '<input type="hidden" name="usergroup_id[]" value="' . $usergroup->usergroup_id . '" />';
        spa_paint_select_start(sp_filter_title_display($usergroup->usergroup_name), 'role[]', '');
        $defrole = spa_get_defpermissions_role($group->group_id, $usergroup->usergroup_id);
        if ($defrole == -1 || $defrole == '') {
            echo '<option value="-1">' . spa_text('Select permission set') . '</option>';
        }
        foreach ($roles as $role) {
            $selected = '';
            if ($defrole == $role->role_id) {
                $selected = 'selected="selected" ';
            }
            echo '<option ' . $selected . 'value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n";
        }
        spa_paint_select_end();
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
    ?>
		<div class="sfform-submit-bar">
		<input type="submit" class="button-primary" id="groupedit<?php 
    echo $group->group_id;
    ?>
" name="groupedit<?php 
    echo $group->group_id;
    ?>
" value="<?php 
    spa_etext('Update Group');
    ?>
" />
		<input type="button" class="button-primary" onclick="javascript:jQuery('#group-<?php 
    echo $group->group_id;
    ?>
').html('');jQuery('#grouprow-<?php 
    echo $group_id;
    ?>
').removeClass('inForm');" id="sfgroupedit<?php 
    echo $group->group_id;
    ?>
" name="groupeditcancel<?php 
    echo $group->group_id;
    ?>
" value="<?php 
    spa_etext('Cancel');
    ?>
" />
		</div>
	</form>

	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
}
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol">';
$tout .= '<p class="spProfileLabel">' . sp_text('Last Name') . ': </p>';
$tout .= '</div>';
$tout .= '<div class="spColumnSection spProfileSpacerCol"></div>';
$tout .= '<div class="spColumnSection spProfileRightCol">';
$tout .= '<input type="text" class="spControl" name="last_name" id="last_name" value="' . sp_filter_name_display($spProfileUser->last_name) . '" />';
$tout .= '</div>';
$out .= apply_filters('sph_ProfileUserLastName', $tout, $userid, $thisSlug);
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol">';
$tout .= '<p class="spProfileLabel">' . sp_text('Website') . ': </p>';
$tout .= '</div>';
$tout .= '<div class="spColumnSection spProfileSpacerCol"></div>';
$tout .= '<div class="spColumnSection spProfileRightCol">';
$tout .= '<input type="text" class="spControl" name="website" id="website" value="' . sp_filter_url_display($spProfileUser->user_url) . '" />';
$tout .= '</div>';
$out .= apply_filters('sph_ProfileUserWebsite', $tout, $userid, $thisSlug);
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol">';
$tout .= '<p class="spProfileLabel">' . sp_text('Location') . ': </p>';
$tout .= '</div>';
$tout .= '<div class="spColumnSection spProfileSpacerCol"></div>';
$tout .= '<div class="spColumnSection spProfileRightCol">';
$tout .= '<input type="text" class="spControl" name="location" id="location" value="' . sp_filter_title_display($spProfileUser->location) . '" />';
$tout .= '</div>';
$out .= apply_filters('sph_ProfileUserLocation', $tout, $userid, $thisSlug);
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol">';
$tout .= '<p class="spProfileLabel">' . sp_text('Short Biography') . ': </p>';
$tout .= '</div>';