Skip to the content
Documentation

exp:expusercreate

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

Create a user account through the content publish, as the administration does (its workflows and the approval of new accounts run): login, e-mail, names, groups, and a password from standard input, a generated one or the activation mail (a dry run unless --apply)

Usage

./console exp:expusercreate [options]
php bin/php/expusercreate.php [options]
./console exp:user:create [options]

Aliases

exp:user:create

Help

The output of ./console help exp:expusercreate (the script run with --help), without the standard options:

Usage: bin/php/expusercreate.php [OPTION]...
Create a user account
Creates the account as a content object of a user class in its first group and publishes it with
the content/publish operation, exactly as the administration does: its workflows run, so where
new accounts need approval the account waits until it is approved. The other groups are added as
locations. Choose one way to the password: --password-stdin (one line on standard input, never
on the command line), --generate-password (printed once) or --send-activation (the account starts
disabled and gets the activation mail). Without --apply nothing is created: the command lists what
it would do and which checks fail.

./console exp:user:create --login=jane [email protected] --first-name=Jane --last-name=Doe \
    --group=Editors --generate-password --apply
printf '%s\n' "$PASSWORD" | ./console exp:user:create --login=ci-bot [email protected] --group=12 --password-stdin --apply
./console exp:user:create --login=member1 [email protected] --group=Members --send-activation --apply


Options:
  --login=VALUE        The login name (create: of the new account; edit: the new login name)
  --email=VALUE        The e-mail address (create: of the new account; edit: the new address)
  --first-name=VALUE   The first name (the attribute first_name of the user class)
  --last-name=VALUE    The last name (the attribute last_name of the user class)
  --group=VALUE...     A user group by node id or name: list, export and bulk take only its members (below it, at any depth); create and import: the group of the new accounts (repeat for more, the first is the main group; default [UserSettings] DefaultUserPlacement)
  --class=VALUE        The user class of the new account (default the class of [UserSettings] UserClassID)
  --password-stdin     Read the password from standard input (one line), never from the command line (create and reset-password: it must pass the password rules)
  --generate-password  Generate a password that passes the password rules and print it once
  --send-activation    Create the account disabled and send the activation mail; the person sets a password with "Forgot password"
  --disabled           Create the account disabled (enable it later with exp:user:enable)
  --apply              Make the change; without it the command only lists what it would change (a dry run)
  --dry-run            The default, kept for scripts that pass it: list what would change, change nothing
  --as=VALUE           Act as this user (login, e-mail or id; default the user of [UserSettings] UserCreatorID); the audit records it as who did it
  --format=VALUE       text (default) or json (the machine output exp-user/1)

Options

Option Value Description
--login required The login name (create: of the new account; edit: the new login name)
--email required The e-mail address (create: of the new account; edit: the new address)
--first-name required The first name (the attribute first_name of the user class)
--last-name required The last name (the attribute last_name of the user class)
--group required A user group by node id or name: list, export and bulk take only its members (below it, at any depth); create and import: the group of the new accounts (repeat for more, the first is the main group; default [UserSettings] DefaultUserPlacement)
--class required The user class of the new account (default the class of [UserSettings] UserClassID)
--password-stdin - Read the password from standard input (one line), never from the command line (create and reset-password: it must pass the password rules)
--generate-password - Generate a password that passes the password rules and print it once
--send-activation - Create the account disabled and send the activation mail; the person sets a password with "Forgot password"
--disabled - Create the account disabled (enable it later with exp:user:enable)
--apply - Make the change; without it the command only lists what it would change (a dry run)
--dry-run - The default, kept for scripts that pass it: list what would change, change nothing
--as required Act as this user (login, e-mail or id; default the user of [UserSettings] UserCreatorID); the audit records it as who did it
--format required text (default) or json (the machine output exp-user/1)

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/expusercreate.php, kernel/private/classes/commands/expusercreate.php

See also

Generated example: exp:expusercreate

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.