News Update :
Home » » How to create a member area on WordPress

How to create a member area on WordPress

By: Unknown on Tuesday, 17 February 2015 | 08:36

If you want to create accessible content for members with a username and password, this article is for you. This tutorial is done with the platform  WordPress.

Using WordPress plugins:

Install the following plugins before starting

Advanced Access Manager -AAM  (allows to create roles by providing some level of access.)
 


WP Members (to provide a login page and block access to non-connected users)
PHP Code Widget   (to limit access manually)
Peter's Login Redirect (for redirection when the user logs)
Then with  AAM must create a client role, you can find tutorials with a Google search.

wp-memeberWP Members added to field a limited access to the content when you want to edit a page. Must in setting   Note: Items may be blocked or unblocked individually on the page of the article is checked.

By checking this option, only members can see the content.

If certain pages or categories are limited only to different types of users , you have to block manually in Advanced Access Manager


Limited access to content in a sidebar:

You can create PHP Code Widget protected content with the following code:


<?php
global $current_user;
get_currentuserinfo();
if ( is_user_logged_in() && ! user_can( $current_user, "subscriber" ) ) {
    echo 'Contenu accessible seulement aux usagers connectés qui ne sont pas des abonnés (subscribers)';
}
?>


Improved version with text showing who is logged



<?php
if ( is_user_logged_in()){
global $current_user;
get_currentuserinfo();
if($current_user-> user_firstname){
echo '<p>Bienvenue,  ' . $current_user-> user_firstname.'</p>';
}else{
echo '<p>Bienvenue,  ' . $current_user-> user_login.'</p>';
}
if( ! user_can( $current_user, "subscriber" ) ) {
 echo '<a href="#">Lien que vous voulez faire apparaitre</a>';
}
}?>
 
Contact Us | Privacy policy | Term of use | Advertise with Us | Site map
Copyright © 2011. Blogging Brain . All Rights Reserved.
Design Template by Blogging Brain | | Powered by Blogger