Support » Plugins » Minimal files for getting user info for Ajax plugin

  • Hi all,
    Does anyone have a some minimal code that could be used in an ajax plugin to get the logged in user’s info. I’ve been using wp-config, but if you follow the code in that to wp-settings and see all the files that get included and all the unwanted code that gets executed, there’s a ton of overhead.

    The app I’m designing will require lots of little ajax calls. Ultimately, I want to use WordPress authentication and house the app in WordPress, but I need it to be fast and efficient. I’ve created slimmed down versions of wp-config and wp-settings that will give you the current_user object, but those still have a ton of extraneous code.

    Anyone have anything that would work in this situation?

    If anyone’s interested in my slimmed down files, let me know and I’ll put them on my blog.

    Thanks for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Tap-tap-tap…is this thing working? Does anyone have any suggestions on this?

    If my first cry for help wasn’t very clear, what I am trying to come up with is a tiny, little set of code that would authenticate whether the user is logged in and return his/her user ID. As stated previously, I don’t want to pull in wp-config because of all of the overhead that goes along with that. I’m trying to rebuild my (to-do list app) in WordPress. I’d like to make it as much like a plugin app as I can so I could potentially release it into the wild one day. This app relies heavily on AJAX for the function of the list (drag-n-drop, inserts, etc). It incurs lots of little AJAX calls. If it ever saw more than 5 users per day, the overhead from wp-config + wp-settings would be excessive. So I just need to know who is logged in on the AJAX calls the rest of it is 100% SugarDo and 0% WordPress.

    I assume that I would have to duplicate the WP site key and database connection info…would it be possible to have a plugin that rewrites (in a secure fashion) the site key and DB connection info to a new file (so you don’t have to include wp-config.php and get the entire WP app) when you activate it?

    I really need help with the cookies and how you would go about validating that info against the DB to see if the user is valid and to get the user ID…I don’t even need the full blown User object…i can get all that out of the DB later if needed.

    Any help would be tremendously appreciated. Further, I think that if people wanted to begin build AJAX heavy apps that aren’t necessarily WP-Post and WP-Page related in the WordPress framework, this would be a major advantage.

    Thanks again!

    i second that …

    because placing the user_ID information in the source code is dangerous … people can use firebug and change the information.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Minimal files for getting user info for Ajax plugin’ is closed to new replies.