• Resolved zulunko

    (@zulunko)


    My application requires that I be able to programmatically check what categories of posts a user can edit. I have user groups set up that give “Specific Permissions” to users within the groups for certain categories. I see in the developer information that I can use pp_get_groups_for_user to figure out what groups the user is a part of and then I can pass that group ID to pp_get_group to get a data structure that contains some group information, but I can’t see a way to inspect the specific permissions the group gives its members.

    Is there a PHP function I can call to get the Specific Permissions of a permission group?

    • This topic was modified 1 year, 9 months ago by zulunko.
    • This topic was modified 1 year, 9 months ago by zulunko.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @zulunko

    Apologize for the delayed response. Thanks for using PublishPress. We do try to answer more complicated coding questions, but they normally take more time to answer than regular questions. Please be patient until one of our developers has time to answer this question

    Thread Starter zulunko

    (@zulunko)

    It seems that the Specific Permissions are called “Exceptions” in the code, so I was able to find the ppc_get_exceptions() function. Using this, I was able to extract the specific category permission:

       ?$args = array();
    ? ? $args['agent_id'] = $pp_group;
    ? ? $args['agent_type'] = "pp_group";
    ? ? $args['operations'] = 'edit';
    ? ? $args['for_item_source'] = 'post';
    ? ? $args['via_item_source'] = 'term';
    ? ? $args['taxonomies'] = 'category';
    ? ? $exc_arr = ppc_get_exceptions( $args );
    ? ? return $exc_arr["edit_post"]["term"]["category"]["include"]["post"][""][0];
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php: How to programmatically get permissions of group?’ is closed to new replies.