以下は電子メールメッセージで使用できるショートコードの一覧です。注記: 一部のショートコードは管理メッセージでのみ利用可能であり、適切な情報が送信されているかはあなた宛てのメールで確認します(例えば、登録メールから [password] を削除するとユーザーはパスワードを受信しないためログインできなくなります)。プラグインと共にこれらの各メッセージのデフォルトがインストールされ、利用可能なメッセージの例が表示されます。

  • [blogname] – [設定 > 一般] で指定したサイトのタイトル
  • [username]
  • [password]
  • [email] – ユーザーが登録したメールアドレス
  • [reglink] – ユーザーが登録したページへのリンク (ユーザーが登録したコンテンツへ直接戻るのに役立ちます)
  • [user-profile] – ユーザーがパスワードや登録情報を更新できるユーザープロフィールページへのリンク
  • [exp-type] – 有効期限タイプ (サブスクリプション/トライアル) 。PayPal サブスクリプションモジュールが使用されている場合のみ利用可能
  • [exp-date] – 有効期限 。PayPal サブスクリプションモジュールが使用されている場合のみ利用可能
  • [login] – ログインページへのリンク。プラグインのメイン設定でログインページが定義されている場合のみ利用可能
  • [register] – 登録ページへのリンク。プラグインのメイン設定で登録ページが定義されている場合のみ利用可能
  • [confirm_link] – ユーザー確認設定が有効になっている場合、ユーザーがメールを確認するためのリンクが挿入されます
  • [reset_link] – 「新機能」のパスワード リセット プロセスが有効になっている場合、ユーザーが新しいパスワードを設定するためのリンクが挿入されます
  • さらに、フィールドタブ画面にあるフィールドオプションの名前/メタキーに基づいて、任意のカスタムフィールドを使用できます (「user_login」と「user_email」を除く)。
  • [fields] – 管理者への通知でのみ使用可能。登録フィールドの一覧
  • [user-ip] – 管理者への通知でのみ使用可能。ユーザーが登録した時の IP アドレス
  • [activate-user] – 管理者への通知でのみ使用可能。そのユーザーのプロフィールページへのリンク。リンク先でユーザーをアクティブ化できます(承認制登録の場合に使用します)。

任意のフィールドのオプション名をユーザー宛と管理者宛の両方への電子メールでショートコードとして使用できます。したがってオプション名が「my_field」のカスタム フィールドがある場合は、これをメール内で [my_field] として使用できます。

これ以外のカスタムショートコードが必要な場合は、wpmem_email_shortcodesフィルターを使用してカスタムショートコードを追加できます。

いくつかの考慮すべき重要な点:

