/** * Retrieve a Permission Group object * @param int group_id * @param string agent_type (pp_group, bp_group, etc.) * @return object Permission Group * - ID * - group_name * - group_description * - metagroup_type * - metagroup_id */ function pp_get_group($group_id, $agent_type = 'pp_group') { return pp_get_agent($group_id, $agent_type); }
*/ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly require_once dirname(__FILE__) . '/permissions-ui_pp.php'; $agent_type = !empty($_REQUEST['agent_type']) ? pp_sanitize_key($_REQUEST['agent_type']) : 'pp_group'; if (empty($_REQUEST['agent_id'])) { $agent_id = 0; $agent = (object) array('metagroup_type' => ''); if ('user' != $agent_type) { wp_die(__('No user/group specified.', 'pp')); } } else { $agent_id = (int) $_REQUEST['agent_id']; $agent = pp_get_agent($agent_id, $agent_type); } $metagroup_type = !empty($agent->metagroup_type) ? $agent->metagroup_type : ''; if ('user' == $agent_type) { if (!current_user_can('pp_administer_content') || !current_user_can('list_users')) { wp_die(__('You are not permitted to do that.', 'pp')); } if ($agent_id && empty($agent->ID)) { wp_die(__('Invalid user ID.', 'pp')); } } else { if (!pp_has_group_cap('pp_edit_groups', $agent_id, $agent_type)) { wp_die(__('You are not permitted to do that.', 'pp')); } if ('wp_role' == $metagroup_type && !current_user_can('pp_administer_content')) { wp_die(__('You are not permitted to do that.', 'pp'));