User roles based Wordpress site

Nov2
  • Share/Bookmark

Difficulty: ★★☆☆☆
For a client of me, I had to create a website, where the frontpage
has a loginbox. Only registered users, can access the full website.
The solution for this in Wordpress is a template based on user roles.
Please review the code below:

<?php
	global $current_user;
	get_currentuserinfo();
	if($current_user->user_level >= 1){
?>	

<div id="container">
..LOGGED IN SITE
</div>

<?php
	} else {
?>

<div id="container">
..GUEST SITE
</div>

<?php
}
>


Leave a comment