• Resolved ijogold

    (@ijogold)


    Hello, Help me please How get the id of USERS who are allowed to view and edit the current post ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ijogold

    (@ijogold)

    $argsss = array(
    		'agent_id' => $user_id,
    		'agent_type' => 'user',
    	'operation' => 'read',
    	'mod_type' => 'additional',
    	'for_item_source' => 'post',
    	'via_item_source' => 'term',
    	'item_id' => $post_id,
    	'assign_for' => 'item'
    );
    
    	$testpermposts = array();
    $testpermposts = ppc_get_exceptions( $argsss );
    
    	
    	echo '<pre>';
    	print_r($testpermposts);
    	echo '</pre>';

    I do this but it doesn’t work

    here is the response i get

    Array
    (
        [read_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
        [publish_topics_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
        [publish_replies_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
        [edit_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
        [associate_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
        [assign_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
        [manage_post] =&gt; Array
            (
                [post] =&gt; Array
                    (
                        [] =&gt; Array
                            (
                                [include] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [exclude] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                                [additional] =&gt; Array
                                    (
                                        [post] =&gt; Array
                                            (
                                            )
    
                                        [page] =&gt; Array
                                            (
                                            )
    
                                    )
    
                            )
    
                    )
    
                [term] =&gt; Array
                    (
                    )
    
            )
    
    )
    
    Thread Starter ijogold

    (@ijogold)

    i need get Specific Permissions (for user)

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @ijogold

    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

    Plugin Author Kevin Behrens

    (@kevinb)

    Hello, @ijogold. You’ll need to change some of those arguments.

    $argsss = array(
    	'operations' => 'read',
    	'mod_type' => 'additional',
    	'for_item_source' => 'post',
    	'via_item_source' => 'post',
    	'item_id' => $post_id,
    	'assign_for' => 'item',
    	'return_raw_results' => true,
    	'cols' => 'agent_id, agent_type, operation, mod_type',
    );

    Here are the reasons for the changes:

    • “operation” is not a valid arg; changed to “operations”
    • via_item_source: You are dealing with permissions that were assigned to the post, not to a term / category.
    • agent_type, agent_id: Don’t include these are specified arguments because they are the values you’re querying for.
    • return_raw_results: This flattens the return values into a single array.
    • cols: Since agent_id and agent_type are not normally included in the plugin’s internal usage, specify return columns.

    Notes and caveats:

    • This only retrieves explicitly assigned permissions (in this case, “Enable” permissions). It does not infer all users who have the access based on their WordPress capabilities.
    • To retrieve users / groups who are explicitly blocked, change the mod_type argument to ‘exclude’
    • If you have also assigned permissions to terms / categories, those will require a separate pp_get_exceptions() query. You would need to apply your own logic to correlate term-assigned permissions to your post of interest.
    • There is not currently a way to query for all permission-assigned users without also retrieving groups. So in handling the return array, you’ll have to check for agent_type = ‘user’
    • When the agent_type is ‘user’, agent_id means user_id

    Thread Starter ijogold

    (@ijogold)

    Great! Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How get users ID’ is closed to new replies.