0) { $pages_selected = array_keys($_POST); unset($_POST); } else { $errors[] = "You did not select any pages to add to this group; cannot continue."; } if (sizeof($errors) == 0) { $column = $wpdb->query("select ID from ".$table_prefix."page_access_groups where group_name='".$group_name."'"); if(!empty($column)) { $errors[] = "That name is already in use, please choose another."; } } ?>
0) { ?>

Error!

    $error"); } echo "
"; // no errors, so save the min the DB } else { $wpdb->query("insert into ".$table_prefix."page_access_groups (group_name, group_description) values('$group_name', '$group_desc')"); // better way of doing this? $new_id = $wpdb->get_results("select ID from ".$table_prefix."page_access_groups where group_name='$group_name' and group_description='$group_desc'"); foreach ($pages_selected as $a_page) { $wpdb->query("insert into ".$table_prefix."page_access_group_line_item (group_id, page) values('".$new_id[0]->ID."','".substr($a_page, 1)."')"); } echo "

Group Added!

"; } echo "
"; } else if (isset($_POST['manage_group_submit'])) { unset($_POST['manage_group_submit']); if (!empty($_POST)) { ?>

See Below!

To continue managing your group, please scroll to the Manage Groups section.

Error!

You must select one group in order to manage it.

query("delete from ".$table_prefix."page_access_group_line_item where group_id=".$group_id); foreach ($_POST as $k => $v) { $wpdb->query("insert into ".$table_prefix."page_access_group_line_item (page, group_id) values(".substr($k, 1).", $group_id)"); } ?>

Group Updated

query("delete from ".$table_prefix."page_access_groups where ID=".$_POST['manage_group']); $wpdb->query("delete from ".$table_prefix."page_access_group_line_item where group_id=".$_POST['manage_group']); ?>

Group Deleted.

See Below!

To continue managing that user, please scroll to the Manage Users section.

Error!

You must select one user in order to manage it.

query("delete from ".$table_prefix."page_access_user_line_item where user_id=".$user_id); // add back in only what is set foreach ($_POST as $k => $v) { $wpdb->query("insert into ".$table_prefix."page_access_user_line_item (group_id, user_id) values(".substr($k, 1).", $user_id)"); } ?>

User Groups Updated

Error!

No groups were selected. Please try again.

Page Saved

Page Access Options

Manage Users get_results("select user_firstname, user_lastname, user_nickname from ".$table_prefix."users where ID=".$_POST['manage_user']); echo "

Managing the user ".$user_info[0]->user_nickname.".

\n

Real name: ".$user_info[0]->user_firstname." ". $user_info[0]->user_lastname.".

\n"; ?> get_results("select ID,group_name, group_description from ".$table_prefix."page_access_groups"); if (!empty($groups)) { global $class; $set_groups = array(); // get the groups that are already assigned to this user $set_groups_temp = $wpdb->get_results("select group_id from ".$table_prefix."page_access_user_line_item where user_id=".$_POST['manage_user'], ARRAY_A); if ($set_groups_temp) { foreach ($set_groups_temp as $p) { $set_groups[] = $p['group_id']; } unset($set_groups_temp); } // write out the groups, checking the ones that are already saved for this user foreach ($groups as $group) { $class = ('alternate' == $class) ? '' : 'alternate'; echo "\n"; } } else { echo ""; } ?>
Group Name Group Description Add Group To User
".$group->group_name."".$group->group_description."ID."\" value=\"".$group->ID."\""; echo (in_this_array($group->ID, $set_groups, true))? "checked=\"checked\" " : "" ; echo "/>
No groups available yet.
Authors & Users screen // only I add the "manage" column } else { ?> get_results("SELECT ID FROM $wpdb->users ORDER BY ID"); $style = ''; foreach ($users as $user) { $user_data = get_userdata($user->ID); $email = $user_data->user_email; $url = $user_data->user_url; $short_url = str_replace('http://', '', $url); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $user->ID and post_status = 'publish'"); if (0 < $numposts) $numposts = "$numposts"; echo " "; // my change: echo ""; echo ""; } ?>
Manage
$user_data->ID $user_data->user_nickname $user_data->user_firstname $user_data->user_lastname $email $short_url "; if (($user_level >= 2) and ($user_level > $user_data->user_level) and ($user_data->user_level > 0)) echo " ID."&prom=down\">- "; echo $user_data->user_level; if (($user_level >= 2) and ($user_level > ($user_data->user_level + 1))) echo " ID."&prom=up\">+ "; echo "$numpostsID."\" />
Manage Groups get_results("select group_name, group_description from ".$table_prefix."page_access_groups where ID='".$_POST['manage_group']."'"); echo "

Managing the group ".$group_info[0]->group_name.".

\n

Description: ".$group_info[0]->group_description."

\n"; ?>

Pages included in the group:

Add To Group
get_results("select ID,group_name, group_description from ".$table_prefix."page_access_groups"); if (!empty($groups)) { global $class; foreach ($groups as $group) { $class = ('alternate' == $class) ? '' : 'alternate'; echo "\n"; } } else { echo ""; } ?>
Group Name Group Description Manage
".$group->group_name."".$group->group_description."ID."\" />
No groups to manage yet.
Create Group
Group name:
Group description:

Pages included in the group:

Add To Group
No Access Page
Page Name:
get_results("select page from ".$table_prefix."page_access_group_line_item where group_id=$group_id", ARRAY_A); foreach ($set_pages_temp as $p) { $set_pages[] = $p['page']; } unset($set_pages_temp); $initial = 0; } $initial = 1; } // a pretty much generic function that finds an entry in an array and removes it, if it is set that way function in_this_array($needle, $haystack, $remove_from_haystack = false) { // $haystack is actually just the passed in $set_pages array foreach ($haystack as $key => $val) { if ($needle == $val) { if ($remove_from_haystack) { global $set_pages; unset($set_pages[$key]); } return true; } } return false; } // writes out the pages table function page_rows3( $parent = 0, $level = 0, $pages = 0, $group_id = 0) { global $wpdb, $class, $user_level, $post, $table_prefix; $group_id = $group_id; if (!$pages) $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order"); if ($pages) { foreach ($pages as $post) { start_wp(); if ($post->post_parent == $parent) { $post->post_title = wp_specialchars($post->post_title); $pad = str_repeat('— ', $level); $id = $post->ID; $class = ('alternate' == $class) ? '' : 'alternate'; ?> ID; ?> $authordata->user_level) or ($user_login == $authordata->user_login)) { if (isset($_POST['manage_group_submit'])) { global $initial, $set_pages; if ($initial == 1) { get_set_pages($group_id); } ?> ID, $set_pages, true))? "checked=\"checked\" " : "" ; ?>/>