• Hi there,

    I have these two capabilities assigned to the contributor role:

    delete_posts
    delete_published_posts

    I’m using get_delete_post_link( get_the_ID() ); in the posts loop. When a contributor clicks the delete link, they’re redirected to the your-profile.php page, instead of having the post moved to the trash.

    When I deactivate TML, the link works, and the post is sent to the trash. I’m not sure what component of TML is overriding, or blocking, the delete_published_posts capability for my contributor role. No other plugins are active when I repro this.

    Cheers

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter prodo

    (@prodo)

    I’ve narrowed down what’s causing it, but not why.

    Repo steps:
    -Add delete_published_posts capability to contributor role
    -Enable the Themed Profiles module
    -Under “Restrict Admin Access”, check the box next to contributor
    -Try to delete a post using get_delete_post_link( get_the_ID() );

    Expected:
    Post is deleted

    Reality:
    Contributor is redirected to your-profile.php

    Thread Starter prodo

    (@prodo)

    It appears to be a problem with the redirects in themed-profiles.php line 110 public function init(). They’re overriding the capability of deleting a published post.

    • This reply was modified 8 years, 4 months ago by prodo.
    Thread Starter prodo

    (@prodo)

    Specifically:

    if ( ! defined( 'DOING_AJAX' ) ) {
    	wp_redirect( $redirect_to );
            exit;
    }

    starting on line 129 in themed-profiles.php

    Thread Starter prodo

    (@prodo)

    My fix was to change the above if statement to:

    if ( ! defined( 'DOING_AJAX' ) && 'trash' != $_GET[ 'action'] ) {	
            wp_redirect( $redirect_to );
    	exit;
    }

    This is more than likely not the best way, Jeff. I’m looking forward to what you come up with for a fix! Thanks so much.

    Cheers

    P

    Plugin Author Jeff Farthing

    (@jfarthing84)

    There’s not really a “fix”, other than not enabling Themed Profiles for Contributors.

    Thread Starter prodo

    (@prodo)

    So, in my case, the solution is to modify this file every time I update TML?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘TML is overriding contributor capabilities’ is closed to new replies.