[TYPO3-dev] create fe_user within extension
Bernhard Kraft
kraftb at kraftb.at
Tue Jan 10 17:37:38 CET 2006
Bernd Goldschmidt wrote:
> Hi.
>
> After long searches in maillinglists and the web, I finally decided to
> post my question here:
> 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).
I have an extension ready which is able to import OpenOffice .sxc files (Spreadsheets)
directly into any table of T3. Also the fe_users table.
The extension is completly configurable via TSConfig. Each field from the XML (OOfile)
is passed through a stdWrap/cObject - so you can do almost anything you can think of.
I parsed a date given in dd/mm/yyyy to a timestamp which get's filled into a birth field
i added to the table .... completly via TSConfig.
The only drawback currently is that if you change the configuration you will have log out
and in again to apply the changes to the current user (the config gets stored in user/group
TSConfig)
I did it via TSConfig cause the extension works in the BE and there is no TypoScript available.
I didn't do it with page-ts config as the import isn't really bound to a page ...
an example of the configuration i used for import is:
------------------------
plugin.tx_kbsxcimport.fe_users {
table = fe_users
label = Mitarbeiter
required = name,firstname,username
unique = uid
fieldMapping {
pid = TEXT
pid.value = 76
uid = TEXT
uid.field = makey
cruser_id = TEXT
cruser_id.value = 1
username = COA
username {
1 = TEXT
1.value = ###ERROR###
1.if.value.field = login
1.if.value.trim = 1
1.if.value.rawUrlEncode = 1
1.if.equals.field = login
1.if.equals.trim = 1
1.if.negate = 1
10 = TEXT
10.field = login
10.trim = 1
}
password = TEXT
password.value = xxxxx
# password.postUserFunc = user_phpfunc->genpw
# password.postUserFunc.length = 6
usergroup = TEXT
usergroup.value = 2
name = TEXT
name.field = nachname
firstname = TEXT
firstname.field = vorname
title = TEXT
title.field = titel
...
}
------------------------
in the "fieldMapping" cObject you simply define the values for each field from the table you are importing
to.
the fields from the OOfile are available to the cObject using stdWrap.field = fieldname like normally :)
If you require it I could send you the extension (It is not in TER currently as there is no documentation
and I plan to improve it so it can also import M$ XLS directly - which is what I get from the customer)
greets,
Bernhard
More information about the TYPO3-dev
mailing list