Website membership send login details from cmsb

By zaba - October 8, 2014

I want to be able to register new members manually through cmsb, then click to send them their logindetails via email.

I am guessing that there must be some way to do this by stealing some code from the signup.php and creating a new php file called sendlogin.php (which can be a link from the cms and passing the current record variable) but i am a bit stumped as to how to go about this, and surprised it's not already part of the add-on already.

By Damon - October 9, 2014

Hi zaba,

Would the Email New Account Notification plugin by Michael Aguilar do what you are looking for?
http://www.interactivetools.com/add-ons/detail.php?Email-New-Account-Notification-1037

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By zaba - October 10, 2014 - edited: October 10, 2014

Hi Damon, just setting this up now,

as I am using a separate table for website members (which has no field 'isAdmin' can I safely comment out these 2 lines

25.   if (!$GLOBALS['CURRENT_USER']['isAdmin']) { return $actionLinks; }

45.   if (!$GLOBALS['CURRENT_USER']['isAdmin']) { return; }

UPDATE...

Ok I have tried this plugin and it doesn't do what I need it to do which is to send the activated account and email with their login details (email and password) to access the site, it merely sends them a notification that their account has been activated.

Is there any way I can do this, as if an admin sets up the account they would like to inform the user that the account is active and here are your login details. This can be done when the user signs up via the signup form, but not if the signup is done by an admin directly in cmsb.

Hi Zaba,

I've thrown together a quick plugin that will e-mail users when a new record is created using their e-mail address:

<?php
/*
Plugin Name: Send user e-mail details on account creation.
Description: Send user a sign up e-mail after there account has been crated via the CMS. 
Version: 1.0
Required System Plugin: True
*/

addAction('record_postsave',  'nlb_sendUserUpdateEmail', null, 4);


function nlb_sendUserUpdateEmail($tableName, $isNewRecord, $oldRecord, $recordNum){

  //Validate current user
  if(!isset($GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN'])) { return; }
  if($tableName != $GLOBALS['WSM_ACCOUNTS_TABLE'])  { return; }
  if(!$isNewRecord)                                 { return; }


  //Email user his details. If there are errors, store them and display.
  list($mailErrors, $fromEmail) = wsm_sendSignupEmail($recordNum, $_REQUEST['password']);
  if($mailErrors){
    alert($mailErrors);
  }

  return;
}

You just need to save this file in your CMS plugins directory in a PHP file. 

The default website membership plugin e-mail template will be used to send to the user.

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By zaba - October 20, 2014

Hi Greg,

I get an error, see attachment,

also do I have to deactivate the "Email New Account " plugin.

would like to trigger this via a button or link really, and some method of showing that an email has been sent.

(the email new account plugin has an activation email sent checkbox which is ticked when you click on the send link)

Hi Zaba,

I've had a look at the plugin, and I think you'd get this error if no e-mail address is set in the e-mail field, or if it's invalid. Does your website membership section have an e-mail field?

Cheers,

Greg 

Greg Thomas







PHP Programmer - interactivetools.com

Hi Zaba,

This is starting to get outside what we can provide via forum support. If you'd like, I can take a quick look at what the issue is, and get this plugin set up for you. Let's continue the conversation through consulting, if you contact consulting@interactivetools.com, I can continue to look into the problem.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By zaba - October 20, 2014

Thanks Greg,

I'll send some info via email.

regards

Chris