WordPress Membership

Easy to use WordPress Membership plugin

  • Documentation
  • WP eMember Plugin
  • Projects
  • Home

Member Registration Completion Hook

This documentation is only for developers. If you are not a developer with good PHP coding skills then you have no need to read this.

The registration completion hook (eMember_registration_complete) gets triggered after a member completes the registration. It will pass the details of the user who just registered to the handling function.

Here is a sample code to show you how it works. You can use this code in your custom plugin to see how it passes the data.

function handle_custom_registration_complete_event($member_data,$custom_fields)
{
  //The following line will print all the member details that got passed to this function via the $member_data array.
  //You can use this data however you like it.
  print_r($member_data);
  echo "<br />Custom fields data shown below<br />";
  print_r($custom_fields);
}
add_action('eMember_registration_complete','handle_custom_registration_complete_event',10,2);

Filed Under: Additional Resources Tagged With: API, member, registration form

Bulk Member Data Importer Addon

The bulk member data importer addon lets you import all your member’s info from a CSV file.

Installing the AddOn

  • Upload the “emember-bulk-member-import.zip” file via the WordPress’s plugin uploader interface (Plugins -> Add New -> Upload)
  • Activate the plugin through the “Plugins” menu in WordPress.

Using The Bulk Importer Addon

Step 1) Prepare the CSV File with Member Information

The first step is to add members to a CSV file under the proper headings. You can download a skeleton of the CSV file here to get an idea of the layout needed.

Please use MS Excel in a windows machine to modify/create the CSV file for best result. It will create the CSV file with the correct format.

If you are exporting from another program, providing it is flexible enough to “order” the headings, be sure to export as CSV. You can then open the file using a spreadsheet software like Excel (or OpenOffice), then paste the headings on top.

When opening the CSV file using spreadsheet software, you will be prompted about which delimiter to use. “Comma” should be selected by default but if not make sure that it is selected, and that it is the only option selected in order for the file to show up as it should. The skeleton file available from the above link will have sample data (that can be safely removed) to give you an idea of the format for the fields.

Step 2) Use the interface to import the data

1) Open the eMember Bulk Importer page by clicking WP eMember -> Member Bulk Import.

2) Click the Upload a .csv file button.

3) Locate the .csv file on your computer and double click it.

4) An Import Summary will be displayed. We’re looking for the Total and Succeeded columns to have the same value at this point.

5) Click WP eMember -> Members to see the newly added/imported members.

Imported Member’s Password

The plugin will generate a random password for the imported users and send them the reset password email. You can customize this email from the “Email Settings” menu of the WP eMember plugin.

AddOn Price

The addon is FREE for all customers who purchased WP eMember plugin from us.

Download the Addon

You can download this addon from the addon download area of our customer only support forum

  • Addon download area

Please note that some of these free addons are developed by our users in the community. So these addons do not have any advanced customization option. The description above explains exactly what this addon does.

Filed Under: eMember Addon Tagged With: emember addon, import, member, WP eMember

WP eMember Miscellaneous Tweaks

If you are a developer and want to customize the code or if you want to add conditions around your content then the following code examples should be helpful.

Find out if a member is logged in or not

You can use the following function call to determine if a member is logged in or not. The following function call will return true if a member is logged in (otherwise it will return false)

wp_emember_is_member_logged_in()

You can utilize the above function in the following way to ad code in your theme’s template file to add conditional block (for example: show a special message to your logged in users):

<?php if(wp_emember_is_member_logged_in()) { ?>
//Place your special message for members here
<?php } ?>

The following example can be useful if you want to show ad to non-members of the site:

<?php if(!wp_emember_is_member_logged_in()) { ?>
//Place your ad code here
<?php } ?>

The following example can be useful if you want to show a message to a member who belongs to membership level 1:

<?php if(wp_emember_is_member_logged_in('1')) { ?>
//Place your special message for members from membership level with ID 1
<?php } ?>

The following PHP code example shows how you can programmatically retrieve the member ID of a member and add condition:

<?php
$emember_auth = Emember_Auth::getInstance();
$user_id = $emember_auth->getUserInfo('member_id');
if (!empty($user_id))
{
    //pleace code that only members can see
}
?>

Hiding Post Title From Non Members

We will use the “wp_emember_is_member_logged_in” function (explained above) to modify the “Twenty Eleven” theme and make the post title only visible to users who are logged in.
This is an example for when a post is displayed on a single page – ie, I edited the content-single.php file:

