[wp-hackers] Checking users permissions and fetching data via AJAX

scribu mail at scribu.net
Wed May 30 17:28:09 UTC 2012


On Wed, May 30, 2012 at 12:48 AM, Dmitry Tokmakov <dmitry at getmoxied.net>wrote:

> I am currently building an API to fetch posts based on category via AJAX
> and will need to check users permissions before to make sure they can
> access the requested content.  Can someone lend some insight on how to send
> the cookie with AJAX or another way of accessing the data that is
> appropriate to the user based on permissions.
>

The cookies are sent automatically with each AJAX request, so you can use
the same checks you would use normally.

Also note that if the user isn't logged in, the wp_ajax_nopriv_{action}
will be fired instead.

-- 
http://scribu.net


More information about the wp-hackers mailing list