Support => cpg1.4.x Support => Older/other versions => cpg1.4 plugins => Topic started by: menlo_bob on March 19, 2007, 04:14:20 am

Title: plugins can occur before data is posted to the database
Post by: menlo_bob on March 19, 2007, 04:14:20 am
in short: pages like editOnePic.php call load_template() by including include/ before calling process_post_data().  this means that if any plugins use the database for dynamic content, they will use data before any modifications have been posted.  this can leave the plugins out of step with the rest of the page.

task: to require user data entry on all pictures.
design: write a plugin that queries the database at gallery_header time to see if all data is entered by the current user.  if not, add links to editOnePic.php for the offending pictures and preclude normal operation at the plugin_block plugin.
operational problem: when the user adds the last required data field, the data posting occurs after the template was loaded so the last data entry is not found by the gallery_header plugin.

workaround: when process_post_data() is called in editOnePic.php, the template is re-loaded with another call to load_template() to properly reflect the database update.

is there a better way to do this?