Welcome Guest, Not a member yet? Register   Sign In
CodeExtinguisher 2.0 Release Candidate 14.2

jtaby, i diff'd the appropriate files and don't see any changes that would make the post hooks not get called. oh and let me correct my last statement from saying i was trying to echo something to debug, i was actually calling exit('some relative debug message'). am i correct in assuming that the hooks are fired through codexcontroller::execute_edit() and codexcontroller::execute_add() here:
    $db_data = $this->event->trigger('prepForDb',array($_POST));
    } else {
which fires off the corresponding event in codexevents, which in turn calls codeforms::iterate() on the given function. maybe you can tell me a bit of how the iterate method works? when it calls this line:
$return_array[$field] = $obj->$func_name($val,$field);
what is actually being called? initially i thought that was calling the corresponding hook method, in this case, of the manytomany plugin, but then i realized that the hook methods in manytomany only accept one parameter and the line above passes two, a value and it's corresponding field. is this not true? what am i not understanding here?? also, i notice that the iterate method returns the array, but nowhere do i see the calling of iterate storing that array. instead, iterate is only called like:
and never storing that return array like this:
$temp = $this->CI->codexforms->iterate('postEditHook',$data);
is it even used? if so, how and where? i guess the khaos of codexevents has finally gotten to me... :grrr: any advice anyone?

[eluser]Majd Taby[/eluser]
hahaha i love the pun...

Here's how it works:

Some plugins "contain" other plugins. For example, the FieldSet plugin contains other plugins inside it. Similarly, the ManyToMany plugin contains other plugins (when you click on Add New). Because each plugin has its own processing requirements and needs to have its hooks/callbacks called, then the containers (fieldset, manytomany) need to know which field is getting processed.

So if you have a fieldset with 4 plugins inside it, it will have prepForDisplay called on it four times, each time with a different $field parameter. On the other hand, standalone plugins don't contain any other plugins, so they don't need a second parameter.

As far as the iterate function returning an array, take a look at lines 102,110,123,128 of codexevents.php Smile

For your problem, I would change the iterate() function like this:

function iterate ($func_name,$param_array=array()){
        $return_array = array();

        foreach($this->objects as $name=>$obj){
                foreach($obj->getIterateNames() as $field){
                    $val = (isset($param_array[$field]))? $param_array[$field] : '';
                    echo get_class($obj)."->$func_name($value,$field);<br>";
                    $return_array[$field] = $obj->$func_name($val,$field);

                $value = (isset($param_array[$name]))? $param_array[$name] : '';

                echo get_class($this->objects[$name])."->$func_name($value,$name);<br>";
                $return_array[$name] = $this->objects[$name]->$func_name($value,$name);
        return $return_array;

That way you know exactly what's getting called.

jTaby, thanks for that, it works, u rock dude Big Grin

another newbie question: where do I change the date format? I changed it in the config and the date is still the same format Sad

see into the date.php plugin....

I changed it to dd/mm/yy, after it simply does not work and return zeroes, HELP!!!

try with this plugin date_eu.php
&lt;?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Date_eu extends codexForms
    function Date_eu($name,$params) {

    function prepForDisplay($value){
        if(!empty($value) AND ($value != 0 AND $value != "0000-00-00")){
            $explode = explode('-',$value);
            return date('F j, Y',mktime(0,0,0,$explode[1],$explode[2],$explode[0]));
            return '';
    function prepForDB($value){
        return ($date_eu);

    function getHTML()
        $CI = &get;_instance();

        $html = $this->prefix;
        //format the data with eu format

            $html .= '<div class="failure">'.$this->getMessage($this->name).'</div>';

        $html .= '
            <label for="'.$this->element_name.'">
        $html .='
            &lt;input class="text" id="codexdatepicker'.$this-&gt;name.'" type="text" value="'.$new_date_eu.'" name="'.$this->element_name.'" '.$this->getAttributes($this->attributes).'>
        $js ="$(document).ready(function() {
                $('#codexdatepicker".$this->name."').datepicker({dateFormat: 'dd/mm/yy'});
        $html .= $this->suffix;
        return $html;

this is (experimental i have not try !!!) for show date in european format... tell me if it work... good night (for me... 22.49 pm)

I created the file, but wasn't sure where to include it Big Grin

[eluser]Majd Taby[/eluser]
you want to put it into the plugins/ directory.

I did put it in there, I was wondering what exactly I need to do in the script, so it would read it so I could see if it works Smile

[eluser]Majd Taby[/eluser]
ah ok, you just need to change the .yml file in the definitions/ library to use the Date_eu class instead of the Date class.

Theme © iAndrew 2016 - Forum software by © MyBB