Hi Jeffncou,
I looked at the rows that CMS Builder creates when you set a user up with Access = By Section and one of the section's to Author with Max Records = 1. It seems that there's a row with tableName = 'all' and accessLevel = '1', so I'd recommend inserting that row to see if that clears up the problem. Add this first _accesslist mysql_insert above your existing _accesslist mysql_insert (which I have not changed). New code in red:
// Access = By Section
mysql_insert('_accesslist', array(
'userNum' => $userNum,
'tableName' => 'all', // insert tablename you want to grant access to, or 'all' for all sections
'accessLevel' => '1', // access level allowed: 0=none, 6=author, 9=editor
'maxRecords' => '', // max listings allowed (leave blank for unlimited)
'randomSaveId' => '123456789', // ignore - for internal use
));
// friends = Author (max records = 1)
mysql_insert('_accesslist', array(
'userNum' => $userNum,
'tableName' => 'friends', // insert tablename you want to grant access to, or 'all' for all sections
'accessLevel' => '6', // access level allowed: 0=none, 6=author, 9=editor
'maxRecords' => '1', // max listings allowed (leave blank for unlimited)
'randomSaveId' => '123456789', // ignore - for internal use
));
You can set the Never Expires checkbox for new users by adding a line of code before the account record is inserted in the accounts table. There's only one new line of code here, but I'm showing the nearby lines of code for context. New code in red:
$colsToValues['password'] = $passwordHash;
// ... add more form fields here by copying the above line!
$colsToValues['neverExpires'] = '1';
$userNum = mysql_insert(accountsTable(), $colsToValues, true);
Please let me know if this helps!
All the best,
Chris