Jump to content

Action Hook or Module for Client Area (Terms of Service Agreement)


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. Sam as when there is an available update to WHMCS.

 

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");
?>

 

Can someone write the rest, or quote me on a module to do this? Module interests me since we can set it so we can copy and paste the new TOS and when published, users are forced to agree to those new terms.

 

Thanks

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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