Using Autologin With WordPress
Overview
The ActiveMember360 Autologin module allows logged in users on one WordPress ActiveMember360 site (the FROM site) to autologin to another WordPress ActiveMember360 site (the TO site) using an autologin URL within an HTML link, providing both sites connect to the same ActiveCampaign application.
Usage
The URL used for autologin is constructed using your site URL and parameters.
A sample of the URL structure required is as follows:
site_url/?mbr_autologin=my_security_code&id=[mbr_db_id]
When secure mode is enabled, you must pass both, the contact ID and the contact email address:
site_url/?mbr_autologin=my_security_code&id=[mbr_db_id]&email=[mbr_db_email]
The ActiveCampaign contact must already exist within both WordPress sites as a user for the autologin URL to function. Otherwise the contact will not be logged in.
The autologin URL is used in HTML links on the WordPress site the user will be currently logged in to i.e. the FROM site not the TO site.
Site URL & Parameters
Site URL | Description |
---|---|
site_url | The WordPress site URL where the user is to be automatically logged in i.e the TO site. This can be found in WordPress, Settings, General, Site URL. It must be specified exactly as shown there. Default: none. Required: yes. |
Parameters | Description |
---|---|
mbr_autologin | Set to the security code used to validate an autologin. The security code used must be defined as detailed in ActiveMember360, Settings, Security, Security Codes. This code must be defined on the TO site. Default: none. Required: yes. |
The ActiveCampaign contact email address of the contact to be logged in. Permitted value: [mbr_db_email] Default: none. Required: dependent upon use case, see Examples. | |
id | The ActiveCampaign contact ID of the contact to be logged in. Permitted value: [mbr_db_id] Default: none Required: dependent upon use case, see Examples. |
add_tags | One or more tag ID's defined within ActiveCampaign to add to this contact during the auto-login process. If more than one is entered, please separate with commas. Tag ID's can be determined as explained in Determine ActiveCampaign Tag IDs. Default: none. Required: no. |
remove_tags | One or more tag ID's defined within ActiveCampaign to remove from this contact during the auto-login process. If more than one is entered, please separate with commas. Remove tags are processed before add tags. Tag ID's can be determined as explained in Determine ActiveCampaign Tag IDs. Default: none. Required: no. |
assign_automations | One or more automation ID's defined within ActiveCampaign to which the contact should be added during the auto-login process. To assign to multiple automations, separate them with commas. Automation ID's can be determined as explained in Determine ActiveCampaign Automation IDs. Default: none. Required: no. |
remove_automations | One or more automations ID's defined within ActiveCampaign from which the contact should be removed during the auto-login process. To remove from multiple automations, separate them with commas. Remove automations are processed before assign automations. Automation ID's can be determined as explained in Determine ActiveCampaign Automation IDs. Default: none. Required: no. |
subscribe_lists | One or more list ID's defined within ActiveCampaign to which the contact should be subscribed during the auto-login process. To subscribe to multiple lists, separate them with commas. List ID's can be determined as explained in [Determine ActiveCampaign List IDs][utilities-data-lists]. Default: none. Required: no. |
unsubscribe_lists | One or more list ID's defined within ActiveCampaign from which the contact should be unsubscribed during the auto-login process. To unsubscribe from multiple lists, separate them with commas. Unsubscribes are processed before subscribes. List ID's can be determined as explained in Determine ActiveCampaign List IDs. Default: none. Required: no. |
redir | Sends the user to the URL of your choice after a successful login. To use URL parameters with the redirect URL please refer to [Using URL parameters with the Autologin module redir parameter][autologin-redirect-url-parameters]. This is a location on the TO site. Default: none. Required: no. |
nofirstlogin | Ignore First login redirect specified in ActiveMember360, Settings, Login, Page redirect on first login. This is a setting on the TO site. Permitted values: Any value will ignore first login Default: none. Required: no. |
When using the email parameter an email address can only contain the plus character + if it is URL encoded i.e. replaced by %2B.
Otherwise it will be decoded by the PHP $_GET into a space and break the autologin URL.
For this reason we recommend that the id parameter is used rather than email parameter.
The adding/removing of tags, assigning/removing of automations and subscribing/unsubscribing to lists will be processed irrespective of whether the autologin is successful.
Examples
In all examples my_security_code must be replaced by a security code defined in ActiveMember360, Settings, Security, Security Codes on the TO site.
- Example 1
- Example 2
- Example 3
Upon a successful login they will either be redirected to the home page, or to the appropriate page defined in ActiveMember360, Settings, Memberships, Redirect on login or if it’s their first login to the page selected in ActiveMember360, Settings, Login, Page redirect on first login:
https://yoursite.com/?mbr_autologin=my_security_code&id=[mbr_db_id]
When secure mode is enabled, you must pass both, the contact ID and the contact email address:
https://yoursite.com/?mbr_autologin=my_security_code&id=[mbr_db_id]&email=[mbr_db_email]
Upon a successful login they will either be redirected to the page with the slug dashboard, or if it’s their first login to the page selected in ActiveMember360, Settings, Login, Page redirect on first login :
https://yoursite.com/?mbr_autologin=my_security_code&id=[mbr_db_id]&redir=https://yoursite.com/dashboard
When secure mode is enabled, you must pass both, the contact ID and the contact email address:
https://yoursite.com/?mbr_autologin=my_security_code&id=[mbr_db_id]&email=[mbr_db_email]&redir=https://yoursite.com/dashboard
Upon a successful login they will be redirected to the page with the slug dashboard:
https://yoursite.com/?mbr_autologin=my_security_code&id=[mbr_db_id]&nofirstlogin=yes&redir=https://yoursite.com/dashboard
When secure mode is enabled, you must pass both, the contact ID and the contact email address:
https://yoursite.com/?mbr_autologin=my_security_code&id=[mbr_db_id]&email=[mbr_db_email]&nofirstlogin=yes&redir=https://yoursite.com/dashboard