plugins can occur before data is posted to the database plugins can occur before data is posted to the database
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

plugins can occur before data is posted to the database

Started by menlo_bob, March 19, 2007, 04:14:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

menlo_bob

in short: pages like editOnePic.php call load_template() by including include/init.inc.php 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?