smartMember Seamless EE to aMember Integration
Integrate ExpressionEngine with aMember today!
After months of development and testing smartMember is finally available to the public. Purchase a commercial license for a single domain (unlimited sub-domains) and receive unlimited email support along with contributing to the growth and success of ExpressionEngine by supporting independent ExpressionEngine development.
Only $89.97 per license.
Table of Contents
- Features
- Screenshots
- Requirements
- Installation
- Activation
- Module Configuration
- Setting Up The Structure
- Customization Tips and Misc. Notes
- Tag Reference
- Change Log
- License
Features
smartMember is an ExpressionEngine module which enables a seamless integration between ExpressionEngine and the aMember membership script.
This is accomplished by two main features:
- Two Way Database Communication: With the implementation of smartMember, your EE application will have direct communication with the aMember database. This allows for 100% user management from within ExpressionEngine's native User Control Panels. All username, email, and password edits will be replicated across both databases.
- Stand Alone Registration Form (SARF): The addition of a SARF allows complete control of the user's registration experience and keeps the registration process within ExpressionEngine all the way up to the payment processing.
Additional Features:
- Payment History via EE's User CP: Last six transactions displayed by default; expandable to full history on click.
- Add/Renew Subscription via EE's User CP: Dropdown list of subscription options direct from aMember, coupon option, and order processing.
- Membership Information Link added to EE's User CP: Allows users to reach additional aMember options, such as the ability to cancel their current memberships.
Screenshots
Requirements
smartMember is an ExpressionEngine module and extension which requires ExpressionEngine 1.6+.
smartMember's sole purpose is to integrate ExpressionEngine with aMember and therefore requires aMember Professional 3.0.9+ with the EE Plugin Option.
CGI Central's aMember is a flexible membership and subscription management PHP script. It has support for PayPal, BeanStream, 2Checkout, NoChex, VeriSign PayFlow, Authorize.Net, PaySystems, Probilling, Multicards, E-Gold and Clickbank payment systems (Check the latest list of integration plugins) and allows you to setup paid-membership areas on your site. Click here: aMember for more information.
Installation
The smartMember package contains a module folder, a language file, and a default SARF template. To install the package follow the instructions below:
- Download the latest version of the module
- Extract the smart_member.zip file to your desktop
- Upload the
language/english/lang.smart_member.phpfile to your/system/languages/english/directory - Upload the
modules/smart_member/folder to your/system/modules/directory
Activation
The smartMember module must be installed via the Module Manager to activate.
- Open the Module Manager
- Click Install on the same line as the Smart Member module. This will activate the module copied to your server during the installation steps.
Module Configuration
The smartMember module is configured via EE's Module Manager. Within the module configuration you will set the Free & Paid Registration Redirect URLs, as well as all pertinent Database Connectivity Settings.
- Open the Module Manager
- Click on the Smart Member module to launch the smartMember Control Panel.
- Input the desired redirect for Free registrations.
- Enter the URL you would like to send new users to after they register with the Free account option selected
- Ex: http://www.yourdomain.com
- This can also be useful for tracking conversions: http://www.yourdomain.com/conversion/1
- Input the desired redirect for Paid registrations.
- Enter the URL you would like to send new users to after they register with the Paid account option selected
- Ex: http://www.yourdomain.com/amember/member.php
- You could also pass specific product, coupon, etc... info to aMember: http://www.yourdomain.com/amember/member.php?product_id=1 (see aMember docs for more info)
- Input the name of your aMember database
- Input a username with admin rights for your aMember database
- Input the password for the above admin account
- Input the hostname for your database server
- If you do not know your database server name, localhost is the most common.
- Click Update to submit your configuration settings.
Setting Up The Structure
Now that the smartMember module has been activated and configured; the Stand Alone Registration Form must be created, Member Profile Templates must be modified, and a few small code additions to the mod.member_settings.php & mod.member_auth.php core files must be completed.
The Stand Alone Registration Form (SARF)
- Create a new Template in the EE template group of your choice with a name of your choice. For the purpose of these instructions we will use the template name of
smart_registration - Open the
smart_registration_template.txtfile in thesmart_memberfolder on your desktop. - Copy the contents of
smart_registration_template.txtand Paste them into your new SARF template (smart_registration) - Click Update to save the changes to your new SARF template.
Member Template Modifications
- Open the
Member Profile Home Pagevia the following:Control Panel -> Admin -> Members and Groups -> Member Profile Templates -> Default -> Member Profile Home Page - Insert the following block of code just below the line that reads:
<td class='profileHeadingBG' colspan='2'><div class="tableHeading">{lang:your_stats}</div></td>
<!-- SMART_MEMBER CODE START -->
</tr><tr>
<td class='tableCellOne'><div class='defaultBold'>Payment History</div></td>
<td class='tableCellOne'>{payment_history}</td>
</tr><tr>
<td class='tableCellOne'><div class='defaultBold'>Add/Renew Subscription</div></td>
<td class='tableCellOne'>{subscription_form}</td>
<!-- SMART_MEMBER CODE END -->
Member_Settings Module Modifications
NOTE: The following modifications are being made to the ExpressionEngine member_settings module. This module is an ExpressionEngine core module. Extra care must be used when making these changes.
You should also make note that these changes WILL BE OVERWRITTEN THE NEXT TIME YOU UPDATE YOUR EE INSTALLATION!
Therefore, we recommend making these same changes to the new EE files prior to uploading and performing an upgrade.
function profile_main() modifications
- Open
mod.member_settings.phpin your system foldersystem/modules/member/ - Locate the line of code that reads:
return $this->_var_swap($this->_load_element('home_page'),- approx. line 89; inside function profile_main() - Insert the following block of code just above the line located in step 2.
- Locate the line that reads
array(just below the line located in step 2. - Insert the following two lines of code just below the line located in step 4.
- The End Result of these changes to function profile_main() should appear similar to the following:
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
$payment_history = '';
$subscription_form = '';
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$payment_history = $SM->get_payment_history();
$subscription_form = $SM->get_subscription_form();
}
/* --- SMART_MEMBER CODE END --- */
'payment_history' => $payment_history, // SMART_MEMBER
'subscription_form' => $subscription_form, // SMART_MEMBER
/** ----------------------------------------
/** Member Profile Main Page
/** ----------------------------------------*/
function profile_main()
{
global $DB, $SESS, $PREFS, $LOC;
$query = $DB->query("SELECT email, join_date, last_visit, last_activity, last_entry_date, last_comment_date, total_forum_topics, total_forum_posts, total_entries, total_comments, last_forum_post_date FROM exp_members WHERE member_id = '".$SESS->userdata('member_id')."'");
$time_fmt = ($SESS->userdata['time_format'] != '') ? $SESS->userdata['time_format'] : $PREFS->ini('time_format');
$datecodes = ($time_fmt == 'us') ? $this->us_datecodes : $this->eu_datecodes;
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
$payment_history = '';
$subscription_form = '';
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$payment_history = $SM->get_payment_history();
$subscription_form = $SM->get_subscription_form();
}
/* --- SMART_MEMBER CODE END --- */
return $this->_var_swap($this->_load_element('home_page'),
array(
'payment_history' => $payment_history, // SMART_MEMBER
'subscription_form' => $subscription_form, // SMART_MEMBER
'email' => $query->row['email'],
'join_date' => $LOC->decode_date($datecodes['long'], $query->row['join_date']),
'last_visit_date' => ($query->row['last_activity'] == 0) ? '--' : $LOC->decode_date($datecodes['long'], $query->row['last_activity']),
'recent_entry_date' => ($query->row['last_entry_date'] == 0) ? '--' : $LOC->decode_date($datecodes['long'], $query->row['last_entry_date']),
'recent_comment_date' => ($query->row['last_comment_date'] == 0) ? '--' : $LOC->decode_date($datecodes['long'], $query->row['last_comment_date']),
'recent_forum_post_date' => ($query->row['last_forum_post_date'] == 0) ? '--' : $LOC->decode_date($datecodes['long'], $query->row['last_forum_post_date']),
'total_topics' => $query->row['total_forum_topics'],
'total_posts' => $query->row['total_forum_posts'] + $query->row['total_forum_topics'],
'total_replies' => $query->row['total_forum_posts'],
'total_entries' => $query->row['total_entries'],
'total_comments' => $query->row['total_comments']
)
);
}
/* END */
function update_email() modifications
- Locate the line of code that reads:
function update_email()- approx. line 1278 - Locate the line of code that reads:
/** Success message- approx. line 1377; within function update_email() - Insert the following block of code just above the line located in step 2.
- The End Result of these changes to function update_email() should appear similar to the following (added code plus four lines above and six lines below):
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$SM->update_email($_POST['email']);
}
/* --- SMART_MEMBER CODE END --- */
$DB->query($DB->update_string('exp_gallery_comments', array('email' => $_POST['email']), "author_id = '".$SESS->userdata('member_id')."'"));
}
}
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$SM->update_email($_POST['email']);
}
/* --- SMART_MEMBER CODE END --- */
/** -------------------------------------
/** Success message
/** -------------------------------------*/
return $this->_var_swap($this->_load_element('success'),
function update_userpass() modifications
- Locate the line of code that reads:
function update_userpass()- approx. line 1430 - Locate the line of code that reads:
/** Success message- approx. line 1565; within function update_userpass() - Insert the following block of code just above the line located in step 2.
- The End Result of these changes to function update_email() should appear similar to the following (added code plus three lines above and five lines below):
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$SM->update_userpass($data['username'], stripslashes($_POST['password']));
}
/* --- SMART_MEMBER CODE END --- */
$SESS->userdata['screen_name'] = stripslashes($_POST['screen_name']);
}
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$SM->update_userpass($data['username'], stripslashes($_POST['password']));
}
/* --- SMART_MEMBER CODE END --- */
/** -------------------------------------
/** Success message
/** -------------------------------------*/
return $this->_var_swap($this->_load_element('success'),
Member_Auth Module Modifications
NOTE: The following modifications are being made to the ExpressionEngine member_settings module. This module is an ExpressionEngine core module. Extra care must be used when making these changes.
You should also make note that these changes WILL BE OVERWRITTEN THE NEXT TIME YOU UPDATE YOUR EE INSTALLATION!
Therefore, we recommend making these same changes to the new EE files prior to uploading and performing an upgrade.
function reset_password() modifications
- Open
mod.member_auth.phpin your system foldersystem/modules/member/ - Locate the line of code that reads:
function reset_password()- approx. line 794 - Locate the line of code that reads:
$sql = "UPDATE exp_members SET password = '".$FNS->hash($rand)."' WHERE member_id = '$member_id'";- approx. line 843; within function reset_password() - Insert the following block of code 3 lines below the line located in step 3.- approx. line 847; just below
$DB->query($sql); - The End Result of these changes to function update_email() should appear similar to the following (added code plus one line above and one line below):
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$SM->update_password($username, $rand);
}
/* --- SMART_MEMBER CODE END --- */
$DB->query($sql);
/* --- SMART_MEMBER CODE START --- */
$class_path = PATH_MOD.'smart_member/mod.smart_member'.EXT;
if (is_file($class_path) && include_once($class_path))
{
$SM = new Smart_member();
$SM->update_password($username, $rand);
}
/* --- SMART_MEMBER CODE END --- */
// Kill old data from the reset_password field
Customization Tips and Misc. Notes
Important Note:EE user activation can not be enabled when using aMember. aMember automatically places a user in the proper group upon payment. The user activation moves a user from "pending" to a preset user group upon activation. This would alter aMembers group assignment and cause the user to no longer be in the subscribers group.
- Edit payment options displayed in the User CP
- Payment options must be altered in the
mod.smart_member.phpfile in the functionget_subscription_form() - The html code that needs to be altered begins at the following line:
<!-- paysystem selection code -->and ends just prior to<!-- coupon text box --> - The easiest way to edit this code would be to open http://www.yourdomain.com/amember/member.php in your browser and view the source. then copy and past the paysystem selection code into the
mod.smart_member.phpfile as mentioned above. - An example: If you only offered credit card payments you would change the code to the following:
<!-- paysystem selection code -->
<input type="hidden" name="paysys_id" value="authorize_aim" />
<input type="hidden" name="account_type" value="paid" checked />
Overrides account type<input type="hidden" name="redirect_url" value="http://domain.com/amember/member.php?product_id=1&coupon=3-FOR-3" />
Overrides product selection, and automatically enters coupon code.
ee.inc.php file at approx. line 98 - within the subscription_deleted function:
SET group_id = '$max'
toSET group_id = '5' //of which 5 is the group_id for non-paying members
Tag Reference
smartMember: Registration Form Tag {exp:smart_member:registration_form_open}
The {exp:smart_member:registration_form_open} tag is the only tag within smartMember. This tag is only used within the SARF to dynamically generate the information required for successful registration within EE.
Change Log
1.1
- Commercial Release
1.2
- Added the ability for smartMember to recognize when products/subscriptions are disabled within aMember. The aMember display setting now effects the drop down lists in the SARF and Member Templates.
1.3
- Complete overhaul of user documentation
- Added Links section to smartMember CP
- Added forced login to aMember on registration
- This overrides aMembers detection of a logged in EE user on registration to ensure that a user is not asked for a username and password by aMember prior to payment.
1.4
- Corrected serialized $data information written to aMember database.
- Confirmed operation with latest version of aMember - Version 3.1.4 PRO
1.5
- Integrated EE's new member registration code which corrected a bug where signups could bypass required custom fields on an EE registration form.
- Improved EE to aMember session handoff.
License
By purchasing the smartMember Module you agree to the following conditions:
- One license grants the right to perform one installation of the smartMember Module. Each additional installation requires an additional license to be purchased.
- You may not reproduce, distribute, sell or transfer the smartMember Module, or portions thereof, to any third party.
- All copyright and proprietary notices within the smartMember Module files must remain intact and unaltered.
- The smartMember Module is provided "as is", without warranty of any kind.
- You assume all risk associated with the installation and use of the smartMember Module.
