I want to export users list with all custom fields. I have tried the Users Export module but its export only below fields:
- uid
- name
- created
- access
- login
Is there any solution to solve this problem?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI want to export users list with all custom fields. I have tried the Users Export module but its export only below fields:
Is there any solution to solve this problem?
You can use the Drush Entity module:
With drush entity you can query the entity system available for Drupal 8, 7 and (some of) 6.
Getting all users with some fields:
drush entity-read user `drush entity-read user` --fields=uid,mail,name,created,access,login
Getting one user with all the fields:
drush entity-read user 1 --fields=* --format=json
Getting all the users with all the fields:
drush entity-read user `drush entity-read user` --fields=*
Getting some users with some fields:
drush entity-read user 1 2 --fields=uid,mail,name,created,access,login --format=export
Output (for the last command):
1 [email protected] admin 1353518169 1470089957 1469713365
2 [email protected] webadmin 1353518169 1470089957 1469713365
If you want to try with another options you can read this page: http://build2be.com/content/drush-entity-support-patch-needs-review
There are many option to achieve this.
You can create a user view and use Views data export module for export.
Another option to achieve this is Data export import module.
Install the Forena module (disclosure: I'm a co-maintainer of it) and start from the "Active Users" report (part of Drupal Administration report category) which is delivered with it. Here is a sample output of it:
+-----------+-----------------------+-------------------------+---------+
| User | Email | Last Logged in | Actions |
+-----------+-----------------------+-------------------------+---------+
| Webmaster | [email protected] | Sun, 03/27/2016 - 18:39 | logs |
| Admin | [email protected] | Thu, 04/07/2016 - 12:47 | logs |
| Pierre | [email protected] | Fri, 04/01/2016 - 18:19 | logs |
+-----------+-----------------------+-------------------------+---------+
Next, just customize this reports, or create a clone from it that fits your needs. For example by using the query writing tool that comes with Forena, which is called the Forena Query Builder. This is a separated (sub-)module which can be enabled as per standard Drupal instructions to enable an additional module. For a video tutorial about this query writing tool, checkout Define data blocks with optional filters. Add any of the "custom fields" (as in your question) you want.
For the report you create, set the appropriate "document types" that fit your needs. Such as CSV, XLS, PDF, XLS, etc. For those document types you enable, an authorized report user will be able to click a hyperlink to export the report (in this case the list of users with the custom fields you added), in any of the formats you enabled within document types. Should you rather want JSON or XML format (as export format), that is also possible (just a slightly different approach, which is typically restricted to selected user roles only).