Delete/edit link in own query

This topic contains 2 reply and 2 voices, and was last updated by nonameolsson 10 years, 7 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
September 1, 2013 at 1:46 pm 7721
nonameolsson 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:
<td><?php 
					  					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>
											<?php
                                    
    									} ?>
					  				</td> 				
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?
September 1, 2013 at 1:59 pm 7722
Tareq Hasan Tareq Hasan

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.

September 2, 2013 at 1:55 pm 7745
nonameolsson nonameolsson

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

Viewing 2 Posts - 1 through 2 (of 2 total)