oabsa / dues-lookup

Wordpress plugin to use in conjunction with LodgeMaster to allow Lodge members to look up when they last paid dues
https://github.com/oa-bsa/dues-lookup/wiki
Other
9 stars 4 forks source link

Redesign URL hooks to use shortcodes #21

Closed justdave closed 4 years ago

justdave commented 9 years ago

So the way we're trapping the URL to use for the plugin is unnecessarily complicated... I recently installed WooCommerce on a site, and I really like the way it traps the URLs for your cart and the checkout system, etc.

Basically instead of having a URL in the config and then trapping on page load for that URL and overriding the entirety of wordpress to display our stuff, we set up a shortcode that displays the dues lookup stuff and offer on first run to create a page that contains the shortcode (or provide instructions to create one). Not only will this result in far less code inside the plugin dealing with how to display a page, but it also lets the page show up in your page hierarchy so you can put it in menus and whatnot.

We've also got a situation now in Michigan where due to a council consolidation we have four different OA lodges potentially using the same Wordpress installation. It may be useful to be able to support multiple lodges with the plugin, and by using a shortcode we could do things like pass an argument to the shortcode to tell it which lodge's data to work form on that page, without having an unnecessarily complicated mess of preferences for all the urls to use. :-) (and that'll be a separate issue to file, but it would be dependent on this one)

justdave commented 9 years ago

On first run with the new code, we can check if the preference for the URL to use exists, and if it does, create a page with that URL and put the shortcode in it, then delete the preference. That would allow people to upgrade without breaking anything (although it may suddenly show up in site menus in a random location when it didn't previously)

justdave commented 4 years ago

This is now ready to go, but I'm waiting on #34 before creating a pull request because it's dependent on that one.