This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

[closed] Hooks on 2.0


  1. agentcooper
    Member

    Hi,

    I'm trying to implement a post_insert hook to insert values into another database. I know earlier that could be achieved creating a function at custom_hooks.php. How can this be achieved now in 2.0?

    Regards

    Posted 16 years ago #
  2. yuniar

    hi agentcooper, I love your nickname :-)

    As of version 2, hooks are being removed indeed. However, if you would like to use it again, you can simply insert it back.

    You only need to edit includes/post-functions.php
    In version 1.2, post_insert hook is being called at line 890, this is the code:

    if(function_exists("form{$form_id}_hook_post_insert") && $is_inserted){
    	call_user_func("form{$form_id}_hook_post_insert",$table_data);
    }


    now you need to insert the above code to the new post-functions.php file.
    Insert that code to line 1053.

    That should activate post_insert hook in your custom_hooks.php file.


    MachForm Founder

    Posted 16 years ago #
  3. agentcooper
    Member

    Hi yuniar,

    That worked ok.

    But I don't understand why you removed hooks infrastructure. It was hidden from non-programmers, so there was no extra complication to them. And for programmers it was quite clear and useful.

    Anyway, your solution deserves a "damn fine cup of coffee" ;-)

    Posted 16 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.