}
     check_admin_referer('scoper-edit-groups');
     if (!empty($_POST['groupName'])) {
         $_POST['groupName'] = str_replace('[', '', $_POST['groupName']);
         $_POST['groupName'] = str_replace(']', '', $_POST['groupName']);
     }
     if (!UserGroups_tp::isValidName($_POST['groupName'])) {
         if ($_POST['groupName'] == "") {
             $errorMessage = __("Please specify a name for the group.", 'scoper');
         } else {
             $errorMessage = sprintf(__("A group with the name <strong>%s</strong> already exists.", 'scoper'), $_POST['groupName']);
         }
     } else {
         if (UserGroups_tp::createGroup($_POST['groupName'], $_POST['groupDesc'])) {
             $success_msg = sprintf(__("Group <strong>%s</strong> created successfuly.", 'scoper'), $_POST['groupName']);
             $group = UserGroups_tp::getGroupByName($_POST['groupName']);
         }
     }
     //$suppress_groups_list = true;
     break;
 case "edit":
     $id = $_REQUEST['id'];
     if (!is_user_administrator_rs() && !current_user_can('recommend_group_membership', $id) && !current_user_can('manage_groups', $id)) {
         wp_die(__awp('Cheatin&#8217; uh?'));
     }
     $group = ScoperAdminLib::get_group($id);
     if ($group->meta_id && !strpos($group->meta_id, '_ed_')) {
         die(__('This meta group is automatically populated. You cannot manually edit it.', 'scoper'));
     }
     $group->prev_name = $group->display_name;
     $suppress_groups_list = true;
Пример #2
0
     }
     check_admin_referer('scoper-edit-groups');
     $groupName = sanitize_text_field($_POST['groupName'], '', 'query');
     $groupName = str_replace('[', '', $groupName);
     $groupName = str_replace(']', '', $groupName);
     if (!UserGroups_tp::isValidName($groupName)) {
         if ($groupName == "") {
             $errorMessage = __("Please specify a name for the group.", 'scoper');
         } else {
             $errorMessage = sprintf(__("A group with the name <strong>%s</strong> already exists.", 'scoper'), $groupName);
         }
     } else {
         $groupDesc = sanitize_text_field($_POST['groupDesc'], '', 'query');
         if (UserGroups_tp::createGroup($groupName, $groupDesc)) {
             $success_msg = sprintf(__("Group <strong>%s</strong> created successfuly.", 'scoper'), $groupName);
             $group = UserGroups_tp::getGroupByName($groupName);
         }
     }
     //$suppress_groups_list = true;
     break;
 case "edit":
     $id = (int) $_REQUEST['id'];
     if (!is_user_administrator_rs() && !current_user_can('recommend_group_membership', $id) && !current_user_can('manage_groups', $id)) {
         wp_die(__awp('Cheatin&#8217; uh?'));
     }
     $group = ScoperAdminLib::get_group($id);
     if ($group->meta_id && !strpos($group->meta_id, '_ed_')) {
         die(__('This meta group is automatically populated. You cannot manually edit it.', 'scoper'));
     }
     $group->prev_name = $group->display_name;
     $suppress_groups_list = true;