WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] importing from csv (18 posts)

  1. Federico Vezzoli
    Member
    Posted 2 years ago #

    Do you guys think it's possible to create a php script that takes a csv file as input and automatically creates for every entry an event?
    Anyone has ever done something similar?
    Cheers.

    http://wordpress.org/extend/plugins/events-manager/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    very possible, just haven't done it :)

    it is however not worth doing just now in my opinion because I'm starting work on making events posts.

  3. Federico Vezzoli
    Member
    Posted 2 years ago #

    thanks markus.
    ideally the workflow will be:
    - collecting data through gravity forms;
    - export data in csv;
    - feed the php script with the csv file and for every entry create an event.

    I thought the csv file was the simplest solution, maybe you can tell me that I can do it straight in WP...

    Thanks

  4. Federico Vezzoli
    Member
    Posted 2 years ago #

    Hey markus,
    could you point me out how to create an event straight to the DB?
    in WP I can use wp_insert_post(), is there anything similar?

    any material would be appriciated.
    thanks

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    you can do it with the EM_Event object, either by passing in an assoc array of DB values or using the get_post method to grab post vars.

    Then, you just run $EM_Event->save().

    I haven't had a chance to play with the GF api (have a license, great plugin).

    Out of curiosity, why are you using GF for this instead of the event form?

  6. Federico Vezzoli
    Member
    Posted 2 years ago #

    oook that's a start. thank you!

    yes GF is a very nice plugin, super smooth to use and very powerful.

    I'm using it instead of the event_form beacuse I've to collect a lot of data but only a selection of them will made to the event...

    Thanks

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    i see, would be interested to know how easy GF would play with EM. A nice integration idea.

  8. Federico Vezzoli
    Member
    Posted 2 years ago #

    i hope to do something...
    as start I thought to hook the event creation straight to the form submission, but since the data need to be revised before the event creation i'm strugglinga bit to find another solution...

  9. Federico Vezzoli
    Member
    Posted 2 years ago #

    sorry the noob question...
    How I set values to the object before calling the save() fucntion?

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    ´
    $EM_Event = new EM_Event();
    //do what's needed
    $EM_Event->save();´

  11. mahe84b
    Member
    Posted 2 years ago #

    can you reopen this post please and provide more information on how to create assoc array that can be used with EM_Event object.

  12. agelonwl
    Member
    Posted 2 years ago #

    @mahe84b

    please check this tutorials
    -http://wp-events-plugin.com/tutorials
    -http://wp-events-plugin.com/tutorials/saving-custom-event-information/

  13. mahe84b
    Member
    Posted 2 years ago #

    Thanks aglonwl.
    I will post my solution once am through.

    Thanks once again.

  14. mahe84b
    Member
    Posted 2 years ago #

    Really Appreciate your help.

    I am able to successfully import single events.

    Can you suggest how I can dump the recursive events/long events.

    For example for a recursive event the values are obtained as follows from my database:

    1st recursion:

    start date:2012-07-06 10:10:00:000
    end date: 2012-07-06 11:10:00:000

    2nd recursion:

    start date:2012-07-13 10:10:00:000
    end date: 2012-07-13 11:10:00:000

    3rd recursion:

    start date:2012-07-20 10:10:00:000
    end date: 2012-07-20 11:10:00:000

    and so on.....

    How can I convert these to recursive events of Events Manager.

  15. mahe84b
    Member
    Posted 2 years ago #

    I have figured out inserting recursive events as well.

    Just 2 things to finish my project:

    1) how can I set the categories and tag values for the events using EM_Event object.

    2) is it possible to set individual timings for each day of week to recursive events.

    Any Help would be highly appreciated. I promise a definite word spread and donation.

    [No bumping. If it's that urgent, consider hiring someone.]

  16. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    1) you'd just use normal WP functions to add a taxonomy item like
    wp_set_object_terms($EM_Event->post_id, $term_slugs, EM_TAXONOMY_CATEGORY);

    2) sorry, not possible (yet)

  17. mahe84b
    Member
    Posted 2 years ago #

    Marcus good to hear from you thanks so much for your support.

    I am looping data from other DB server and storing those to my wordpress DB.
    while looping I am passing all the values to EM_Event object and finally calling the EM_Event_save() method.

    Please tell me how I can get post_id from there to use with this WP Function.

  18. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    once you run the save method you should be able to use the same as above:

    $EM_Event->post_id

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic