Home Forums Plugin Support WP User Frontend Pro Delete/edit link in own query

This topic is: not resolved

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by  nonameolsson 5 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #7721

    Post count: 10

    I have a own query to list my custom post types. I'm trying to imitate the Dashboard, but with my own custom settings.

    Here is the code: http://pastebin.com/Q3DXiBHT

    I've copied some from the plugin code. The problem I have is the edit and delete link. I want them to show up only if the user role of the current user is “fulltime”, and the post status is not “publish”. And it works!
    This is the code for that part:

    					  					if ( (wpuf_get_option( 'enable_post_edit', 'wpuf_dashboard' ) == 'yes') && (wpuf_get_option('enable_post_del', 'wpuf_dashboard', 'yes') == 'yes') && ( ($post->post_status != 'publish') )) {
            									$del_url = add_query_arg( array('action' => 'del', 'pid' => $post->ID) );
            									$edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_general' );
            									$edit_url = add_query_arg( array('pid' => $post->ID), get_permalink( $edit_page ) );        										
            									<a href="<?php echo wp_nonce_url( $del_url, 'wpuf_del' ) ?>" onclick="return confirm('Are you sure to delete?');"><span style="color: red;"><?php _e( 'Delete', 'wpuf' ); ?></span></a>
    											<a href="<?php echo wp_nonce_url( $edit_url, 'wpuf_edit' ); ?>"><?php _e( 'Edit', 'wpuf' ); ?></a>
        									} ?>

    But the problem is when I press the delete link. The alert pops up asking if I'm sure that I want to delete that post. When I press yes, nothing more happens.

    Why can't I use the WPUF delete link function in my own query?


    Tareq Hasan
    Post count: 2831

    To work the delete link properly, the dashboard need to have the plugin dashboard shortcode. Otherwise it won't work.

    As you are not using the shortcode here, you've to implement a delete functionality by yourself. Check the plugins delete function to get the idea.


    Post count: 10

    Ok, thank you for the explanation! This seems to be a bit difficult to me. Maybe I will try another solution.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Delete/edit link in own query’ is closed to new replies.