Forums

How to check if a user is connected (2 posts)

  1. lstelie
    Member
    Posted 2 years ago #

    Hello

    I want to display a menu item if and only the user is an editor

    If i do

    global $userdata;
     if (isset($userdata)) {
      get_currentuserinfo();
      if ( $user_level >=7){
       .....

    When the user is not connected I get an error

    WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
    SELECT COUNT(DISTINCT ID) FROM
  2. lstelie
    Member
    Posted 2 years ago #

    Folow up
    even this (from the codex page)

    <?php global $user_ID;
          get_currentuserinfo();
    
          if ('' == $user_ID) {
             //no user logged in
          }
    ?>

    Throws a sql error

    Luc

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags