Automated autologin link creation and emails¶

It is possible to send automatically generate autologin links to users that are registering to your website. This can be set up through the addon’s settings page:

Autologin addon settings page selected in the sidebar

The settings page selected in the sidebar¶

The settings page is split in two sections:

  • The upper section allows configuring if autologin links are generated when a user registratis and whether an automated email is sent.

  • The lower part contains the email template for the email that is sent to users registering on your website if email sending is enabled in the upper section of the page.

Autologin addon settings page selected in the sidebar

The autologin addon’s settings page¶

User registration configuration¶

There are two options that control what to do when a new user registers. If the first option Create link when a new user registers is checked, the Wordpress website will generate a autlogin link automatically for each newly registered user.

If the second option Send newly created login link to user is also checked, the login link will automatically be send to the newly registered user using the email template in the lower part of the settings page. Not that both options have to be checked for emails to be sent. Also note that the email with the autologin link will be sent in addition to the regular registration email that Wordpress sends.

The email template¶

The emails template allows you to customize the contents of the email that is sent to users. Currently, there are a lot of limitations with the template syntax and supported features 1:

  • Only text emails are supported

  • No templating interaction with other email plugins

  • Template syntax does not use the Wordpress tag-syntax

The email template is a simple text box that contains text and tags that will be used to render the final email. An example of the sent email is rendered on the right side of the editor with all recognized tags substituted for example values. When a real user registers, these will be substituted by the corresponding values of the registering user.

Placeholders for values are formatted similar to how PHP formats variables: $name or $different_name("option"). All values that look like these will be substituted for other values. To escape strings that look like these strings, use the $e("$escape") operator (see table below).

The body of the email will be rendered and sent as is. It is possible to include a subject line by prefixing the first line with “Title:”. The rendered string that follows will be used as the email subject.

Template values¶

The following table includes all recognized value names that can be used in an email as placeholders for values:

Tag

Description

$site_name

Renders the name of the wordpress page

Example values

My first blog

$site_url

The URL this wordpress website is availabe at

Example values

https://craftware.info/

$autologin_site_url

The URL this wordpress website is availabe at including the user’s autologin-link

Example values

https://craftware.info/?autologin_code=00000000000000000000

$user("value")

Renders as userdata of the registering user. value can be any of the following strings: firstname, lastname, user_login, user_email, user_nicename.

Example values

  • $user("firstname")

    John

  • $user("user_email")

    john@craftware.info

$make_link or $make_link("path")

This tag allows to add a generated autologin link to arbitrary subpaths of your website. The default behavior of $make_link without any arguments will render the same url as $autologin_site_url.

However, if you include the path-argument, the user’s autologin link will be appended to that subpath. If the user uses that link to login to your website, he/she will be sent to the subpage you linked instead of the main page.

Example values

  • $make_link("/subpage/1")

    https://craftware.info/subpage/1?autologin_code=00000000000000000000

  • $make_link("/complex?q=1#section")

    https://craftware.info/complex?q=1&autologin_code=00000000000000000000#section

$e("value")

Escapes the given value and renders it verbatim.

Example values

  • $e('$user("value")')

    $user("value")

Add user for administrators¶

In addition to the general settings of the addon that act on general user registrations, the adminstrator’s “Add User”-form also contains two new buttons that allow generating and sending of autologin links for newly registered users. They work the same as the general settings buttons but only apply to a single user registration. The email that is sent to the users registered though the admin interface is the same that is configured on the addon’s settings page.

Two new buttons are added to the "Add User" form for site admins.

The two new buttons on the administrator’s “Add New User” form¶

Footnotes

1

The email features are very limited right now because they rely on custom email code. I decided that it is more efficient to handle email sending using other plugins. The goal will be to exchange the current email feature with a more robust implementation that relies on other plugins to send the actual emails. This is a planned after-release improvement.

Autologin Links Addon

Navigation

  • Installing the addon
  • Bulk editing of login links
  • Automated autologin link creation and emails
    • User registration configuration
    • The email template
    • Add user for administrators
  • Multisite behavior
  • Problems

Related Topics

  • Documentation overview
    • Previous: Bulk editing of login links
    • Next: Multisite behavior

Quick search

©2020, Paul Konstantin Gerke. | Powered by Sphinx 3.2.1 & Alabaster 0.7.12 | Page source