Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Gotzak on "Help with "is user logged in""

$
0
0

Hi there,
im trying to set up a forum with wordpress: http://www.die-dunkle-wache.de/forum (i never used Wordpress or css before)
I installed the "bbpress-login-register-links-on-forum-page" Plugin and tried to script it...i failed.
I want to hide the Plugin (Login,Register,forgotpsw-links)if a user is already logged in.
This is the default:

<?php
function bbpressLoginRegisterLinksOnForumPage()
{
	echo '<div class="bbpressloginlinks" style="float:right;padding-right:20px;">';
	$login_url = site_url( 'wp-login.php' );
	echo "<a href='$login_url'>".' Log In '.'</a> ';

	$register_url = site_url( 'wp-login.php?action=register' );
	echo " <a href='$register_url' style='margin-left:20px;'>".' Register '.'</a> ';

	$lost_password_url = site_url( 'wp-login.php?action=lostpassword' );
	echo " <a href='$lost_password_url' style='margin-left:20px;'>".' Lost Password '.'</a> ';
	echo '</div>'; // class of "bbpressloginlinks"
}

	add_action('bbp_template_after_forums_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_pagination_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_after_single_forum','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_forums_loop','bbpressLoginRegisterLinksOnForumPage');

and this is what i did (http://codex.wordpress.org/Function_Reference/is_user_logged_in):

<?php
 if ( is_user_logged_in() )
{
}
else
{
function bbpressLoginRegisterLinksOnForumPage()
{
	echo '<div class="bbpressloginlinks" style="float:right;padding-right:20px;">';
	$login_url = site_url( 'wp-login.php' );
	echo "<a href='$login_url'>".' Log In '.'</a> ';

	$register_url = site_url( 'wp-login.php?action=register' );
	echo " <a href='$register_url' style='margin-left:20px;'>".' Register '.'</a> ';

	$lost_password_url = site_url( 'wp-login.php?action=lostpassword' );
	echo " <a href='$lost_password_url' style='margin-left:20px;'>".' Lost Password '.'</a> ';
	echo '</div>'; // class of "bbpressloginlinks"
}

	add_action('bbp_template_after_forums_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_pagination_loop','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_after_single_forum','bbpressLoginRegisterLinksOnForumPage');
	add_action('bbp_template_before_forums_loop','bbpressLoginRegisterLinksOnForumPage');
}
?>

but when i use it the forumpage gets empty

Hope you can help me
Best Regards,
Gotzak


Viewing all articles
Browse latest Browse all 8245

Trending Articles