• Resolved philipatnedi

    (@philipatnedi)


    I’ve got a page with a link to delete a custom post type based on id that’s passed in the query vars. I’ve updated the user role customer, (woocommerce), to be able to delete_posts and delete_published_posts. These custom posts are created via Gravity Forms with the author being set to the customer who created it. The delete button shows up fine, but when clicked doesn’t actually delete anything. What else do I need to be able to have customers delete their own posts?

    <?php if ( current_user_can( 'delete_post', $custom_post_id ) ) : ?>
    <li class="deleteprofile"><a onclick="return confirm('Do you really want to delete this post?')" href="<?php echo get_delete_post_link($custom_post_id); ?>">Delete Profile</a></li>
    <?php endif; ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Honestly not sure what to suggest at the moment, as I’ve never really had to try this sort of setup. Are you getting the confirmation dialog still? Have any sort of logging enabled that could potentially add some context to the results?

    Not really something that CPTUI has any influence on, for what it’s worth. This is more around the management of the content created that happens to be registered by CPTUI.

    Thread Starter philipatnedi

    (@philipatnedi)

    When I’m logged into an admin account I can delete a custom post without any issue. When I attempt to delete a custom post with the customer account, the same user assigned as the author, it won’t delete the custom post.

    The dialog works just fine in either case stopping to ask me to confirm the deletion beforehand. However it only actually deletes if I’m logged in as an admin user.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    just as a proverbial failsafe check, have you confirmed that the post ID and user ID being checked and links created for are actually matching in the post_author column? Worth double checking on.

    Thread Starter philipatnedi

    (@philipatnedi)

    I’ve verified the user id as the author and custom post id from within the Admin area on the back-end of the site. The customer user is the author and it has the correct custom post id needed to identify the post to delete.

    It correctly identifies that the customer user can delete the custom post based off of it’s id to display the delete link.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Beyond that, I really don’t know what to tell you right now, since it’s core WP functions in play here. Nothing that CPTUI is doing that I can identify. Wish I had more information for you though.

    Thread Starter philipatnedi

    (@philipatnedi)

    That’s okay, I didn’t really know where to start with it either. I thought it might be because of the custom post type – but I’m not sure. Do you have any suggestions on where I might be able to get an answer to this?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    not one that isn’t potentially complex. I would end up using XDebug and code execution pausing to move my way through all the execution and trace my way to where it’s failing to get a better idea of where to look afterwards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Delete Custom Post Type on the front-end’ is closed to new replies.