Website membership send login details from cmsb
9 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: October 20, 2014 (RSS)
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
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
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
PHP Programmer - interactivetools.com
By zaba - October 20, 2014 - edited: October 20, 2014
Yes it does,
attached is the section editor for Website Members (cms_schools)
I have done a test again making sure it is a valid email and it pops up with the same error.
Is there something I am doing wrong?
heres the globals set in the websiteMembership.php file
// UPDATE THESE VALUES
$GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] = 'https://website.co.uk/secure/log-in.php'; // url to login form
$GLOBALS['WEBSITE_LOGIN_SIGNUP_URL'] = 'https://website.co.uk/secure/signup.php'; // signup url linked to from the login page
$GLOBALS['WEBSITE_LOGIN_REMINDER_URL'] = 'https://website.co.uk/secure/password-request.php'; // password reminder url linked to from the login page
$GLOBALS['WEBSITE_LOGIN_RESET_URL'] = 'https://website.co.uk/secure/password-reset.php'; // password reminder url linked to from the login page
$GLOBALS['WEBSITE_LOGIN_PROFILE_URL'] = 'https://website.co.uk/secure/edit-profile.php'; // url to "edit my profile" page
$GLOBALS['WEBSITE_LOGIN_REQUIRED_FIELDS'] = array('agree_tos','agree_legal'); // if user is logged in and any of these fields exist and are blank (or zero) they will be redirected to the profile url with ?missing_fields=1 set
// After login, user gets redirected to the last page they were on (if defined), the url below, or to /
$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = 'https://website.co.uk/secure/account.php';
// After logoff, user gets redirected to the last page they were on (if defined), the url below, or to /
$GLOBALS['WEBSITE_LOGIN_POST_LOGOFF_URL'] = 'https://website.co.uk/secure/log-in.php';
$GLOBALS['WSM_ACCOUNTS_TABLE'] = 'schools'; // set the accounts table WSM uses, change this to store website accounts in a different table
$GLOBALS['WSM_SEPARATE_LOGIN'] = true; // set this to allow you to login to the website and CMS simultaneously as different users
// DON'T UPDATE ANYTHING BELOW THIS LINE
$GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN'] = true;
$GLOBALS['WEBSITE_MEMBERSHIP_VERSION'] = '1.10';
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
PHP Programmer - interactivetools.com