WordPress.org

Ready to get started?Download WordPress

Forums

Ajax & WordPress Plugin (3 posts)

  1. Matalina
    Member
    Posted 3 years ago #

    I am currently writing a roster plugin for rift. I currently have the plugin parsing an xml file storing it in the database and able to pull the data from the database to display via a shortcode.

    I am now trying to add a "claim" function for logged in users. I can hack it with just php and mysql but I'd like to use it WordPress style and be able to call WordPress functions - specifically get_currentuserinfo()

    I am currently using ajax as the means to doing this. However when I include

    <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>

    My ajax displayed modal continues to function. When I remove the include it works fine but gives me an error for the above mentioned function (which I'd expect).

    I can use help in one of two ways I guess.
    1. Point me in the right direction so that when a user who is logged in clicks the claim button their logged in user id is associated to the roster member they just "claimed"
    2. Assist me in figuring out why when I include the file my page stops working.

    I know I can write the code to do it php & mysql without WordPress so I don't need that assistance.

    What is the better means of doing this particular function?

  2. Brian Layman
    Member
    Posted 3 years ago #

    In the vein of pointing you in the right direction, I think you can find an example similar to what you want to do in the free ebook "WordPress and Ajax: An in-depth guide on using Ajax with WordPress"

    You can get it at:
    http://www.wpajax.com/

  3. Matalina
    Member
    Posted 3 years ago #

    thanks. I did a little more searching of google ajax and wordpress and have more reading material as well. I forgot another approach to my google search lol.

    Thanks for the link.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.