Return to Snippet

Revision: 27658
at June 19, 2010 02:39 by labsecrets


Updated Code
STEP ONE:

If you want to make your own private page template, using your own theme, 
simply open your existing "page.php" file in a text editor, then save a copy 
of it with the name "template-private-page.php". 

Then, at the very top of the new template page, add the following code snip:

<?php
/*
Template Name: Private Page
*/
?>
<?php do_action( 'walled_page' ) ?>


STEP TWO:

Open up your "functions.php" file and at the very bottom, 
add the following code (be sure you put it just above the "?>" 
closing bracket:


/* This makes a function to be used on private page template */

function sh_walled_page()
{
	global $bp;

	if (bp_is_register_page() || bp_is_activation_page())
		return;

	if(!is_user_logged_in()) {
		bp_core_redirect( $bp->root_domain .'/unavailable');
	}
}

add_action( 'walled_page', 'sh_walled_page' );

Revision: 27657
at June 19, 2010 02:36 by labsecrets


Initial Code
STEP ONE:

If you want to make your own private page template, using your own theme, simply open your existing "page.php" file in a text editor, then save a copy of it with the name "template-private-page.php". Then, at the very top of the new template page, add the following code snip:

<?php
/*
Template Name: Private Page
*/
?>
<?php do_action( 'walled_page' ) ?>


STEP TWO:

Open up your "functions.php" file and at the very bottom, add the following code (be sure you put it just above the "?>" closing bracket:


/* This makes a function to be used on private page template */

function sh_walled_page()
{
	global $bp;

	if (bp_is_register_page() || bp_is_activation_page())
		return;

	if(!is_user_logged_in()) {
		bp_core_redirect( $bp->root_domain .'/unavailable');
	}
}

add_action( 'walled_page', 'sh_walled_page' );

Initial URL


Initial Description


Initial Title
Add A Private Page Template

Initial Tags


Initial Language
HTML