Cross posting from the forum....
I made a test database with two fields, one user editable (field_51), one not (field_52). They're both text fields with no filtering, no formatting.
# more hooks/database_callback_7.php
<?php
class database_callback_7
{
protected $registry;
protected $DB;
protected $settings;
protected $request;
protected $lang;
protected $member;
protected $memberData;
protected $caches;
protected $cache;
public function __construct( $registry )
{
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
}
public function startUp()
{
}
public function preSave()
{
echo "This is in preSave() before any changes have been made!<BR>";
print_r($this->request);
$this->request['field_51'] = "I like traffic lights";
$this->request['field_52'] = "But only when they're green";
echo "<BR><BR>This is in preSave() after changes have been made!<BR>";
print_r($this->request);
}
public function postSave()
{
echo "<BR><BR>This is in postSave()!<BR>";
print_r($this->request);
$record = $this->DB->buildAndFetch(
array( 'select' => 'field_51, field_52',
'from' => 'ccs_custom_database_7',
'order' => 'primary_id_field desc',
'limit' => 1 )
);
echo "<BR><BR>But this is what's in the database!<BR>";
print_r($record);
die();
}
}
?>
This is in preSave() before any changes have been made! Array ( [app] => ccs [module] => pages [section] => pages [id] => 7 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => oh bother [dosubmit] => Save [request_method] => post ) This is in preSave() after changes have been made! Array ( [app] => ccs [module] => pages [section] => pages [id] => 7 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => I like traffic lights [dosubmit] => Save [request_method] => post [field_52] => But only when they're green ) This is in postSave()! Array ( [app] => ccs [module] => pages [section] => pages [id] => 7 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => I like traffic lights [dosubmit] => Save [request_method] => post [field_52] => But only when they're green ) But this is what's in the database! Array ( [field_51] => I like traffic lights [field_52] => )
This is in preSave() before any changes have been made! Array ( [app] => ccs [module] => pages [section] => pages [id] => 8 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => oh bother [dosubmit] => Save [request_method] => post ) This is in preSave() after changes have been made! Array ( [app] => ccs [module] => pages [section] => pages [id] => 8 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => I like traffic lights [dosubmit] => Save [request_method] => post [field_52] => But only when they're green ) This is in postSave()! Array ( [app] => ccs [module] => pages [section] => pages [id] => 8 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => I like traffic lights [dosubmit] => Save [request_method] => post [field_52] => But only when they're green ) But this is what's in the database! Array ( [field_51] => I like traffic lights [field_52] => )
This is in preSave() before any changes have been made! Array ( [app] => ccs [module] => pages [section] => pages [id] => 8 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => oh bother [dosubmit] => Save [request_method] => post ) This is in preSave() after changes have been made! Array ( [app] => ccs [module] => pages [section] => pages [id] => 8 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => I like traffic lights [dosubmit] => Save [request_method] => post [field_52] => But only when they're green ) This is in postSave()! Array ( [app] => ccs [module] => pages [section] => pages [id] => 8 [do] => save [record] => [post_key] => e29fc01e3e3dfa873c54f24144794a9f [field_51] => I like traffic lights [dosubmit] => Save [request_method] => post [field_52] => But only when they're green ) But this is what's in the database! Array ( [field_51] => I like traffic lights [field_52] => But only when they're green )
Powered by SD.Agregator (http://www.invisionize.eu)
© SpannerDEV (http://www.spannerdev.pl)