[TYPO3-dev] create fe_user within extension

Wolfgang Klinger wolfgang at stufenlos.net
Tue Jan 10 09:47:41 CET 2006


 Hi!

 On Mon, 09 Jan 2006, Bernd Goldschmidt wrote the following:
> I created an typo3-extension (BE-module) to import a bunch of
> "persons" into a database table (via xml) which then get displayed in
> a frontend-plugin. For every imported person, i need a frontend user,
> which should be created automatically upon import. Is there a function
> to create a fe_user? I bassically need a function that takes a
> username, password, pid and groupid and creates the according user
> (return the uid of it if possible).

 You can/should use the tcemain methods documented here:
 http://typo3.org/documentation/document-library/doc_core_api/Database_t3lib_TCEm/

 example:
----
// the key is 'NEW' + some random number (unique)
$data['fe_users']['NEW12345'] = array(
    'username' => 'mustermann',
    'name' => 'Max Mustermann',
    'pid' => "13",
// .... and so on
);
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->start($data, array());
$tce->process_datamap();
----

 to access the new ID grep for "substNEWwithIDs" in the source...
 (you may use the processDatamap_afterDatabaseOperations hook,
 take a look at: 
 http://typo3.org/development/articles/how-to-use-existing-hooks/)


 kind regards
 Wolfgang





More information about the TYPO3-dev mailing list