Frontend Users not expiring
Re: Frontend Users not expiring
There's a difference between the DBTimeStamp functions of full ADOdb and Lite and some other issues with the datetime data field. See this thread for some more info.
I might implement the same solutions in FEUsers in the coming days (and look at the other issues that were brought up in this thread).
Regards,
D
I might implement the same solutions in FEUsers in the coming days (and look at the other issues that were brought up in this thread).
Regards,
D
-
mahjong
Re: Frontend Users not expiring
I rewrote the SQL query to bypass completely this issue :
Should execute 0.0001s faster. (^_^)
Code: Select all
$q = "SELECT * FROM ".cms_db_prefix()."module_feusers_users WHERE id = ? AND expires > NOW()";
$dbresult = $db->Execute( $q, array( $uid ) );
Re: Frontend Users not expiring
More exactly: the ADOdb field type DT only exists in the adodb_lite datadict, not in full/original adodb.Dee wrote: There's a difference between the DBTimeStamp functions of full ADOdb and Lite
ADOdb uses T for datetime, ADOdb T for time and DT for datetime.
Also, in cmsmadesimple-0.13 an altered ADOdb Lite was used which didn't surround the return value of DBTimeStamp with quotes.
Last edited by Anonymous on Sun Dec 10, 2006 7:19 pm, edited 1 time in total.
-
mahjong
Re: Frontend Users not expiring
Now I understand the origin of all the bugs. I think everything is solved. I'll post in a few minutes the corrections that need to be added in SVN.
-
mahjong
Re: Frontend Users not expiring
FrontEndUser.api.php
Code: Select all
// userid api function
// returns array
function AddUser( $name, $password, $expires )
{
$db =& $this->GetDb();
// see if it exists already or not (by name)
$q = "SELECT * FROM ".cms_db_prefix().
"module_feusers_users WHERE username = ?";
$dbresult = $db->Execute( $q, array( $name ) );
if( !$dbresult )
{
return array(FALSE,$db->ErrorMsg());
}
$row = $dbresult->FetchRow();
if( $row )
{
$module =& $this->GetModule();
return array(FALSE,$module->Lang('error_username_exists'));
}
// generate the sequence
$uid =
$db->GenID( cms_db_prefix()."module_feusers_users_seq" );
// insert the record
$q = "INSERT INTO ".cms_db_prefix().
"module_feusers_users VALUES (?,?,?,?,?)";
$dbresult = $db->Execute( $q, array(
$uid,
$name,
md5($password),
trim( $db->DBTimeStamp( time() ) , "'") ,
trim( $db->DBTimeStamp( $expires ) , "'")
)
);
if( !$dbresult )
{
return array(FALSE,$db->ErrorMsg());
}
return array(TRUE,$uid);
}
Code: Select all
function IsAccountExpired( $uid )
{
$db =& $this->GetDb();
$q = "SELECT * FROM ".cms_db_prefix()."module_feusers_users WHERE id = ? AND expires > NOW()";
$dbresult = $db->Execute( $q, array( $uid ) );
if( $dbresult && $dbresult->RecordCount() )
{
return false;
}
return true;
}
-
mahjong
Re: Frontend Users not expiring
Everything is fine now.
The bugs were caused by missing "trim"s around the "DBTimeStamp"s. See the corrections I've posted.
The bugs were caused by missing "trim"s around the "DBTimeStamp"s. See the corrections I've posted.
Last edited by mahjong on Sat Dec 09, 2006 7:30 pm, edited 1 time in total.
Re: Frontend Users not expiring
Ok, so Mahjong, are you saying that the latest SVN version of FrontEndUsers.api.php contains all your updates and is ready to be used?
-
mahjong
Re: Frontend Users not expiring
No, I'm not authorised to make changes in SVN.
Cut and paste the corrections yourself.
Cut and paste the corrections yourself.
Re: Frontend Users not expiring
ok. I'll admit I'm a bit confused by all the edits, so I'm going to wait for Dee or one of the other developers to post the changes, and then I'll get the latest version. My system is working OK now (crossing fingers), so I'll leave it alone for the moment. Thanks for all your work on this, Mahjong!
Re: Frontend Users not expiring
oh, dear...
I was incorrect earlier, Mahjong, when I said my system was working properly. I failed to notice that the user I was testing with was assigned to a group that did not have access to the content. So it was not the expiration date that prevented him from seeing the content, it was the fact that he was not a member of an authorized group.
To recap, I just created a user TEST, assigned him as a member of all groups, so that he would have access to all content, and set his expire date as 12/1/06 at 17:00:00. The date shows correctly in the admin panel, but TEST can still log in and view all content, though he should be expired.
Maybe I'll have to look at making the FEU api changes now instead of waiting until they're incorporated into the SVN code...
I feel like such a dunce.
I was incorrect earlier, Mahjong, when I said my system was working properly. I failed to notice that the user I was testing with was assigned to a group that did not have access to the content. So it was not the expiration date that prevented him from seeing the content, it was the fact that he was not a member of an authorized group.
To recap, I just created a user TEST, assigned him as a member of all groups, so that he would have access to all content, and set his expire date as 12/1/06 at 17:00:00. The date shows correctly in the admin panel, but TEST can still log in and view all content, though he should be expired.
Maybe I'll have to look at making the FEU api changes now instead of waiting until they're incorporated into the SVN code...
I feel like such a dunce.
Re: Frontend Users not expiring
I added Mahjong's changes to my FEU api file, and my expired user now cannot log in ("account is expired").
well done, Mahjong!
Calguy - 2 thumbs up for originally writing this module, CustomContent and SelfReg...
well done, Mahjong!
Calguy - 2 thumbs up for originally writing this module, CustomContent and SelfReg...
-
mahjong
Re: Frontend Users not expiring
And a few days later, inexplicably, calguy1000 overwrote the fixes in FrontEndUsers.api.php with rev.107Added the changes posted by mahjong to SVN.
Please update your working copy before committing changes...
Re: Frontend Users not expiring
shouldn't svn give error about conflicts?
of course one can force the commit...
of course one can force the commit...