The original line of code was as follows:

<h1 class="entry-title"><?php the_title(); ?>

To hide the post heading/title , I modified it as follows:

<h1 class="entry-title"><?php if(wp_emember_is_member_logged_in()) the_title(); ?>

The above is a simple example which will suppress the post heading if someone is not logged in.

Get member id and his/her membership level

<?php
$emember_auth = Emember_Auth::getInstance();
$user_id = $emember_auth->getUserInfo('member_id');
if (!empty($user_id))
{
    //User is logged in so add your conditional code here
    $membership_level = $emember_auth->getUserInfo('membership_level');
    if($membership_level == 1)
    {
        //Add stuff for this level
    }
}
?>

Get the homepage URL from the logged in member’s membership level

<?php
$emember_auth = Emember_Auth::getInstance();
$user_id = $emember_auth->getUserInfo('member_id');
if (!empty($user_id))
{
    //User is logged in so add your conditional code here
    $membership_level_resultset = $emember_auth->userInfo->primary_membership_level;
    $home_page_url = $membership_level_resultset->loginredirect_page;
    //Do something with this URL
}
?>

Show Logged in Member’s Username or other details

<?php
$emember_auth = Emember_Auth::getInstance();
$username = $emember_auth->getUserInfo('user_name');
echo "Username of the logged in member: ".$username;
?>

Check if the Logged in Member is Allowed to See a Post

<?php
$emember_auth = Emember_Auth::getInstance();
$post_id = "10"
if($emember_auth->is_protected_post($post_id))
{
    //This member is allowed to see this post
}

Retrieve Member’s Data

  • How to retrieve logged-in member’s data using a shortcode or PHP code
  • How to retrieve a particular member’s data using shortcode or PHP

Retrieve a Member Record Using the Username

The following PHP code will retrieve a member’s record for the given username:

<?php 
$username = "johndoe";//Replace with the actual username
$member = emember_get_member_by_username ($username);
echo "Member's First Name: " . $member->first_name; //Output the first name
echo "Member's Last Name: " . $member->last_name; //Output the last name
?>

Retrieve Total Members Count

The following PHP code will display the total members count:

<?php echo emember_get_total_members(array()); ?>

Member Registration Completion Hook

If you need to execute some custom code after a member completes the registration, use the following action hook:

  • Registration completion action hook

Show Different Navigation Menu to your Members and Non-members

  • Tweak your navigation menu to show dynamic menu items to members and non-members

Show Logged in Member’s Details Using Shortcode

You can use a shrotcode to show any details of the logged in member on a WordPress post or page. Refer to the eMember shortcode documentation for more details.

Placing a Registration Form For a Particular Membership Level to Give Backdoor Entrance

  • How to create a Registration Form for a Particular Membership Level

Free Members Must Confirm Their Email Address

  • How to make the free members to confirm their email address

Get the Login Page’s URL from the System

$emember_config = Emember_Config::getInstance();
$login_page_url = $emember_config->getValue('login_page_url');

Get the Registration Page’s URL from the System

$emember_config = Emember_Config::getInstance();
$login_page_url = $emember_config->getValue('eMember_registration_page');

Get the Edit Profile Page’s URL from the System

$emember_config = Emember_Config::getInstance();
$login_page_url = $emember_config->getValue('eMember_profile_edit_page');

Filed Under: Additional Resources Tagged With: member, Membership Level, membership tweaks, shortcodes, WordPress membership

  • « Previous Page
  • 1
  • 2

Get the WP eMember Plugin

Get WP eMember

Categories

  • Additional Resources
  • Content Protection
  • Design & Usage
  • eMember Addon
  • Installation
  • Integration
  • License
  • Testing
  • Uncategorized
  • Video Tutorial

Recent Comments

  • Chris Brown on API – Querying A Member Profile Using HTTP GET or POST
  • admin on API – Updating A Member Account Using HTTP GET or POST
  • Chris Brown on API – Updating A Member Account Using HTTP GET or POST
  • admin on API – Updating A Member Account Using HTTP GET or POST
  • Andrea on API – Updating A Member Account Using HTTP GET or POST

Featured WordPress Plugins

wordpress_estore_icon
wordpress membership plugin icon
WP Express Checkout Plugin
WordPress Lightbox Ultimate Plugin
WordPress Photo Seller Plugin
wordpress_affiliate_plugin_icon

Copyright © 2023 | WP Membership Plugin