[TYPO3-dev] FE extension to create new pages
Michael
typo3ml at schams.net
Mon May 28 09:32:11 CEST 2012
On 2012-05-27 21:18, Jigal van Hemert wrote:
>> I assume I have to create
>> an alternative userobject and I would be more than happy to see a
>> working FE extension that creates pages (properly) and without a
>> logged-in BE user :-)
>
> Indeed, you can pass the start() method an alternative user object.
After a few more hours spent today... still no success :-(
> It can be as simple as:
> $myBackendUser = t3lib_div::makeInstance('t3lib_userAuth');
I assume this has to be an instance of t3lib_beUserAuth because the
t3lib_userAuth class is abstract, so:
$myBackendUser = t3lib_div::makeInstance('t3lib_beUserAuth');
t3lib_beUserAuth extends t3lib_userAuthGroup which extends
t3lib_userAuth.
> $myBackendUser->user['uid'] = 0;
> $myBackendUser->user['username'] = 'myExtBeUser';
> $myBackendUser->user['admin'] = TRUE;
> $myBackendUser->user['uc']['recursiveDelete'] = FALSE;
I also tried the call the start() method:
$myBackendUser->start();
Then I create my data array for the new page:
$pageDetails = array(
'pages' => array(
'NEW'.t3lib_div::shortMD5(time()) => array(
'title' => 'new test page '.time(),
'pid' => 1,
)
)
);
...make an instance of t3lib_TCEmain and feed the start() method with
the BE user object:
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = 0;
$tce->start($pageDetails, array(), $myBackendUser);
$tce->process_datamap();
The result is an entry in sys_log:
"Attempt to insert record on page 'test' (1) where this table, pages,
is not allowed (msg#1.1.11)"
The page with uid=1 (the pid of my new page) has been set to read/write
permissions for everyone for testing purposes.
Any ideas what else I can check? I am using TYPO3 4.6.9.
Thanks for your help!
Cheers
Michael
More information about the TYPO3-dev
mailing list