createdByUserNum when accounts in a different table

By gregThomas - September 8, 2014

Hi Karls,

Thanks for bringing this to our attention. The value for createdByUserNum and updatedByUserNum should actually be 0, as the CURRENT_USER values won't be set until the user has logged in. Here is the change you need to make:

      //
      $colsToValues = array();
      $colsToValues['createdDate=']     = 'NOW()';
      $colsToValues['updatedDate=']     = 'NOW()';
      $colsToValues['createdByUserNum'] = 0;
      $colsToValues['updatedByUserNum'] = 0;

      // fields defined by form:
      //$colsToValues['agree_tos']      = $_REQUEST['agree_tos'];
      $colsToValues['fullname']         = $_REQUEST['fullname'];
      $colsToValues['email']            = $_REQUEST['email'];
      $colsToValues['username']         = coalesce( @$_REQUEST['username'], $_REQUEST['email'] ); // email is saved as username if usernames not supported
      $colsToValues['password']         = $passwordHash;
      // ... add more form fields here by copying the above line!
      $userNum = mysql_insert(accountsTable(), $colsToValues, true);

We've updated our development copy of the plugin with this change, and it will be in the next release.

The values that are stored in these fields are normally the num values from the accounts table that last updated/created the record. But they're not required fields, so if you want to store num values from different tables in them you can.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com