Skip to:
Content
Pages
Categories
Search
Top
Bottom

IF User is logged in DO, if not DO…


  • massbase
    Member

    @massbase

    is there an if structure to do little if’s around the site, for example im having trouble changing the header of my site, to display certain texts when they’re logged in and when they’re logged out.

Viewing 10 replies - 1 through 10 (of 10 total)

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Try

    <?php if (is_user_logged_in()) {
    ?>
    HTML
    <?php } ?>


    Shagalaga
    Member

    @shagalaga

    and if user is not logged in

    <?php if (!is_user_logged_in()) {

    ?>

    HTML

    <?php } ?>


    Markus Pezold
    Participant

    @markus-pezold

    Hi all,

    is this a function from bbPress 1.0 Release Candidate? In 0.9.0.5 it seems not to work:

    "Fatal error: Call to undefined function is_user_logged_in() in ../forum/bb-templates/scoun/front-page.php on line 3"

    Hi,all

    I use this for display “add new topic”, try:

    <?php if ( bb_is_user_logged_in() ) : ?>

    HTML

    <?php endif; // bb_is_user_logged_in() ?>


    massbase
    Member

    @massbase

    I am getting

    ‘Fatal error: Call to undefined function is_user_logged_in() in C:wampwwwmassbasemy-templatesmassbaseheader.php on line 45′

    same thing as Markus Pezold…

    I am using the 1.0 relsease..

    please help thanks.


    Markus Pezold
    Participant

    @markus-pezold

    Hi massbase,

    the code from Ohna “(bb_is_user_logged_in())” works perfect in my installation. No more problems with that.


    massbase
    Member

    @massbase

    wooohooo, thanks Ohna, and thanks Markus for pointing out Ohnas post was different to James’s

    I plan to release my theme to the general public and boy, its looking awesome.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Whoops… Need to remember to switch out of WordPress support mode! Totally my fault.


    massbase
    Member

    @massbase

    @jjj good thing you left in the 0.9 code in, the forum needs more detailed function support. cheers.


    Shagalaga
    Member

    @shagalaga

    <?php if ( !bb_is_user_logged_in() ) : ?>

    HTML

    <?php endif; // bb_is_user_logged_in() ?>

    this very good to add extra information or Ads for people who are not logged in ;-)

    Yes it works!

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.