By Daniel Pierce on Thursday, 01 February 2018
Posted in Technical Issues
Likes 0
Views 722
Votes 0
StackIdeas,

My EasySocial site is up and running which is great, but now I have the challenge of administering the site.

I have a lot of users that have created accounts, but then refuse to VERIFY the account. I want to clean up the database and can manually Delete each account from the backend, but this is going to be a on going maintenance headache with 100s.

I would like to write a small app that looks at the account status and the date it was created. If the account has not been verified for over X days, I want to send a command to completely DELETE the Joomla/EasySocial Account and Account Profile. I'm using PayPlans, so I also want to delete the PayPlans subscription and invoice.

I've looked through your Developer Documentation and there isn't any DELETE ACCOUNT option documented.

Looking at the code, would the following work for a specific user_id?


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

$user = ES::user( $user_id);
$user->delete();



Looks like that would work, but seems to simple. Wanted to check with you first.

ALSO Please let me know if there is a better option then manual removal.

Thanks for the help.
Dan
Hey Dan,

Yep, you are absolutely right and that is the correct way to delete a user account. All it's relations would automatically get removed in the delete method.

In fact, if you delete the user from the back end via EasySocial, it routes through the same method calls, http://take.ms/tgSwC
·
Thursday, 01 February 2018 13:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Mark,

Just what I needed. Thank you for your assistance.

Dan
·
Friday, 09 February 2018 00:43
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome.

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.
·
Friday, 09 February 2018 10:09
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post