[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ('admin.php'); 3 4 if ( !bb_current_user_can('manage_forums') ) 5 bb_die(__("You don't have the authority to mess with the forums.")); 6 7 if ( !isset($_POST['action']) ) { 8 wp_redirect( bb_get_uri('bb-admin/forums.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_ADMIN) ); 9 exit; 10 } 11 12 $sent_from = wp_get_referer(); 13 14 switch ( $_POST['action'] ) : 15 case 'add' : 16 if ( !isset($_POST['forum_name']) || '' === $_POST['forum_name'] ) 17 bb_die(__('Bad forum name. Go back and try again.')); 18 19 bb_check_admin_referer( 'add-forum' ); 20 21 if ( false !== bb_new_forum( $_POST ) ) : 22 bb_safe_redirect( $sent_from ); 23 exit; 24 else : 25 bb_die(__('The forum was not added')); 26 endif; 27 break; 28 case 'update' : 29 bb_check_admin_referer( 'update-forum' ); 30 31 if ( !$forums = bb_get_forums() ) 32 bb_die(__('No forums to update!')); 33 if ( (int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name'] ) 34 bb_update_forum( $_POST ); 35 foreach ( array('action', 'id') as $arg ) 36 $sent_from = remove_query_arg( $arg, $sent_from ); 37 bb_safe_redirect( add_query_arg( 'message', 'updated', $sent_from ) ); 38 exit; 39 break; 40 case 'delete' : 41 bb_check_admin_referer( 'delete-forums' ); 42 43 $forum_id = (int) $_POST['forum_id']; 44 $move_topics_forum = (int) $_POST['move_topics_forum']; 45 46 if ( !bb_current_user_can( 'delete_forum', $forum_id ) ) 47 bb_die(__("You don't have the authority to kill off the forums.")); 48 49 if ( isset($_POST['move_topics']) && $_POST['move_topics'] != 'delete' ) 50 bb_move_forum_topics( $forum_id, $move_topics_forum ); 51 52 if ( !bb_delete_forum( $forum_id ) ) 53 bb_die( __('Error occured while trying to delete forum') ); 54 55 foreach ( array('action', 'id') as $arg ) 56 $sent_from = remove_query_arg( $arg, $sent_from ); 57 bb_safe_redirect( add_query_arg( 'message', 'deleted', $sent_from ) ); 58 exit; 59 break; 60 endswitch; 61 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Dec 7 01:01:35 2017 | Cross-referenced by PHPXref 0.7.1 |