jacob00
Member
Posted 7 months ago #
Hi
Trying to have a conditional statement in Prologue theme that shows a different form if a user is not a member (or not logged in). This is my attempt but it's not working:
<?php
if( current_user_can( 'publish_posts' ) ) require_once dirname( __FILE__ ) . '/post-form.php';
} else {
if( current_user_can( 'level_0' ) ) require_once dirname( __FILE__ ) . '/banner-form.php';
?>
I've seen several examples but can't make it work with my specific instance. I'm pretty sure the code I've shown worked with the original Prologue, but perhaps someone can see an obvious problem with the 'else' statement.
Cheers
You probably want something like this:
<?php
if( current_user_can( 'publish_posts' ) ) {
require_once dirname( __FILE__ ) . '/post-form.php';
} elseif( current_user_can( 'level_0' ) )
require_once dirname( __FILE__ ) . '/banner-form.php';
}
?>
noel
Thanks for the help, but I'm afraid it doesn't work. I get the same sort of error:
"Parse error: syntax error, unexpected '}' in ////themes/P2/index.php on line 17"
Any ideas?
loyalpk
Member
Posted 7 months ago #
do you want to show a banner to regular visitors i am using wp greet box instead... like i did at http://trendblog.org
scotm: I posted bad code. This is what you want:
<?php
if( current_user_can( 'publish_posts' ) ) {
require_once dirname( __FILE__ ) . '/post-form.php';
} elseif( current_user_can( 'level_0' ) ) {
require_once dirname( __FILE__ ) . '/banner-form.php';
}
?>
Sorry for the mixup.