WordPress Membership

Easy to use WordPress Membership plugin

  • Documentation
  • WP eMember Plugin
  • Projects
  • Home

Allow Members to Upgrade or Add New Level to Their Profile for Free

Normally, you would charge people to upgrade their membership level to a new one. The standard upgrade documentation explains how that process is handled.

However, for a particular project, you may want to allow your members to upgrade their membership level for free. They just log into the site as a member then click a button to upgrade (or add) the level to their profile. This documentation explains how you can create a button that will allow your members to do that.

Creating a Button for Free Membership Level Upgrade

Step 1) Create a new WordPress page (where you will put the free upgrade buttons).

Step 2) Use the following shortcode in this newly created page. So you are creating a button that will upgrade the user’s membership level to the one specified in the “level” parameter of the shortcode.

[wp_eMember_upgrade_membership_level_to level="3"]

3 is the membership level ID in the above example. So change it to the correct level ID value for your site.

You can put as many buttons as you want (using the above shortcode) on this page for your various different levels that you want to offer free upgrade.

Step 3) Protect this page so only logged-in members of the site can view and interact with the upgrade buttons. You can use partial protection too (if that makes sense for your particular situation).

Step 4) Tell your users (who already has an account on your site) to go to this page and click on the button to upgrade.

When logged-in members click on the button that this shortcode generates, it upgrades their membership level to the one specified in the shortcode. If you are using the multiple membership level per user feature, then it will ADD the specified level to their profile (meaning they will now be able to access content of this newly added level).

Custom Button Text for the Update Level Button

You can specify a custom button text for the button by using the “button_text” parameter in the shortcode.

Example shortcode usage below:

[wp_eMember_upgrade_membership_level_to level="3" button_text="Click here to update"]

Redirect the Members to a Page After They Use the Button

You can use the “redirect_to” parameter in the shortcode to redirect the members to a page after they use the level update button.

Example shortcode usage below:

[wp_eMember_upgrade_membership_level_to level="3" redirect_to="http://www.exmaple.com/page-after-update-button-usage"]

Filed Under: Additional Resources Tagged With: Account Upgrade, Membership Level, shortcodes, WP eMember

How to Create Multiple Free Membership Levels on Your Site

In this post I will cover how to have more than one free membership level on your site. WP eMember uses one registration form for all of your membership levels. This way you don’t have to create multiple pages with different registration forms and confuse your customers. Full details of how eMember does this is explained here.

Steps for Creating Multiple Free Membership Levels on Your Site:

Step 1: Create a New Level

You can create as many membership levels as you want to. When you give your users access to a membership level for free, it makes that level a “FREE” one.

Create a new membership access level from eMember’s “Membership Level” interface. Lets say the ID of this level is 2.

Step 2: Create a Registration Page

Create a new WordPress page and use the following shortcode on it. This will place a registration form for this newly created membership level:

[wp_eMember_registration_form_for level=2]

2 is the membership ID in this example. You will need to change this value to the actual membership level ID for your system.

Step 3: Send Users to This Page

Now, you can send users to this page and they will be able to signup for this free membership level.

You can repeat steps 1, 2 and 3 to create as many free levels as you want.

Filed Under: Additional Resources Tagged With: Membership Level, registration form, shortcodes

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

WP eMember Shortcodes and Functions Reference

This PDF file that you can download from this page has a list of all the available Shortcodes and PHP functions that you can use to display the login form, registration form etc.

Download the WP eMember shortcodes list file

Filed Under: Design & Usage Tagged With: email tags, function reference, shortcodes

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

WP Express Checkout Plugin
wordpress_estore_icon
wordpress membership plugin icon
wordpress_affiliate_plugin_icon

Copyright © 2025 | WP Membership Plugin