Hi, I'm using Access and I've inseted the [cred-delete-post action='delete' onsuccess='self']Delete[/cred-delete-post] shortcode in a View.
If Access is active the Delete link is not displayed.
If I deactivate Access it is displayed.
It seems it works fine for Administrator but not for other custom roles.
Can you check it?
cheers
I'm having problems getting it to work, too.
I'm going to set up a clean test site to work specifically on this.
I'll get back to you.
This is a little odd.
I set up a clean site (two, actually).
I found that if you modify the cred-delete-post shortcode so that the action is "trash" rather than "delete" then it appears to work as expected. (If you can verify the same then you should be able to use that setting in the meantime while I investigate further.)
What's odd is that, having tried initially with the delete action (which failed), then switched to the trash action (which worked), I then reverted back to the delete action, and that then started working. So on my test sites I cannot readily reproduce the problem any more, and will need to create another new one to test the initial problem.
I'll bring a clear head to it tomorrow and will report back, but can you verify that it works with trash?
Hi Nigel, I made this test:
- I created a new page where I added both Delete and Trash links (see screen2.jpg)
- I set Pages managed by Access (see screen.jpg)
- Then I open the page with an Administrator, a Subscriber and a Residente user
Only the Administrator can see the links (I also tested them and they works as expected), the links are not displayed for the other two roles.
cheers
I'm still getting into the nitty gritty of where exactly the problem arises, but while investigating I have identified how to apply a workaround that you can use in the meantime.
Try adding the following code snippet (you'll need to edit the array of roles you want to apply this to, which in your case I think will be subscriber and residente):
function ts_mod_caps( $allcaps, $caps, $args, $user ){
$add_caps = array(
'delete_own_posts_with_cred' => true,
'delete_other_posts_with_cred' => true
);
$roles = array( 'subscriber', 'contributor' );
if ( in_array( $user->roles[0], $roles ) ) {
$allcaps = array_merge( $allcaps, $add_caps );
}
return $allcaps;
}
add_filter( 'user_has_cap', 'ts_mod_caps', 11, 4 );
Note, it doesn't appear necessary for higher roles, e.g. author and editor.
My issue is resolved now.
The workaround worked fine for me.
Thank you!