When anonymous user makes a purchase via ubercart his account gets created automatically.
(That's fine. He has to accept the terms prior to pressing "order now".)

I plan to add his acceptance of the current legal terms via a rule and php code:

Which function of the legal module is best?

I could use drupal_write_record - but where would the data come from?
I understand that I need to get the correct values for:

version revision language uid accepted

So it seems better to use:

legal_save_accept($conditions['version'], $conditions['revision'], $conditions['language'], $account->uid);

Could I do that? How would I retrieve the current version and revision?

Help is much appreciated! Thanks. BR Max

Comments

maxilein’s picture

Status: Active » Closed (works as designed)

So here is the answer, just in case it helps someone:

in an ubercart conditional action enter the following php-code snippet:

if ($account->login == 0) { // never logged in
global $language;
$conds = legal_get_conditions( $language->language );
$msg = "version: " . $conds['version'] ." revision: " . $conds['revision'] ." lang: " . $language->language ." account: " . $account->uid;
drupal_set_message($msg , $type = 'status');
legal_save_accept($conds['version'], $conds['revision'], $language->language, $account->uid);
}

Then a user who accepted your terms (e.g. via an ubercart checkout integrated webform) gets updated correctly.

Update: Corrected the code. It chose the wrong language, because lines where mistakenly switched.

maxilein’s picture

Issue summary: View changes

corrections