Home › Forums › MapPress Support › Copying Maps or Mashup by map id
- This topic has 2 replies, 2 voices, and was last updated 8 years, 5 months ago by dnblankedelman.
October 6, 2014 at 11:10 am #15238dnblankedelmanParticipant
Continue to be thrilled by this plugin. I have something I need to accomplish with MPPro and I’m curious if you have any ideas on how to go about doing it.
We’re using your plugin to provide maps for performance spaces at an annual outdoor music festival. Last year I created a separate map per location, embedded them in a page, and used a mashup in that page to show combined map of all locations on that day. That worked perfectly.
This year we are using all of the same locations except for one that had to change. On this year’s page, I can reference the previous map ids plus add a new map to that page for the replacement location. But here comes the mashup question…
As far as I can tell, you are using standard WP loop queries for mashups. I don’t think I can reference specific map ids so the best I could do would be to construct a query that would pull in last year’s page and the current one. The problem with this is it means I get last year’s replaced location in the mashup.
My next thought would be to duplicate all but one map from last year on to the current page. Is there a clever way to do this (I’m happy to mess with a db table) or a better way to go about this problem?
— dNbOctober 6, 2014 at 11:29 am #15239ChrisKeymaster
I’m not sure if I fully understand the details of how your data is stored, so let me know if I’m off base. It sounds like you have many maps in a single post.
Usually it works better to use a separate post for each location: i.e. create a post for each festival location with 1 map per post. Then the queries are easy: you can just tag the posts as ‘2013’ or ‘2014’ and do a mashup for each year.
To avoid copying the maps manually, you can edit the map database tables using PHPMyAdminin or a similar tool (make sure to take a database backup first).
The maps are stored in table mappress_maps, and their association with the posts is stored in table mappress_posts.
To split up the existing maps into separate posts, with 1 map per post:
1. Create a new blank post for each location
2. Re-assign the existing map IDs to the new post IDs in table mappress_posts.
3. Assign the posts to a ‘2013’ or ‘2014’ tag or category, and use a mashup based on that.
To copy all the existing maps to a single (new) post:
1. Duplicate the maps in mappress_maps
2. Associate the new map IDs to the new post ID in mappress_posts.
3. Use a mashup like the existing one, that selects only a single post.October 6, 2014 at 12:20 pm #15240dnblankedelmanParticipant
Thanks for such a speedy response. Your understanding is correct (where many = 8).
I associated all maps that year with the same page because those maps were shown only on that page and didn’t realize there might be a good reason to burn a new (basically blank) page per map. I may just create a CPT for locations and work from there.
Thanks for your clear instructions on the table layout, that should give me everything I need to move forward.
- You must be logged in to reply to this topic.