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

smartMember is an ExpressionEngine module which enables a seamless integration between ExpressionEngine and the aMember membership script.

This is accomplished by two main features:

Additional Features:

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:

  1. Download the latest version of the module
  2. Extract the smart_member.zip file to your desktop
  3. Upload the language/english/lang.smart_member.php file to your /system/languages/english/ directory
  4. Upload the modules/smart_member/ folder to your /system/modules/ directory

Activation

The smartMember module must be installed via the Module Manager to activate.

  1. Open the Module Manager
  2. 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.

  1. Open the Module Manager
  2. Click on the Smart Member module to launch the smartMember Control Panel.
  3. 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
  4. 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)
  5. Input the name of your aMember database
  6. Input a username with admin rights for your aMember database
  7. Input the password for the above admin account
  8. Input the hostname for your database server
    • If you do not know your database server name, localhost is the most common.
  9. 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)

  1. 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
  2. Open the smart_registration_template.txt file in the smart_member folder on your desktop.
  3. Copy the contents of smart_registration_template.txt and Paste them into your new SARF template (smart_registration)
  4. Click Update to save the changes to your new SARF template.

Member Template Modifications

  1. Open the Member Profile Home Page via the following:
    Control Panel -> Admin -> Members and Groups -> Member Profile Templates -> Default -> Member Profile Home Page
  2. 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>
  3. 
    <!-- 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

  1. Open mod.member_settings.php in your system folder system/modules/member/
  2. Locate the line of code that reads:
    return $this->_var_swap($this->_load_element('home_page'), - approx. line 89; inside function profile_main()
  3. Insert the following block of code just above the line located in step 2.
  4. 
    /* --- 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 --- */
    				

  5. Locate the line that reads array( just below the line located in step 2.
  6. Insert the following two lines of code just below the line located in step 4.
  7. 
    'payment_history'			=> $payment_history,	// SMART_MEMBER
    'subscription_form'			=> $subscription_form,	// SMART_MEMBER
    				

  8. The End Result of these changes to function profile_main() should appear similar to the following:
  9. 
      /** ----------------------------------------
      /**  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

  1. Locate the line of code that reads:
    function update_email() - approx. line 1278
  2. Locate the line of code that reads:
    /** Success message - approx. line 1377; within function update_email()
  3. Insert the following block of code just above the line located in step 2.
  4. 
    /* --- 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 --- */
    				

  5. 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):
  6. 
    			$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

  1. Locate the line of code that reads:
    function update_userpass() - approx. line 1430
  2. Locate the line of code that reads:
    /** Success message - approx. line 1565; within function update_userpass()
  3. Insert the following block of code just above the line located in step 2.
  4. 
    /* --- 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 --- */	
    				

  5. 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):
  6. 
    		$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

  1. Open mod.member_auth.php in your system folder system/modules/member/
  2. Locate the line of code that reads:
    function reset_password() - approx. line 794
  3. 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()
  4. Insert the following block of code 3 lines below the line located in step 3.- approx. line 847; just below $DB->query($sql);
  5. 
    /* --- 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 --- */	
    				

  6. 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):
  7. 
          $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.

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

1.2

1.3

1.4

1.5

License

By purchasing the smartMember Module you agree to the following conditions:

Top of Page