Jump to content

Action Hook: Client agrees to updated TOS before being able to continue to Client Area


inyerface

Recommended Posts

I created an action hook (almost) that will force clients to agree to new terms of service (on login) before being able to continue to client area.

 

I created a new column under "tblclients" called "tosversion" (which is type "date" instead of a version number) and that gets updated no problem when the client logs in. The only problem is displaying a page or popup that displays the TOS before this field is updated.

 

the code:


<?php

$updateddate = "2016-02-16";
function hook_tos_clientlogin($vars)
{
/// CHANGE YOUR TOS VERSION
$updatedtosversion="2016-02-16";
$clientid = $vars['userid'];
if (!filter_var($clientid, FILTER_VALIDATE_INT))
{
	return;
}
$tbl="tblclients";
$fields = "tosversion";
$where = array("id"=>$clientid);
$result = select_query($tbl,$fields,$where);
$data = mysql_fetch_array($result);
$ctosversion = $data['tosversion'];

if ($ctosversion < $updatedtosversion)
{
	//we don't match, do something.

	// make sure we update at the end of this

	$update = array("tosversion"=>"$updatedtosversion");
	$where2 = array("id"=>"$clientid");
	update_query($tbl,$update,$where2);
}
else
{
	//just a courtesy else 
}
}
add_hook("ClientLogin",1,"hook_tos_clientlogin");
?>

 

What am I missing?

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...
I think we already have this logic with whmcs.... General Setting/Ordering... where you can enable and disable TOS...LOL

The idea is when you have changes to your TOS that you need your client to read, and maybe force client to click "Accept" so they can access their client area.

 

- - - Updated - - -

 

Did you find a solution to this? I'm interested in what you did. Thanks!!

I have done this for @inyerface

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated