By Daniel Pierce on Saturday, 01 October 2016
Posted in Technical Issues
Likes 0
Views 251
Votes 0
Stack Ideas,

Currently an administrator is able to send a reminder e-mail to a user who has not activated their subscription after creating an account with the EasySocial User Administration section. This works just fine, but is a huge distraction for the site administrator and doesn't get done as often as it should.

QUESTION
Is there a way that a CRON job could be created to periodically go through the list of user who have not activated their subscription and send them a reminder e-mail?

IF NOT, WOULD THE FOLLOWING BE POSSIBLE
Just wanted to see if this is possible with the current product by creating a script that would do the following based on a specific user_id.


require_once ( JPATH_BASE . 'administrator' . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'easysocial.php' );
require_once ( JPATH_BASE . 'administrator' . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'user' . DS . 'user.php' );

$config = JFactory::getConfig();
$app = JFactory::getApplication('site');
$app->initialise();

// Get USER
$user = ES::user($user_id);

// Send Re-Activation E-mail
$model = FD::model('Registration');
$model->resendActivation( $user );




Thanks
Dan
Hello Daniel,

Assuming that you are on 1.4.x, there is a settings which allows the system to automatically send reminder e-mails.

1. Go to Settings > Users
2. Change the settings as shown here, http://take.ms/B6zN1

When the cronjob kicks in, it'll process this as well but keep an eye on this as some users did provide us feedback that their e-mail got flagged as a "spammer" because the system is sending them such e-mails.
·
Saturday, 01 October 2016 02:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Stack Ideas,

Thank you for your response. Unfortunately, the feature you referenced takes two weeks before it triggers and then sends a message to everyone who has been inactive instead of just the users that have not completed registration. If you want two weeks, the user has moved on to something else.

This shouldn't be very hard to do so I wrote the attached script which is allowing me to create a Activation Reminder e-mail in EasySocial, HOWEVER for some reason the URL address that is being put in the Activate Now button and Avatar is not putting the correct URL, but everything else is working just great. Here is what I'm getting.

ACTIVATE NOW BUTTON
href="https://saverhealth.com/api/co-op-dashboard/registration?task=activate&token=4f1ee484510a3b77275254f3148512ab&controller=registration";

should not include the /api/ directory, but that is where I'm running the script from.

I displayed the definition for JPATH_ROOT and it is correct at /var/www/html/
The link in "The Activation Page" is correct and all the other images are correct.

Don't know why script is inserting script directory as the root instead of JPATH_ROOT.
It is like all the paths that are generated by the calls don't have the correct path, but the ones generated by the e-mail script are correct.

I know you don't debug scripts, but I would appreciate if you could point me to where I should look.

I've attached the script and the send Reminder E-mail HTML that is delivered.
Being able to send activation reminders would be a very valuable administrator tool.

Thanks for the help.
Dan
·
Tuesday, 04 October 2016 05:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Stack Ideas,

Thank you for your response. Unfortunately, the feature you referenced takes two weeks before it triggers and then sends a message to everyone who has been inactive instead of just the users that have not completed registration. If you want two weeks, the user has moved on to something else.

This shouldn't be very hard to do so I wrote the attached script which is allowing me to create a Activation Reminder e-mail in EasySocial, HOWEVER for some reason the URL address that is being put in the Activate Now button and Avatar is not putting the correct URL, but everything else is working just great. Here is what I'm getting.

ACTIVATE NOW BUTTON
href="https://saverhealth.com/api/co-op-dashboard/registration?task=activate&token=4f1ee484510a3b77275254f3148512ab&controller=registration";

should not include the /api/ directory, but that is where I'm running the script from.

I displayed the definition for JPATH_ROOT and it is correct at /var/www/html/
The link in "The Activation Page" is correct and all the other images are correct.

Don't know why script is inserting script directory as the root instead of JPATH_ROOT.
It is like all the paths that are generated by the calls don't have the correct path, but the ones generated by the e-mail script are correct.

I know you don't debug scripts, but I would appreciate if you could point me to where I should look.

I've attached the script and the send Reminder E-mail HTML that is delivered.
Being able to send activation reminders would be a very valuable administrator tool.

Thanks for the help.
Dan
·
Tuesday, 04 October 2016 05:31
·
0 Likes
·
0 Votes
·
0 Comments
·
Stack Ideas,

Wanted to add one more thing. When I run the script and display JURI::root() it come back "https://saverhealth.com/api/" which is incorrect.

This must be caused because I'm not running the script as part of the joomla site. Is there a way to execute the script via CRON or some other mechanism where Joomla would consider it to running for the site?

So I know the issue, just need direction on the best way to resolve.

Thanks
Dan
·
Tuesday, 04 October 2016 05:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey there,

I already checked in your code, but I feel something is not good enough, can you try download my attached screenshot below and put into this file location -> JoomlaFolder\administrator\components\com_easysocial\includes\cron\hooks\remindActivationEmail.php , it should follow what cron time interval you set then it will send out email reminder for those user haven't activate their user account in your site.
·
Tuesday, 04 October 2016 23:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Arlex,

Thank you for the code to resendActivation.

QUESTION: My cron script runs every 5 minutes to send e-mails. If I put the file in the location you defined, will it send a reminder every time that the cron job runs?

Is there a way to define the cron job to specifically run the remindActivationEmail.php on a different schedule, like once per day? Or maybe mark when the reminder had been sent and then wait for a specific period.

Thanks
Dan
·
Wednesday, 05 October 2016 11:30
·
0 Likes
·
0 Votes
·
0 Comments
·
QUESTION: My cron script runs every 5 minutes to send e-mails. If I put the file in the location you defined, will it send a reminder every time that the cron job runs?

Yes.

Is there a way to define the cron job to specifically run the remindActivationEmail.php on a different schedule, like once per day? Or maybe mark when the reminder had been sent and then wait for a specific period.

Then you have to download my following file and replace into your site :
JoomlaFolder\components\com_easysocial\easysocial.php
JoomlaFolder\administrator\components\com_easysocial\includes\cron\cron.php

Then setup your cron command to run this URL :
http://site.com/index.php?option=com_easysocial&customtask=reminder

So you can do the separate cron process and set what time interval you want.
·
Wednesday, 05 October 2016 22:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Arlex,

Wanted to let you know that the modules you provided are working like a champ.

Hope you can include them as part of a future release. Great feature.

Dan
·
Tuesday, 11 October 2016 23:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

I will discuss with our team and see how it goes. But for now you have to backup those file before you update to next version in the future.

As a gentle reminder, kindly start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiry. I will lock and mark this thread as resolved.
·
Tuesday, 11 October 2016 23:56
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post