Code Monkey home page Code Monkey logo

plg_user_notifyactivation's Introduction

Notify Activation

A Joomla plugin to add notes to user accounts when the account is activated.

If you like this extension, please review it at the Joomla Extensions Directory: https://extensions.joomla.org/extensions/extension/clients-a-communities/user-management/notify-activation

Introduction

This is a plugin for Joomla that triggers the system to create a user note when an account is activated.

The generated user note will allow site administrators to see at a glance when and how a user account was activated.

This can be useful for reference and for resolving disputes and queries about account activation.

There are numerous ways that an account can be activated, depending on the setting of the User component config setting "New User Account Activation".

Activation setting 0: "None"

  • Immediate activation: Site is configured to activate accounts as soon as they are registered.

Activation setting 1: "Self"

  • Self activation: User clicks on the activation link provided in his welcome email after registration.

Activation setting 2: "Administrator"

  • Self verification: User clicks on the verification link provided in his welcome email after registration. This does not activate the account, but triggers a further email to be sent to the site administrators.
  • Admin activation: One of the site administrators then clicks on the link in their email to activate the account.

Account activation via the admin panel.

  • Admin-created accounts: An account is created by a site administrator from within the admin panel. Accounts created this way are active immediately on creation.
  • Manual activation: An admin user clicks the tick icon in the 'Activated' column of the user list to activate an account manually.

All six of these events are recorded by the plugin, giving different messages in the user note that is generated. The text of the notes can be configured in the plugin's config page.

Where the action is carried out by someone other than the account holder, the notes try to include information about who that person was. This applies to the actions done by admin users. In the case of the two actions done on the admin panel, the system can work this out by getting the user details for the logged in admin user. However in the case of the admin activation link, the admin user does not need to be logged in for it to work. All admin users are sent the same link, so for this event we cannot tell which admin user completed the activation; just that it was done by one of them. The other events done by admin users do require the admin user to be logged in, and thus the plugin can report who did them.

In addition, as of version 2.1, the plugin can also send users an email notifying them of their account being created or activated by an administrator. And in 2.2, the site administrators can be notified by email as well.

Version History

  • 1.0.0 2016-07-03: Initial release.
  • 1.0.1 2016-07-14: Bug fixes: Now works in all three scenarios.
  • 2.0.0 2016-12-13: Made it work with the "Administrator" option for new account activation.
  • 2.1.0 2017-01-30: Added ability to send activation emails.
  • 2.2.0 2017-02-06: Activation emails can now go to either the end user or to admin users (or both).
  • 2.4.0 2020-07-04: French and Russian translations now included.

Installation

This is a standard Joomla plugin. Installation is via Joomla's extension manager.

Usage

The plugin has several parameters:

  • User note category - This parameter allows you to specify which user notes category the generated notes should be created in. Leave blank for the default 'Uncategorised'.

  • Several note text fields - these fields hold the text

  • Subject Text - this is the text that will be used for the for the subject text on the user notes.

There is also a second configuration tab, for emails. This tab has three toggle switches that allow you to set the plugin to send emails to the end user when their account is activated by the administrator, either by the administator creating the account manually, activating the account via an email link, or directly in the admin panel. You can also use these switches to send notification emails to all the admin users of the system.

Note: You should only enable these switches if your system does not already send emails to notify the user of account activation in these three cases. Depending on your Joomla config and other plugins, you may not need all of these switches enabled.

The email that is sent to users in response to these three events uses the same text as Joomla's built-in account activation notification. This default text is copied from the standard language translation files provided with Joomla, but independant translations are provided by the plugin. If you wish to override it, the relevant translation IDs can be found in the en-GB.plg_user_notifyactivation.ini file provided with this plugin.

Credits

  • The plugin was written by Simon Champion.
  • Russian translation provided by Github user https://github.com/birdkiwi
  • French translation provided by Mihàly Marti alias Sarki.

Huge thanks to the contributors.

Limitations

The plugin is obviously only going to be useful if your Joomla site requires user accounts to be activated. If you set the site to not require account activation, the plugin will still function but will produce erroneous user notes.

The feature to send an activation email to the user is only available for activation events that are triggered by the admin. In addition, some of these events may trigger an email to the user already, depending on your site config. It is also possible that future Joomla updates or other plugins may add similar functionality which could also result in emails being sent twice. It is up to the site administrator to ensure that your site is configured to only send one email for each event.

Motivation

This plugin was written from scratch after attempting to resolve a user query over account activation. The account had been activated but the user claimed not to have done so himself and none of the site admins had done it either. We were unable to answer the question. Having the functionality in this plugin would have helped to resolve this.

