Import and export users and customers Shortcodes

Below, you’ll find a detailed guide on how to add the Import and export users and customers Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Import and export users and customers Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Import and export users and customers Plugin and the shortcodes it provides:

Plugin Icon
Import and export users and customers

"Import and Export Users and Customers is a powerful WordPress plugin that allows you to effortlessly import or export users and customers data from CSV files with additional metadata."

★★★★☆ (218) Active Installs: 80000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [import-users-from-csv-with-meta]
  • [export-users]

[import-users-from-csv-with-meta] Shortcode

The ‘import-users-from-csv-with-meta’ shortcode allows users to import user data from a CSV file. It checks user capabilities, validates file upload, and processes the data. It handles various options such as sending emails, assigning roles, updating existing users, and deleting users not present in the CSV. It also supports actions before and after the import process.

Shortcode: [import-users-from-csv-with-meta]

Parameters

Here is a list of all possible import-users-from-csv-with-meta shortcode parameters and attributes:

  • role – Specifies the role to assign to the imported users
  • delete-only-specified-role – If true, only deletes users with the specified role

Examples and Usage

Basic example – Displays the import form with default settings.

[import-users-from-csv-with-meta /]

Advanced examples

Specify a user role for the imported users. This will override the default role set in the plugin settings.

[import-users-from-csv-with-meta role="subscriber" /]

Specify user role and enable deletion of users not present in the CSV file who have the specified role. This can be useful for maintaining a list of users with a specific role.

[import-users-from-csv-with-meta role="subscriber" delete-only-specified-role=true /]

Specify user role, enable deletion of users not present in the CSV file who have the specified role, and assign their posts to a specific user.

[import-users-from-csv-with-meta role="subscriber" delete-only-specified-role=true delete-users-assign-posts="john_doe" /]

Note: In the above example, replace “john_doe” with the username of the user to whom the posts should be assigned.

PHP Function Code

In case you have difficulties debugging what causing issues with [import-users-from-csv-with-meta] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'import-users-from-csv-with-meta', array( $this, 'shortcode_import' ) );

Shortcode PHP function:

Code file location:

import-users-from-csv-with-meta/import-users-from-csv-with-meta/classes/frontend.php

[export-users] Shortcode

The Import Users from CSV with Meta plugin shortcode, ‘export-users’, is designed to export user data. This shortcode allows users with the ‘create_users’ capability to export user data based on certain attributes. The attributes include user role, date range, delimiter type, alphabetical order, column selection, and order by clause. The exported data is presented in a progress bar, showing the percentage of data exported.

Shortcode: [export-users]

Parameters

Here is a list of all possible export-users shortcode parameters and attributes:

  • role – defines the user role to be exported
  • from – sets the start date for user registration
  • to – sets the end date for user registration
  • delimiter – specifies the character to separate fields
  • order-alphabetically – sorts users alphabetically if set
  • columns – selects specific user data to export
  • orderby – determines the data field to sort users by
  • order – sets the sorting order, ascending or descending

Examples and Usage

Basic example – Display an export form for users with role ‘subscriber’

[export-users role="subscriber"]

Advanced examples

Export users from a specific date range, ordered alphabetically and separated by a semicolon.

[export-users role="subscriber" from="2021-01-01" to="2021-12-31" order-alphabetically="yes" delimiter=";"]

Export users with specific columns ‘ID’, ‘user_login’, ‘user_email’ and ordered by ‘ID’ in descending order.

[export-users role="subscriber" columns="ID,user_login,user_email" orderby="ID" order="DESC"]

PHP Function Code

In case you have difficulties debugging what causing issues with [export-users] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'export-users', array( $this, 'shortcode_export' ) );

Shortcode PHP function:

Code file location:

import-users-from-csv-with-meta/import-users-from-csv-with-meta/classes/frontend.php

Conclusion

Now that you’ve learned how to embed the Import and export users and customers Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *