AnsweredAssumed Answered

Logic Hook on the Users Module not working

Question asked by Anand Chitikela on Nov 26, 2015
Latest reply on Nov 26, 2015 by Shijin Krishna

Hi

 

I want to execute a query in after before logic hook like $result=$db->query("UPDATE users SET description='test' WHERE id='27283e5a-8f34-b846-367a-561fbbb4cb54'");

 

There was no Users module in the custom folder so I have create a 'Users' folder at the path

<base-path>/custom/modules/ and create a logic hook  using the files

 

AT <base-path>/custom/modules/Users/logic_hooks.php

$hook_array['before_save'][] = Array(

        //Processing index. For sorting the array.

        1,

        'before_save example',

        'custom/modules/Users/logic_hooks_class.php',

        'logic_hooks_class',

        'before_save_method'

    );

 

At <base-path>/custom/modules/Users/logic_hooks_class.php

function before_save_method($bean, $event, $arguments)

        {

         $db         = DBManagerFactory::getInstance();       

  $result     = $db->query("UPDATE users SET description='test' WHERE id='27283e5a-8f34-b846-367a-561fbbb4cb54'");

        }

Shijin Krishna

I have saved a user in the Users module but the description field is not getting updated.

Outcomes