problem with after_clientchangepassword_10.php

Started by eazl, October 24, 2013, 07:16:20 AM

eazl

Hi,

I am trying to configure a hook that when someone changes a password in the client area, the password is changed also in a different database we use in our system

My problem is this. It does not seem that the script is running.  This is the script and what i tried.

1. i wrote a script and put it in before_displayadminfooter_01.php. I was able to see the echo in the admin footer and the SQL statement executed and changed a value in database (that was my test to make sure that the script works from HB to show something and update a table)
2. copied the same script with a change to the variable that I write to db and removed the echo and no changes were made to db.  I also changed the name of the after_clientchangepassword_01.php to after_clientchangepassword_10.php just in case.

this is the code I am using. It works from command line, from the admin footer but NOT when i log in as client and change password, nor when changed by support from Admin. Am I missing something?

/**
* Client just changed his password
* Following variable is available to use in this file:  $details Items available:
* $details['client_id']; // Related client ID
* $details['password']; // New client password
*/

$hook_id = $details['client_id'];
$hook_pass = $details['password'];
$hook_msg = "DEBUG: $hook_id = $hook_pass";

$mysqli = new mysqli( "xxxx", "xxxxx", "xxxxx", "xxxx" );

if ($mysqli->connect_errno) {
    //printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}

if ($mysqli->query("UPDATE user SET how_did_you_hear_about_us = '$hook_msg' where crm_user_id = 1") === TRUE)
{
   // printf("Updated USER Info.\n");
}