To Do

  • Move the message strings into a language translation file rather than having them as config settings.
  • Add text to the end of the notes stating that they were generated by the plugin.

Caveats

  • When upgrading, if the note text does not appear, or appears incorrectly, try going to the plugin config page and hitting 'Save'.
  • With regard to the note generated when an admin user clicks an email link to activate an account: The plugin cannot know which admin user does this, so it can't specify them in the note text as it does for other events done by an admin user.

License

As with all Joomla extensions, this plugin is licensed under the GPLv2. The full license document should have been included with the source code.

plg_user_notifyactivation's People

Contributors

birdkiwi avatar spudley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

plg_user_notifyactivation's Issues

Incorrect Date/Time on Note

First off, thank you for this code. I'm using it to activate an account on a 3rd party server when a user clicks the validate link in the user email activation.... You've done all the hard work and saved me a ton of time.

Using this in the code
'created_time' => date('Y-m-d H:i:s')
Is writing UTC or some other time into the record, which is not the correct local time.

I've fixed this in my copy of your code by adding this to the top

use FOF30\Date\Date;

and then where I need the correct time

// Get current date and time in database format
JLoader::import('joomla.utilities.date');
$now = new Date();
$now = $now->toSql();

Finally when inserting
'created_time' => $now

I believe that FOF30 is part of Joomla core, but alack it could be part of admintools.

Sending HTML mail

Hello,
Is it possible to set up that the emails will be sent in HTML format?

User doesn t get notified when i enable via the backend

Hello Friend

If i paid you some money could you spare and spend some time into the issue to get it fixed?

I use rsforms pro to register users and i want a plugin to only be used to send emails to users when their account gets approved via the backend

Optimise (and FIX) the whole process

Hi.

My Joomla activation process is the following:

  1. User registers, e-mail is sent to the user
  2. He receives an e-mail with a link to validate his e-mail
  3. Once user has validated his e-mail, all Admins receives an email to activate account
  4. If the account is activated by an admin trough the link on that e-mail requesting user account activation, notes are added by the plugin

It would be helpful if a note is added on step 2, since we never know if the user has validated his email on the admin panel.

So the note User activated their own account via the link in the activation email should be added on step 2, actually, it fires only AFTER step 3 (once the whole account has been activated).

But, that note is not correct, as the user has been activated by an Admin after he (admin) have received an email like:

Hello administrator,

A new user has registered at SITE.
The user has verified their email address and requests that you approve their account.
This email contains their details:

Name : TEST
Username: [email protected]

You can activate the user by selecting on the link below:
https://www.example.com/register?task=registration.activate&token=c2d444e2a036ff947f62a701cced06bc

So the note, in this state, should be:

User has been activated by an administrator via the link in the activation email

To clarify the whole process:

STEP 1

User registers, e-mail is sent (by Joomla) to the user

STEP 2

He receives an e-mail with a link to validate his e-mail

Hello TEST,

Thank you for registering at SITE. Your account is created and must be verified before you can use it.
To verify the account select the following link or copy-paste it in your browser:
https://www.example.net/register?task=registration.activate&token=9181eaa63a05cc49e084b4f58087bcd6

After verification an administrator will be notified to activate your account. You'll receive a confirmation when it's done.
Once that account has been activated you may login to https://www.example.net/ using the following username and the password you entered during registration:

Username: myusername

STEP 3

Once user has validated his e-mail, a note like User activated their e-mail address via the link in the activation email, then all Admins receives an email (sent by Joomla) to activate account like:

Hello administrator,

A new user has registered at SITE.
The user has verified their email address and requests that you approve their account.
This email contains their details:

Name : TEST
Username: [email protected]

You can activate the user by selecting on the link below:
https://www.example.com/register?task=registration.activate&token=c2d444e2a036ff947f62a701cced06bc

STEP 4

If the account is activated by an admin trough the link on that e-mail requesting user account activation, a note like User has been activated by an administrator via the link in the activation email is added, OR

STEP 5

If the account is activated by an admin trough the Joomla Admin Panel, a note like User has been activated by %USERNAME% via the administration panel is added

STEP 6

User receives an e-mail (sent by Joomla) confirming that his account has been activated

Hello USERNAME,

Your account has been activated by an administrator. You can now login at https://www.example.net/ using the username USERNAME and the password you chose while registering.

Not sending emails when admin enables the user

1)in a workflow where the admin needs to approve the user in order the user to be enabled and the admin clicks from backend enable instead of activate the user doesn t get an email(not importantsince the we should click activate)

2)if the admin clicks activate via the backend the message that comes through is not the message that we set from the plugin
User was activated by %s via the admin panel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.