".__("Mingle Forum has one simple mission; to 'KEEP IT SIMPLE!' It was taken over from WP Forum and has been improved upon GREATLY. It now fully supports integration with or without the Mingle plugin (by Blair Williams). Also I want to give a big thanks to Eric Hamby for his previous work on the forum script.", "mingleforum")."
";
}
function move_up_down(){
global $wpdb, $table_prefix;
$msg = "";
if(isset($_GET['do'], $_GET['id']) && is_numeric($_GET['id'])){
switch($_GET['do']){
/*------------------------------------------------------------------------------------------------------------------------*/
case "group_down":
$ginfo = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE id = '".($_GET['id']*1)."'", ARRAY_A);
$above = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE sort < '".$ginfo['sort']."' ORDER BY sort DESC", ARRAY_A);
if ($above['id']>0){
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$above['sort']."' WHERE id = '".($_GET['id']*1)."'");
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$ginfo['sort']."' WHERE id = '".$above['id']."'");
}
$msg = __("Group Moved Down", "mingleforum");
break;
/*------------------------------------------------------------------------------------------------------------------------*/
case "forum_down":
$ginfo = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE id = '".($_GET['id']*1)."'", ARRAY_A);
$above = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE parent_id = '".$ginfo['parent_id']."' && sort < '".$ginfo['sort']."' ORDER BY sort DESC", ARRAY_A);
if ($above['id']>0){
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$above['sort']."' WHERE id = '".($_GET['id']*1)."'");
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$ginfo['sort']."' WHERE id = '".$above['id']."'");
}
$msg = __("Forum Moved Down", "mingleforum");
break;
/*------------------------------------------------------------------------------------------------------------------------*/
case "group_up":
$ginfo = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE id = '".($_GET['id']*1)."'", ARRAY_A);
$above = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE sort > '".$ginfo['sort']."' ORDER BY sort ASC", ARRAY_A);
if ($above['id']>0){
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$above['sort']."' WHERE id = '".($_GET['id']*1)."'");
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$ginfo['sort']."' WHERE id = '".$above['id']."'");
}
$msg = __("Group Moved Up", "mingleforum");
break;
/*------------------------------------------------------------------------------------------------------------------------*/
case "forum_up":
$ginfo = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE id = '".($_GET['id']*1)."'", ARRAY_A);
$above = $wpdb->get_row("SELECT * FROM {$table_prefix}forum_forums WHERE parent_id = '".$ginfo['parent_id']."' && sort > '".$ginfo['sort']."' ORDER BY sort ASC", ARRAY_A);
if ($above['id']>0){
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$above['sort']."' WHERE id = '".($_GET['id']*1)."'");
$wpdb->query("UPDATE {$table_prefix}forum_forums SET sort = '".$ginfo['sort']."' WHERE id = '".$above['id']."'");
}
$msg = __("Forum Moved Up", "mingleforum");
break;
/*------------------------------------------------------------------------------------------------------------------------*/
}
return $msg;
}
return false;
}
function update_usergroups($new_groups, $group_id){
global $wpdb, $table_prefix;
$new_groups = maybe_serialize($new_groups);
$wpdb->query("UPDATE ".$table_prefix."forum_forums SET usergroups = '$new_groups' WHERE id = $group_id");
}
function update_usercanpost($new_groups, $group_id){
global $wpdb, $table_prefix;
$new_groups = maybe_serialize($new_groups);
$wpdb->query("UPDATE ".$table_prefix."forum_forums SET usercanpost = '$new_groups' WHERE id = $group_id");
}
function get_usersgroups_with_access_to_group($groupid){
global $wpdb, $table_prefix;
$string = $wpdb->get_var("select usergroups from ".$table_prefix."forum_forums where id = $groupid");
return maybe_unserialize( $string );
}
function get_usersgroups_with_access_to_post($groupid){
global $wpdb, $table_prefix;
$string = $wpdb->get_var("select usercanpost from ".$table_prefix."forum_forums where id = $groupid");
return maybe_unserialize( $string );
}
function edit_moderator(){
if(isset($_POST['update_mod'])){
$forums = (isset($_POST['mod_forum_id']))?$_POST['mod_forum_id']:array();
$forums = maybe_unserialize($forums);
$global = (isset($_POST['mod_global']))?true:false;
$user_id = $_POST['update_mod_user_id'];
if($global){
update_user_meta($user_id, "wpf_moderator", "mod_global");
}
else
update_user_meta($user_id, "wpf_moderator", $forums);
if(empty($forums))
return __('Moderator successfully removed.', 'mingleforum');
else
return __('Moderator successfully saved.', 'mingleforum');
}
if(isset($_POST['delete_mod'])){
$user_id = $_POST['update_mod_user_id'];
if(delete_user_meta($user_id, "wpf_moderator"))
return __('Moderator successfully removed.', 'mingleforum');
else
return __('Moderator NOT removed.', 'mingleforum');
}
return false;
}
function add_moderator(){
if(isset($_POST['add_mod_submit'])){
$user_id = $_POST['addmod_user_id'];
$forums = (isset($_POST['mod_forum_id']))?$_POST['mod_forum_id']:array();
$forums = maybe_unserialize($forums);
$global = (isset($_POST['mod_global']))?true:false;
if($user_id == "add_mod_null")
return __("You must select a user", "mingleforum");
if($global){
update_user_meta($user_id, "wpf_moderator", "mod_global");
return __("Global Moderator added successfully", "mingleforum");
}
else
update_user_meta($user_id, "wpf_moderator", $forums);
return __("Moderator added successfully", "mingleforum");
}
return false;
}
function moderators(){
global $mingleforum;
$groups = $mingleforum->get_forums();
if($msg = $this->edit_moderator())
echo "