WordPress Membership

Easy to use WordPress Membership plugin

  • Documentation
  • WP eMember Plugin
  • Projects
  • Home

WP eMember Miscellaneous CSS Tweaks

You can add the CSS tweaks to the following interface of your site (or any other option your theme may have to insert CSS tweaks):

Appearance -> Customize -> Additional CSS

Login Form Related

Hiding the Join Us Link in the Login Form Widget

Add the following CSS tweak to hide the Join Us link in the membership login form widget:

#wp_emember_loginForm .register_link{
display: none;
}

Hiding the Forgot Password Link in the Login Form Widget

Add the following CSS tweak to hide the Forgot Password link in the membership login form widget:

#wp_emember_loginForm #forgot_pass{
display: none;
}

Hiding the Remember Me Checkbox in the Login Form Widget

Add the following CSS tweak to hide the Remember Me checkbox in the membership login form widget:

#wp_emember_loginForm .eMember_remember_me{
display: none;
}

Center Align the Member Login Form

Add the following CSS tweak to center align the member login form on the login page:

.wp_emember_loginForm {
    margin-right: auto;
    margin-left: auto;
}

Registration Form Related

Larger Font Size (Registration Form)

Add the following CSS tweak to make the font-size larger in the membership registration form:

#wp_emember_regoForm {
  font-size: 22px;
}

Larger Font Size for Only the Text Input Fields (Registration Form)

Add the following CSS tweak to target only the text input fields of the registration form and make the font-size larger:

#wp_emember_regoForm input[type="text"] {
  font-size: 22px;
}

Hide the Membership Level Field on the Registration Form

Add the following CSS tweak to target the membership level field of the registration form and hide it:

#wp_emember_regoForm #wp_emember_member_level {
  display: none;
}

Filed Under: Additional Resources Tagged With: membership tweaks, WP eMember

Allow Member Registration Using an Invitation Code or Password

Lets say you have a membership level called “Invitation Only”. You only want users with a special password or code to be able to signup to this membership level.

Do the following to achieve this type of setup

Step 1) Create Your Special Registration Page

Create a new WordPress page and follow this instruction to add a registration form on this page (for the membership level you want).

Step 2) Set Your Special Code or Password

Edit the visibility of the page and select the “Password protected” option. Set your special code (invitation code) as the password of this page.

set-password-protection-on-page

Step 3) Send Users to This Page

Now, you can communicate to your users and tell them to go to this page and use the code/password to unlock the page and register.

Only users with the correct code will be able to see the registration form and register.

Filed Under: Additional Resources Tagged With: member, Membership Level, membership tweaks, registration form

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

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