Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Key:
"Name"
* 'id'
* (description)
Properties
"User ID"
- 'uid'
- (The unique ID of the user account.)
"Name"
- 'name'
- (The login name of the user account.)
"Email"
- 'mail'
- (The email address of the user account.)
"URL"
- 'url'
- (The URL of the account profile page.)
"Edit URL"
- 'edit_url'
- (The url of the account edit page.)
"Last access"
- 'last_access'
- (The date the user last accessed the site.)
"Last login"
- 'last_login'
- (The date the user last logged in to the site.)
"Created"
- 'created'
- (The date the user account was created.)
"User roles"
- 'roles'
- (The roles of the user.)
"Status"
- 'status'
- (Whether the user is active or blocked.)
"Default theme"
- 'theme'
- (The user's default theme.)"
To check if a user is logging in for the first time, check if the 'last_login' property is empty. Here is an example with Rules:
{ "rules_first_login_test" : {
"LABEL" : "First login test",
"PLUGIN" : "rule",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "user" : { "label" : "User", "type" : "user" } },
"IF" : [ { "data_is_empty" : { "data" : [ "user:last-login" ] } } ],
"DO" : [ { "drupal_message" : { "message" : "True" } } ]
}
}