• Resolved tridentspk

    (@tridentspk)


    So here is what I’m trying to figure out:

    I have 13 wordpress pages each dedicated to a province in Canada. Each page displays a separate venue map for venues in that particular region.

    B.C page example:
    [eo_venue_map venue=”test-1,bcplace” width=”640px” height=”480px” tooltip=true]

    When creating a new event, you have the option to create a new venue or choose an existing one. Once the publish button has been clicked, I want it to:
    Pseudocode:
    1. Grab the nonce token, the state/province, and the venue id
    2. Determine which province has been added, for example if its B.C then it would be ready to update this wordpress page:
    https://site.com/wp-admin/post.php?post=315&action=edit
    3. Generate the appropriate shortcode by either:
    A.) Going through the list of all venues in B.C along with the new one, from the Database and create the shortcode:
    [eo_venue_map venue=”previous-1,previous-2,newvenue” width=”640px” height=”480px” tooltip=true]
    B.) Somehow grabbing the existing content in the wordpress page (perhaps from the database), parsing the shortcode, appending a comma and the venue id for the venue=”” portion of the shortcode.
    4. Once the shortcode has been created, it would send a POST request to:
    https://site.com/wp-admin/post.php?post=315&action=edit
    And it would save the new shortcode in the content.
    5. A similar process would occur for deletion or updating of a venue.
    6. If there are no remaining venues in a particular region, due to deletion, for example Alberta, then the wordpress page would be updated with a simple text: “No venues available in this region”

    Main reason for doing this:
    – A usergroup will be given permission to create new events and venues and it would be impractical to make them manually update each wordpress page with the new venue locations on the map.
    – The usergroup won’t be able to see or update any wordpress pages directly, except for the events.

    Now I’m not asking for a full solution here with all of the code as that would probably take a lot of work. But I would appreciate tips/guidance on how to approach this problem and the best way to get it done and perhaps snippets of useful code.

    Thanks! I appreciate it.
    Let me know if you need any clarification on what I’m asking.

    https://www.ads-software.com/extend/plugins/event-organiser/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    I think updating the page’s content to add/remove attributes from a shortcode used on it is probably the wrong (certainly more difficult) way of going about this. I would instead do the following:

    1. Create a shortcode [region_map region="B.C."]
    2. This shortcode queries for venues in the B.C. region
    3. This could be cached if performance is an issue (and cleared when venue is deleted/updated – there are hooks for that.).
    4. It then uses eo_get_venue_map() (see docs) to display those venues on a map.
    5. If it can’t find any pages it can display a message: “No venues available in this region”

    That way you avoid having to search for the appropriate pages, parse their content and try to update the post content and insert/remove shortcode attriubtes without breaking anything. Certainly possible, but a messy way of doing it.

    Querying venues by region or other meta data is only possible in Pro (see features). A less performan way of doing things would be to just to loop through all venues and pick out the relevant oens.

    Thread Starter tridentspk

    (@tridentspk)

    I wish I could just get the Pro version but the problem is that I’m working on a website for a particular sport for a government organization, and this is part of my school project so I don’t get paid for it. They have to go through a long bureaucratic process in order to get compensated for anything purchased. So far the client has agreed to reimburse me for a theme I had bought. But her concern is about the licensing. Even if the license gives me permission to use the plugin for 1 client website, in the future, if they (government organization) want to make any changes to the plugin themselves, they would have to contact me, and thats simply unfeasible. Is there a way that your license would give permission for an entity for whom i’ve done work for, be given the ability to update the plugin themselves? Because then I could convince my client that its worth the purchase for this plugin.

    Thanks.

    Plugin Author Stephen Harris

    (@stephenharris)

    Thats not a problem. They will still be able to edit the plugin themselves. For access to support they just need to login with the email adress that purchases the plugin. But I can always transfer that email if needs be.

    Thread Starter tridentspk

    (@tridentspk)

    I have a quick question.

    When querying the venues by location following this tutorial:
    https://wp-event-organiser.com/pro-features/event-venue-queries/

    Where does the code go? Does it go in a file for the plugin? Is there another shortcode for venue maps that lets you choose the region?

    Thread Starter tridentspk

    (@tridentspk)

    Nevermind, I got it solved ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Best way to automatically update shortcode on page when new venue is added?’ is closed to new replies.