Home » Joomla » Joomla Web development » Make Specific Page available for only register user

The answer to this is a simple WordPress if else statement.  The code below is what you need:

<strong><?php if (is_user_logged_in()) { ?></strong>

<span style="color: #999999;">//do whatever you want if the user is logged in here</span>

<strong><?php } else { ?></strong>

<span style="color: #999999;">//do whatever you want if the user is NOT logged in here</span>

<strong><?php } ?></strong>

You can force user to Login to see content of wordpress page content by login

<strong><?php else:</strong>

<strong>wp_die</strong>(‘Sorry, you must first <a href=”/wp-login.php”>log  in</a> to view this page. You can <a  href=”/wp-login.php?action=register”>register free here</a>.’);

<strong>endif; ?></strong>

or

<strong><code><?php </code><code>else</code><code>:</code></strong></div>
<div><code><strong>wp_die</strong>(</code><code>'Sorry,  you must first <a href="/wp-login.php">log in</a> to view  this page. You can <a  href="/wp-login.php?action=register">register free here</a>.'</code><code>);</code></div>
<div><strong><code>endif</code><code>; ?></code></strong>

And you can redirect to specific page after Login by wrting following code

<strong><code><?php </code><code>else</code></strong><code><strong>:</strong> </code><code>echo</code><code>(</code><code>'Sorry,  you must first <a href="/wp-login.php?redirect_to=index.php/YOUR URL  HERE/" rel="nofollow">log in</a> to view this page.'</code><code>)<strong>;</strong> </code><strong><code>endif</code><code>; ?></code></strong>

Reference Links:

WordPress Function_Reference for is_user_logged_in
Require login for wordpress pages specific page

Wordpress Freelancer, Joomla Freelancer Web designer Mumbai india, Wordpress web developer India, Joomla Web developer india, Outsourcing web project india mumbai

By Santosh Kori Published: October 10, 2012 Professional Freelance Website developer 5 stars based on 65 reviews Total time: 24 hour 00 min Wordpress Joomla XHTML CSS jQuery HTML5 eCommerce CSS3 ☞ Offers low cost freelance web designing, asp php asp.net web development services from Mumbai India. Freelance web designer & developer Mumbai India.

I AM NOT AVAILABLE FOR WEB DESIGN & DEVELOPMENT PROJECTS