[wp-hackers] Delete Row - Refreshes Page but not DB

Gregory Lancaster greglancaster71 at gmail.com
Mon Oct 21 21:07:01 UTC 2013


AND I just realized what the problem was.   This bit of code I wrote to
block subscribers from reaching wp-admin:


function themeblvd_redirect_admin(){
if ( ! current_user_can( 'edit_posts' ) ){
wp_redirect( site_url() );
exit;
}
}
add_action( 'admin_init', 'themeblvd_redirect_admin' );

Disabling that fixes the problem.  So dumb of me I totally forgot I added
that.  Another way to block subs from wp-admin?


On Mon, Oct 21, 2013 at 1:58 PM, Nikola Nikolov <nikolov.tmw at gmail.com>wrote:

> Ok - so to recap:
>
>  - You are using an AJAX call targeted to /wp-admin/admin-ajax.php with an
> "action" attribute set to your custom key
>  - You are using add_action( 'wp_ajax_*action*', 'action_callback' ); where
> "*action*" is the "action" from above and "action_callback" is your
> callback function
>  - In your action_callback function you are checking whether the input is
> valid and then just call wp_delete_attachment() for the corresponding image
>
> Is that correct?
>
>
> On Mon, Oct 21, 2013 at 11:55 PM, Gregory Lancaster <
> greglancaster71 at gmail.com> wrote:
>
> > Also- I teste other user roles, and only Authors and higher can delete
> the
> > form entries.  But anyone can add new.
> >
> >
> > On Mon, Oct 21, 2013 at 1:53 PM, Gregory Lancaster <
> > greglancaster71 at gmail.com> wrote:
> >
> > > Its JSON that is refurning the failure message.  I checked the error
> log
> > > after clearing it and this is the response:
> > >
> > > [Mon Oct 21 13:49:11 2013] [warn] Init: Session Cache is not configured
> > > [hint: SSLSessionCache]
> > > [Mon Oct 21 13:49:12 2013] [notice] Digest: generating secret for
> digest
> > > authentication ...
> > > [Mon Oct 21 13:49:12 2013] [notice] Digest: done
> > > [Mon Oct 21 13:49:12 2013] [notice] Apache/2.2.14 (Unix) DAV/2
> > > mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1
> > > configured -- resuming normal operations
> > >
> > > That relevant?
> > >
> > >
> > > On Sun, Oct 20, 2013 at 10:02 AM, J.D. Grimes <jdg at codesymphony.co>
> > wrote:
> > >
> > >> > $del_image = wp_delete_attachment( $file, true  );
> > >> >
> > >> > I think it would be smarter to convert that to an sql query (maybe
> > >> wordpress
> > >> > wont catch it as a delete post function in sql?)
> > >>
> > >> You want to use wp_delete_attachment(), not a custom query. The
> function
> > >> does a lot more than a single query, it cleans out all of the
> > attachment's
> > >> data from the data base, and delete's the image files if there are
> any.
> > >>
> > >> Are you sure that wp_delete_attachment() is actually being called? Are
> > >> you sure it isn't failing before then somewhere?
> > >> _______________________________________________
> > >> wp-hackers mailing list
> > >> wp-hackers at lists.automattic.com
> > >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >>
> > >
> > >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list