• Resolved Gotzak

    (@gotzak)


    Hi there,
    im trying to set up a forum with wordpress: https://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 and just show it on top of the forum.
    This is what i did (https://codex.www.ads-software.com/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_before_pagination_loop','bbpressLoginRegisterLinksOnForumPage');
    	add_action('bbp_template_before_forums_loop','bbpressLoginRegisterLinksOnForumPage');
    }
    ?>

    but when i use it the page gets empty

    Hope you can help me
    Best Regards,
    Gotzak

    https://www.ads-software.com/plugins/bbpress-login-register-links-on-forum-topic-pages/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tomas

    (@zhuyi)

    Hi @gotzak,

    Thanks for the message, I am so happy to work with a great coder. ?? Thanks for the suggestion, I will add this feature in next verison, thanks, have a good day. ??

    Best Regards,
    Tomas

    This worked for me:

    function bbpressLoginRegisterLinksOnForumPage()
    {
    	if ( !is_user_logged_in() )
    	{
    		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"
    	}
    	else
    	{
    		echo '<div class="bbpressloginlinks" style="float:right;padding-right:20px;">';
    		$logout_url = site_url( 'wp-login.php?action=logout' );
    		echo "<a href='$logout_url'>".' Log Out '.'</a> ';
    
    		echo '</div>'; // class of "bbpressloginlinks"
    	}
    }
    Plugin Author Tomas

    (@zhuyi)

    Hi Dears,

    Thanks for the message, but your codes can not correctly, I understand you need this feature, I has added the new feature to new version, please check it, any feature request is welcome. ??

    Best Regards,
    Tomas

    Hi Dear,
    I have set up and used this plugin in my WordPress website.
    When I register in the forum it send an email with username and password. IN username it show the name which I entered but in password it shows ‘both’.

    It is supposed to create the password and send it by email. But is is just sending word “BOTH”.

    Please help me to resolve this issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help with "is user logged in"’ is closed to new replies.