function spa_usergroups_usergroup_main() { global $spPaths; $usergroups = spa_get_usergroups_all(null); if ($usergroups) { ?> <table class="wp-list-table widefat"> <tr> <th style="text-align:center;width:13%" scope="col"><?php spa_etext('ID'); ?> </th> <th scope="col"><?php spa_etext('Name'); ?> </th> <th style="text-align:center;width:8%" scope="col"><?php spa_etext('Moderator'); ?> </th> </tr> </table> <?php foreach ($usergroups as $usergroup) { # display the current usergroup information in table format ?> <table id="usergrouprow-<?php echo $usergroup->usergroup_id; ?> " class="wp-list-table widefat"> <tr> <td style="width:13%;text-align:center;padding:10px 0;" class='row-title BGhighLight'><?php echo $usergroup->usergroup_id; ?> <br> <?php if ($usergroup->usergroup_badge) { echo "<img src='" . SF_STORE_URL . '/' . $spPaths['ranks'] . '/' . $usergroup->usergroup_badge . "' alt='' style='max-width:80%;' />"; } ?> </td> <td><span class='row-title'><strong><?php echo sp_filter_title_display($usergroup->usergroup_name); ?> </strong></span><span><br /><?php echo sp_filter_title_display($usergroup->usergroup_desc); ?> </span> <?php sp_display_item_stats(SFMEMBERSHIPS, 'usergroup_id', $usergroup->usergroup_id, spa_text('Members')); ?> </td> <td style="width:8%;text-align:center;padding:10px 0;" class='row-title'><?php if ($usergroup->usergroup_is_moderator == 1) { echo spa_etext("Yes"); } else { echo spa_etext("No"); } ?> </td> </tr> <tr> <td class='smallLabel'><?php spa_etext('Manage Group'); ?> </td> <td colspan="2" style="padding:0 0 0 3px;text-align:left;"> <?php $base = SFHOMEURL . 'index.php?sp_ahah=usergroups-loader&sfnonce=' . wp_create_nonce('forum-ahah'); $target = "usergroup-{$usergroup->usergroup_id}"; $image = SFADMINIMAGES; ?> <input type="button" class="button-secondary" value="<?php echo spa_text('Edit User Group'); ?> " onclick="spjLoadForm('editusergroup', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $usergroup->usergroup_id; ?> ');" /> <input type="button" class="button-secondary" value="<?php echo spa_text('Delete User Group'); ?> " onclick="spjLoadForm('delusergroup', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $usergroup->usergroup_id; ?> ');" /> <?php sp_paint_usergroup_tip($usergroup->usergroup_id, sp_filter_title_display($usergroup->usergroup_name)); ?> </td> </tr> <tr class="sfinline-form"> <!-- This row will hold ahah forms for the current user group --> <td colspan="3" style="padding:0 10px 0 0;"> <div id="usergroup-<?php echo $usergroup->usergroup_id; ?> "> </div> </td> </tr> <tr class="sfsubtable sfugrouptable"> <td class='smallLabel'><?php spa_etext('Manage Users'); ?> </td> <td colspan="2" style="padding:0 0 0 3px;text-align:left;"> <?php $site = SFHOMEURL . 'index.php?sp_ahah=usergroups&sfnonce=' . wp_create_nonce('forum-ahah') . "&ug={$usergroup->usergroup_id}"; $gif = SFCOMMONIMAGES . 'working.gif'; $text = esc_js(spa_text('Show/Hide')); ?> <input type="button" id="show<?php echo $usergroup->usergroup_id; ?> " class="button-secondary" value="<?php echo $text; ?> " onclick="spjShowMemberList('<?php echo $site; ?> ', '<?php echo $gif; ?> ', '<?php echo $usergroup->usergroup_id; ?> ');" /> <?php $base = SFHOMEURL . 'index.php?sp_ahah=usergroups-loader&sfnonce=' . wp_create_nonce('forum-ahah'); $target = "members-{$usergroup->usergroup_id}"; $image = SFADMINIMAGES; ?> <input type="button" id="add<?php echo $usergroup->usergroup_id; ?> " class="button-secondary" value="<?php spa_etext('Add New'); ?> " onclick="spjLoadForm('addmembers', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $usergroup->usergroup_id; ?> '); " /> <input type="button" id="remove<?php echo $usergroup->usergroup_id; ?> " class="button-secondary" value="<?php spa_etext('Move/Delete'); ?> " onclick="spjLoadForm('delmembers', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $usergroup->usergroup_id; ?> '); " /> </td> </tr> <tr class="sfinline-form"> <!-- This row will hold hidden forms for the current user group membership--> <td colspan="3" style="padding: 0 10px 0 0;"> <div id="members-<?php echo $usergroup->usergroup_id; ?> "></div> </td> </tr> </table> <?php } } else { echo '<div class="sfempty"> ' . spa_text('There are no User Groups defined') . '</div>'; } ?> <div class="sfform-panel-spacer"></div> <table class="sfmaintable" style="padding:0;border-spacing:0;border-collapse:separate;"> <tr> <th style="text-align:left;padding:10px 20px;" scope="col"><?php spa_etext('Members Not Belonging To Any Usergroup'); ?> </th> </tr> <tr class="sfsubtable sfugrouptable"> <td style="padding:10px 20px;"> <?php $site = SFHOMEURL . 'index.php?sp_ahah=usergroups&sfnonce=' . wp_create_nonce('forum-ahah') . '&ug=0'; $gif = SFCOMMONIMAGES . 'working.gif'; $text = esc_js(spa_text('Show/Hide Members with No Memberships')); ?> <input type="button" id="show-0" class="button-secondary" value="<?php echo $text; ?> " onclick="spjShowMemberList('<?php echo $site; ?> ', '<?php echo $gif; ?> ', '0');" /> </td> </tr> <tr class="sfinline-form"> <!-- This row will hold hidden forms for the current user group membership--> <td> <div id="members-0"></div> </td> </tr> </table> <?php }
function spa_display_usergroup_select($filter = false, $forum_id = 0, $showSelect = true) { $usergroups = spa_get_usergroups_all(); if ($showSelect) { echo spa_text('Select usergroup') . ': '; } if ($showSelect) { ?> <select style="width:145px" class='sfacontrol' name='usergroup_id'> <?php } $out = '<option value="-1">' . spa_text('Select usergroup') . '</option>'; if ($filter) { $perms = sp_get_forum_permissions($forum_id); } foreach ($usergroups as $usergroup) { $disabled = ''; if ($filter == 1 && $perms) { foreach ($perms as $perm) { if ($perm->usergroup_id == $usergroup->usergroup_id) { $disabled = 'disabled="disabled" '; continue; } } } $out .= '<option ' . $disabled . 'value="' . $usergroup->usergroup_id . '">' . sp_filter_title_display($usergroup->usergroup_name) . '</option>' . "\n"; $default = ''; } echo $out; if ($showSelect) { ?> </select></p> <?php } }
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&sfnonce=' . wp_create_nonce('forum-ahah') . '&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 }
function spa_paint_rankings_table($rankings) { global $tab, $spPaths; $usergroups = spa_get_usergroups_all(); # sort rankings from lowest to highest if ($rankings) { foreach ($rankings as $x => $info) { $ranks['id'][$x] = $info['meta_id']; $ranks['title'][$x] = $info['meta_key']; $ranks['posts'][$x] = $info['meta_value']['posts']; $ranks['usergroup'][$x] = $info['meta_value']['usergroup']; $ranks['badge'][$x] = !empty($info['meta_value']['badge']) ? $info['meta_value']['badge'] : ''; } array_multisort($ranks['posts'], SORT_ASC, $ranks['title'], $ranks['usergroup'], $ranks['badge'], $ranks['id']); } ?> <table class="widefat fixed spMobileTable1280"> <thead> <tr> <th style='text-align:center'><?php spa_etext('Forum Rank Name'); ?> </th> <th style='text-align:center'><?php spa_etext('# Posts For Rank'); ?> </th> <th style='text-align:center'><?php spa_etext('Automatic User Group Membership'); ?> </th> <th style='text-align:center'><?php spa_etext('Badge'); ?> </th> <th style='text-align:center'><?php spa_etext('Remove'); ?> </th> </tr> </thead> <tbody> <?php # display rankings info $class = 'class ="spMobileTableData"'; for ($x = 0; $x < count($rankings); $x++) { ?> <tr id="rank<?php echo $x; ?> " <?php echo $class; ?> > <td data-label='<?php spa_etext('Forum Rank Name'); ?> '> <input type='text' size="12" class='wp-core-ui' tabindex='<?php echo $tab; ?> ' name='rankdesc[]' value='<?php echo esc_attr($ranks['title'][$x]); ?> ' /> <input type='hidden' name='rankid[]' value='<?php echo esc_attr($ranks['id'][$x]); ?> ' /> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('# Posts For Rank'); ?> '> <input type='text' class='wp-core-ui' size='5' tabindex='<?php echo $tab; ?> ' name='rankpost[]' value='<?php echo $ranks['posts'][$x]; ?> ' /> <?php echo ' ' . spa_text('Posts'); ?> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('Auto User Group'); ?> '> <select class="wp-core-ui" name="rankug[]" style="width:135px;"> <?php if ($ranks['usergroup'][$x] == 'none') { $out = '<option value="none" selected="selected">' . spa_text('None') . '</option>'; } else { $out = '<option value="none">' . spa_text('None') . '</option>'; } foreach ($usergroups as $usergroup) { if ($ranks['usergroup'][$x] == $usergroup->usergroup_id) { $selected = ' SELECTED'; } else { $selected = ''; } $out .= '<option value="' . $usergroup->usergroup_id . '"' . $selected . '>' . sp_filter_title_display($usergroup->usergroup_name) . '</option>'; } echo $out; ?> </select> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('Badge'); ?> '> <?php spa_select_icon_dropdown('rankbadge[]', spa_text('Select Badge'), SF_STORE_DIR . '/' . $spPaths['ranks'] . '/', $ranks['badge'][$x], true, 135); ?> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('Remove'); ?> '> <?php $site = SFHOMEURL . 'index.php?sp_ahah=components&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=del_rank&key=' . $ranks['id'][$x]; ?> <img onclick="spjDelRow('<?php echo $site; ?> ', 'rank<?php echo $x; ?> ');" src="<?php echo SFCOMMONIMAGES; ?> delete.png" title="<?php spa_etext('Delete Rank'); ?> " alt="" /> </td> <?php $tab++; ?> </tr> <?php $class = strpos($class, 'alternate') === false ? 'class="spMobileTableData alternate"' : 'class="spMobileTableData"'; } ?> <!--empty row fir new rank--> <tr class="spMobileTableData"> <td data-label='<?php spa_etext('Forum Rank Name'); ?> '> <input type='text' size="12" class='wp-core-ui' tabindex='<?php echo $tab; ?> ' name='rankdesc[]' value='' /> <input type='hidden' name='rankid[]' value='-1' /> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('# Posts For Rank'); ?> '> <input type='text' class='wp-core-ui' size='5' tabindex='<?php echo $tab; ?> ' name='rankpost[]' value='' /> <?php echo ' ' . spa_text('Posts'); ?> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('Auto User Group'); ?> '> <select class="wp-core-ui" name="rankug[]" style="width:135px;"> <?php $out = '<option value="none">' . spa_text('None') . '</option>'; foreach ($usergroups as $usergroup) { $out .= '<option value="' . $usergroup->usergroup_id . '">' . sp_filter_title_display($usergroup->usergroup_name) . '</option>'; } echo $out; ?> </select> </td> <?php $tab++; ?> <td data-label='<?php spa_etext('Badge'); ?> '> <?php spa_select_icon_dropdown('rankbadge[]', spa_text('Select Badge'), SF_STORE_DIR . '/' . $spPaths['ranks'] . '/', '', true, 135); ?> </td> <?php $tab++; ?> <td></td> </tr> </tbody> </table> <?php }
function spa_forums_create_forum_form() { ?> <script type="text/javascript"> jQuery(document).ready(function() { spjAjaxForm('sfforumnew', 'sfreloadfb'); }); </script> <?php global $spPaths, $tab; spa_paint_options_init(); $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=createforum'; ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sfforumnew" name="sfforumnew"> <?php echo sp_create_nonce('forum-adminform_forumnew'); spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Create New Forum'), true); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Create New Forum'), 'true', 'create-new-forum'); # check there are groups before proceeding if (spdb_count(SFGROUPS) == 0) { echo '<br /><div class="sfoptionerror">'; spa_etext('There are no groups defined'); echo '<br />' . spa_text('Create new group'); echo '</div><br />'; spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); spa_paint_close_tab(); echo '</form>'; return; } # Select the forum type first echo "<div class='sp-form-row'>\n"; echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('What type of forum are you creating') . ":</div>\n"; echo "<div class='wp-core-ui sp-radio'>"; echo '<input type="radio" name="forumtype" id="sfradio1" tabindex="' . $tab . '" value="1" checked="checked" onchange="spjSetForumOptions(\'forum\');" />' . "\n"; echo '<label for="sfradio1" class="wp-core-ui">' . spa_text('Standard Forum') . '</label><br>' . "\n"; $tab++; # check there are forums before offering subforum creation! if (spdb_count(SFFORUMS) != 0) { echo '<input type="radio" name="forumtype" id="sfradio2" tabindex="' . $tab . '" value="2" onchange="spjSetForumOptions(\'subforum\');" />' . "\n"; echo '<label for="sfradio2" class="wp-core-ui">' . spa_text('Sub or child forum') . '</label>' . "\n"; $tab++; } echo '</div><div class="clearboth"></div></div>'; # Now display the two select box options $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&sfnonce=' . wp_create_nonce('forum-ahah'); $target = 'fseq'; echo '<div id="groupselect" style="display:block;">'; echo "<div class='sp-form-row'>\n"; echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Select group new forum will belong to') . ":</div>\n"; echo '<select class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="group_id" onchange="spjSetForumSequence();">'; echo spa_create_group_select(0, 1); echo "</select>\n"; echo '<div class="clearboth"></div>'; echo '</div>'; $tab++; echo '</div>'; echo '<div id="forumselect" style="display:none;">'; echo "<div class='sp-form-row'>\n"; echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Select forum new subforum will belong to') . ":</div>\n"; echo '<select class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="forum_id" onchange="spjSetForumSequence();">'; echo sp_render_group_forum_select(false, false, false, true); echo "</select>\n"; echo '<div class="clearboth"></div>'; echo '</div>'; $tab++; echo '</div>'; spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); echo '<div class="sfform-panel-spacer"></div>'; spa_paint_close_tab(); echo '<div class="sfform-panel-spacer"></div>'; echo '<div class="sfhidden" id="block1">'; spa_paint_open_nohead_tab(false); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Forum Details'), false); $target = 'thisforumslug'; $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&sfnonce=' . wp_create_nonce('forum-ahah'); # forum name and slug echo "<div class='sp-form-row'>"; echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Forum Name') . ':</div>'; echo '<input type="text" class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="forum_name" value="" onchange="spjSetForumSlug(this, \'' . $ahahURL . '\', \'' . $target . '\', \'new\');" />'; echo '<div class="clearboth"></div>'; echo '</div>'; $tab++; 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="thisforumslug" id="thisforumslug" value="" disabled="disabled" onchange="spjSetForumSlug(this, \'' . $ahahURL . '\', \'' . $target . '\', \'new\');" />'; echo '<div class="clearboth"></div>'; echo '</div>'; $tab++; spa_paint_input(spa_text('Description'), 'forum_desc', '', false, true); spa_paint_checkbox(spa_text('Locked'), 'forum_status', 0); spa_paint_checkbox(spa_text('Disable forum RSS feed so feed will not be generated'), 'forum_private', 0); 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'] . '/', '', 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'] . '/', '', 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'] . '/', '', 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'] . '/', '', 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'] . '/', '', 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'] . '/', '', 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'] . '/', '', false); spa_paint_select_end(); 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', ''); 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('Extended Forum Options'), false); # As added by plugins do_action('sph_forum_create_forum_options'); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Add User Group Permissions'), false); echo '<div id="block2" class="sfhidden">'; echo '<strong>' . spa_text('You can selectively set the permission sets for the forum below. If you want to use the default permissions for the selected group, then do not select anything') . '</strong>'; # 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[]', ''); echo '<option value="-1">' . spa_text('Select permission set') . '</option>'; foreach ($roles as $role) { echo '<option value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n"; } spa_paint_select_end(); } echo '</div>'; spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); ?> <div class="sfform-submit-bar"> <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php spa_etext('Create New Forum'); ?> " /> </div> <?php spa_paint_close_tab(); ?> </div> </form> <div class="sfform-panel-spacer"></div> <?php }
function spa_create_usergroup_select($sfdefgroup) { $out = ''; $ugid = spdb_table(SFUSERGROUPS, "usergroup_id={$sfdefgroup}", 'usergroup_id'); if (empty($ugid)) { $out .= '<option selected="selected" value="-1">INVALID</option>'; } $usergroups = spa_get_usergroups_all(); $default = ''; foreach ($usergroups as $usergroup) { if ($usergroup->usergroup_id == $sfdefgroup) { $default = 'selected="selected" '; } else { $default = null; } $out .= '<option ' . $default . 'value="' . $usergroup->usergroup_id . '">' . sp_filter_title_display($usergroup->usergroup_name) . '</option>'; $default = ''; } return $out; }
function spa_forums_create_group_form() { ?> <script type="text/javascript"> jQuery(document).ready(function() { spjAjaxForm('sfgroupnew', 'sfreloadfb'); }); </script> <?php global $spPaths; spa_paint_options_init(); $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=creategroup'; ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sfgroupnew" name="sfgroupnew"> <?php echo sp_create_nonce('forum-adminform_groupnew'); spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Create New Group'), false); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Create New Group'), 'true', 'create-new-forum-group'); spa_paint_input(spa_text('Group Name'), 'group_name', '', false, true); spa_paint_input(spa_text('Description'), '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'] . '/', '', false); spa_paint_select_end(); spa_paint_wide_textarea('Special group message to be displayed above forums', 'group_message', ''); do_action('sph_forums_create_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 add or modify any current permissions. It is only a default setting for future forums created in this group.'); # 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[]', ''); echo '<option value="-1">' . spa_text('Select permission set') . '</option>'; foreach ($roles as $role) { echo '<option 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="saveit" name="saveit" value="<?php spa_etext('Create New Group'); ?> " /> </div> </form> <?php spa_paint_close_tab(); ?> <div class="sfform-panel-spacer"></div> <?php }