プラグインと共にデフォルトの設定とデフォルトの電子メール本文がインストールされます。プラグインの使用方法に応じてメールの内容を意味のあるものに変更する必要があるかもしれません。ここでは考慮すべき重要な点がいくつかあります。

  1. ショートコードを必ず使用する必要はありません (ただし、パスワードについては後述の#2 に注意してください)。 電子メールの本文内でどこかへのリンクをベタ書きしても全く問題ありません。ショートコードはそういった作業の一部を補助するものにすぎません。 デフォルトの電子メールサンプルは単なる例です。サンプルに何かが含まれているからといってそれを使用しなければならないという訳ではありません。 このサンプルが気に入らない場合は変更して構いません。
  2. 登録処理にパスワードフィールドを追加し、なおかつ管理者の承認を用いて登録を承認制にするようにプラグインを設定している場合は、「ユーザーが承認されました」メールでパスワードを送信することはできません。この構成でユーザーのログイン資格情報のコピーを電子メールで送信する場合は、最初のウェルカムメールでそれを行う必要があります。 つまりデフォルトの電子メールに含まれるフィールドにいくつかの変更を加える必要があります。
  3. ユーザーへの最初のメールにはユーザープロフィールページへのリンクが含まれています。 ただし、これはユーザープロフィールのショートコードを使用してリンクを記述し、なおかつプラグインの設定でユーザープロフィールページの URL の場所を指定していることを前提としています。指定していない場合、ユーザーへのメールではこのフィールドは空白になります。
  4. 管理者通知メールにはデフォルトでアクティベーションリンクのショートコードの例が記載されています。これは承認制登録が有効になっていることを意味するものではありません。承認制登録を使用している場合はこのリンクが必要になりますが、そうでない場合は自由に削除してください (管理者通知メールにユーザープロフィールへのリンクを記載したい場合は除く)。

ユーザーへのメールにプラグイン外部から追加の動的コンテンツを含める必要がある場合、これに使用できるフィルタがあります

原文を見る

The following is a list of shortcodes that may be used in the email messages.  Note: some shortcodes are only available in the admin message, and it is up to you to make sure that proper information is sent (i.e. if you remove [password] from the registration email, the user will not receive a password and thus not be able to login).  The plugin installs with defaults for each of these messages to provide you with an example of what is available.

  • [blogname] – the Site Title you have specified under Settings > General
  • [username]
  • [password]
  • [email] – the email address the user registered with
  • [reglink] – a link to the page the user registered on (useful to return a user directly to the content they registered to view)
  • [user-profile] – a link to the user profile where the user can update their password or registration information
  • [exp-type] – expiration type (subscription/trial) [available only if the PayPal Subscription Module is used]
  • [exp-date] – the expiration date [available only if the PayPal Subscription Module is used]
  • [login] – link to the login page if a login page is defined in the plugin’s main settings
  • [register] – link to the registration page if a registration page is defined in the plugin’s main settings
  • [confirm_link] – includes a link for the user to confirm their email when the user confirmation setting is enabled
  • [reset_link] – includes a link for the user to set a new password when the “new feature” password reset process is enabled
  • Additionally, any custom field is available based on the field’s option name/meta key found in the Fields tab (excludes “user_login” and “user_email”)
  • [fields] – admin notification only – a list of any of the registration fields
  • [user-ip] – admin notification only – the user’s IP address when they registered
  • [activate-user] – admin notification only – a link to the user profile page so they can be activated (used if moderating registration)

Any field option name can be used as an email shortcode in both emails to users and admins.  So if you have a custom field with the option name “my_field” you can use this in the email as [my_field].

If you have a need for a custom shortcode beyond this, custom shortcodes can be added with the wpmem_email_shortcodes filter.

Some important things to consider:

The plugin installs with certain default settings and email content.  Based on your chosen way of using the plugin, you may need to alter the email content to make sense. Here are some important considerations.

  1. You are not required to use any of the shortcodes (although note #2 below about passwords).  If you want to hardcode a link to something in the email content, that is perfectly fine.  The shortcodes are just a helper for some of these items.  The default example emails are just examples.  Just because something is in the example doesn’t mean you have to use it.  If you don’t like the example, change it.
  2. If you have added a password field to the registration process AND you have set the plugin to moderate registrations for admin approval, you cannot send the password in the “user is approved” email.  If you intend to email a copy of the user’s login credentials in this configuration, you MUST do it in the initial welcome email. That means you will need to make some changes to the fields that are included in the default emails.
  3. The User Profile link is included in the initial email.  However, this is assuming that you have set up a user profile page using the user profile shortcode and have noted the URL location of this page in the plugin’s settings.  If you have not done that, this field will be blank in the message to the user.
  4. The admin notification email by default includes an example of the activation link shortcode.  This does not mean that moderated registration is turned on.  If you use moderated registration you will want this link, but if you do not, feel free to just take it out (unless you would like to have a link to the user profile included in the admin notification email).

If you have additional dynamic content from outside the plugin that needs to be included in your email to a user, there are filters available for this.

https://rocketgeek.com/plugins/wp-members/docs/customizing-emails/email-shortcodes/