7 years ago
2
Topic

Hello there,

I would like to contribute with Seblod (the best and more complete Joomla extension).

I think "Resend user activation email" feature should be native in joomla, bot It is not. So  I did these instructions if someone else need It too. 

Seblod made It happens so easy!

Here we go:

You will need:

Seblod code pack plugin.(Specifically before store field)

Steps:

1)Create a content type named: Resend_Activation with USERr object

2)Create these fields :

Main Body Position

      res_explanation           Type: Freetext       Storage: none

      res_Email                    Type: text               Storage: none

      res _send                    Type: Submit          Storage: none   Task: Save & New

Hidden Position

      res_id                          Type: text               Storage: none

      res_name                    Type: text               Storage: none

      res_username             Type: text               Storage: none

      res_activation             Type: text                Storage: none

      res_activation_email Type: email              Storage: none

      res_before_store       Type: BeforeStore    Storage: none

You should read this tutorial  to learn how configure email type fields. This is an example text I´ve put in the EDITOR button of email field, but you can change as you want to:

Hello #res_name#,

Your user name to login: #res_username#

Click in the link and activate your account!

#res_activation#

Thank You








In the email field "To (fields):" you shloud use this field: res_email

In the the field res_before_store you must put this code:

$db = JFactory::getDbo(); 
$query = $db->getQuery(true);
$query->select($db->quoteName(array('id', 'name', 'username', 'activation')));
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('email') . ' = '. $db->quote($fields['res_email']->value));
$db->setQuery($query);
$row = $db->loadAssoc();
$app= JFactory::getApplication();
If ($row == NULL) {
          $app->redirect('/index.php?option=com_cck&view=form&layout=edit&type=resend_activation','This email does not exist in site database','warning');
}
elseif ($row['activation']=="") {
          $app->redirect('/index.php?option=com_cck&view=form&layout=edit&type=resend_activation','This account is already activated','warning');
}
$fields['res_name']->value = $row['name'];
$fields['res_username']->value = $row['username'];
$fields['res_activation']->value =JURI::Base()."index.php/component/users/?task=registration.activate&token=".$row['activation'];














You can change the warning messages as you want, and you must set a success message in the content site form view configuration.

If you need that resend email link appears in joomla just after native messages like "Forgot your password?"; "Create an account" you must do an override of this file: joomla_root/components/com_users/login/default_login.php

You mus add this code about the line number 118:


<li>
<a href="/<?php echo JRoute::_('/index.php?option=com_cck&view=form&layout=edit&type=resend_activation'); ?>">
<?php echo JText::_('COM_USERS_RESEND_ACTIVATION'); ?></a>
</li>

Don´t forget to add the string "COM_USERS_RESEND_ACTIVATION" as an override in the joomla backend  language menu.


Enjoy 



Get a Book for SEBLOD
4229 Posts
Kadministrator
7 years ago
1
Level 1

Thnx, you can also post this in the Tutorials so it won't get hidden in the forum.

7 years ago
0
Level 2

Ok, posted!

Get a Book for SEBLOD