Hardcode a Plugin into theme

Hi im looking at hardcoding a wp plugin into a theme, the plugin is Calendar.

This is what i have done as of yet:

1) Moved files from wp-content/plugins into a folder within theme folder and made the changes so that paths are followed correctly.

2) Set to populate database via an SQL query rather than via plugin activation

3) Altered role caps so that contributers can add / delete bookings etc

What i am now wanting to do is remove the functionality of it having to be edited within wp-admin dashboard (even though its no longer in plugins folder it still requires editing in wp-admin, due to how the plugin sets the menus etc) and rather have post_author edit it on a created page within the theme (edit_booking.php).

Its not so simple as taking out chunks of code and adding them into edit_booking.php (only the html works), im looking for a way how to port the whole thing over and away from wp-admin, im guessing that in wp-admin there are functions called via the header/footer that need also to be ported over into my own theme functions.php does anyone have experience of doing similar and care to share a few enlightening tidbits of info on how to go about this.

Regards
Martin

Solutions Collecting From Web of "Hardcode a Plugin into theme"

My first recommendation: Don’t do it!

If the plug-in author releases an update, you can and will run into conflicts. Particularly if someone installs both the new plugin and your theme at the same time. A much safer route is to build plugin support into your theme. Make things degrade gracefully in case the plugin doesn’t exists, but don’t actually code the plugin into your theme.

If you’re still intent on hard-coding things …

Put the entire plugin in a subfolder for your theme. Then, from your theme, call activate_plugin() to turn the plugin on.

This is probably not what you want to hear, but from quick look over code this plugin doesn’t use a single WP practice for forms, JS and security. It doesn’t let WP APIs handle data, it doesn’t sanitize inputs, it doesn’t escape output…

I strongly advise you to not use this code without major rewrite of forms it would take to have, at the very least, proper security aspects in place.