• Resolved Swennet


    Hello, I have been editing my wpuf files for some time today to make them suit my needs. However, upon testing the functionality of the Dashboard I’ve stumbled upon an error.

    While deleting the post it sends the following error message to the page:

    You are not the post author. Cheeting huh!

    I looked into wpuf-dashboard.php file for the post-deletion code and found this.

         * Delete a post
         * Only post author and editors has the capability to delete a post
        function delete_post() {
            $nonce = $_REQUEST['_wpnonce'];
            if ( !wp_verify_nonce( $nonce, 'wpuf_del' ) ) {
                die( "Security check" );
            //check, if the requested user is the post author
            $maybe_delete = get_post( $_REQUEST['pid'] );
            if ( ($maybe_delete->post_author == $userdata->ID) || current_user_can( 'delete_others_pages' ) ) {
                wp_delete_post( $_REQUEST['pid'] );
                $redirect = add_query_arg( array('msg' => 'deleted'), get_permalink() );
                wp_redirect( $redirect );
            } else {
                echo '<div class="error">' . __( 'You are not the post author. Cheeting huh!', 'wpuf' ) . '</div>';

    I’m not sure why it is not working, I tried printing the $maybe_delete variable in the browser which gave me another error:

    Catchable fatal error: Object of class WP_Post could not be converted to string in /wp-content/plugins/wp-user-frontend/wpuf-dashboard.php on line 212

    Is the code broken? Did I break it?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tareq Hasan


    There might a missing global $userdata in the function, try to add this one the beginging of the function.

    About the fatal error, you are trying to echo an Object, you can’t do that.

    [Advertisement moderated]

    Thanks! This fixed the issue. Might want to check your plugin for this same error since I don’t remember removing the global $userdata function.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot delete posts from frontend.’ is closed to new replies.