开发者

Check if user agreed to terms , set cookie

开发者 https://www.devze.com 2023-01-08 03:52 出处:网络
I\'m a Drupal nub. I would like to check on every page if user (anonymouse) agreed to somekind of terms. I suppose i should write small custom module ?

I'm a Drupal nub. I would like to check on every page if user (anonymouse) agreed to somekind of terms. I suppose i should write small custom module ?

Where will this condition be written 开发者_运维问答 if(!$_COOKIE('confirm')){ //jQuery show confirmation form //Set cookie for 1hour } maybee in page.tpl.php ? Please, give me some tips ..


If you don't want to store the info for a long time, you should use $_SESSION variable. Then in preprocess page you could check if the user has accepted and set a variable that you can use in your page.tpl.php.


user_save() accepts an array argument which you can put custom data into. This will then be loaded with your $user object and you can use in any template file.


Check out these modules:

http://drupal.org/project/legal

http://drupal.org/project/terms_of_use


The Legal and TOS modules are good if you need a login. If working with anonymous users, however, you'll need to use the rules module with https://www.drupal.org/project/rules_session_vars.

0

精彩评论

暂无评论...
验证码 换一张
取 消