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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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?