• hi!, well i had this code, it works perfectly. but i want to assing a special menu for 3 kind of user, admin user, the normal user, and the staff users. i want to make it with the ids, and manage it manualy. so, managin the normal users, and admin user is easy:
    $user_id = get_current_user_id();
    if ($user_id == 0) {
    echo “Hola invitado!, puedes Registrarte o iniciar sesion.”;
    } elseif ($user_id == 1) {
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $first_name = $user_info-> user_firstname;
    $last_name = $user_info-> user_lastname;
    echo “Hola, $first_name $last_name. Edita tu perfil, Publica un post.”;
    }
    elseif ($user_id == 2)
    {
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $first_name = $user_info-> user_firstname;
    $last_name = $user_info-> user_lastname;
    echo “Hola, $first_name $last_name. Edita tu perfil, Publica un post.”;
    }
    else
    { echo “Has iniciado sesion.”; }

    but if you note it, the user ID: elseif ($user_id == 2)
    {
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $first_name = $user_info-> user_firstname;
    $last_name = $user_info-> user_lastname;
    echo “Hola, $first_name $last_name. Edita tu perfil, Publica un post.”;
    }
    its just for the user 2, well, i cant made and diferent menu for each user like:
    elseif ($user_id == 3)
    {
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $first_name = $user_info-> user_firstname;
    $last_name = $user_info-> user_lastname;
    echo “Hola, $first_name $last_name. Edita tu perfil, Publica un post.”;
    }…etc
    but what i want to know is how to make something like this:

    elseif ($user_id == ‘1’,’2′,’3′,)
    {
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $first_name = $user_info-> user_firstname;
    $last_name = $user_info-> user_lastname;
    echo “Hola, $first_name $last_name. Edita tu perfil, Publica un post.”;
    }
    the drama is in the elseif: elseif ($user_id == ‘1’,’2′,’3′,)
    how to get something like that working, any idea?

Viewing 1 replies (of 1 total)
  • I have used the CIMY User Extra Fields plugin to add a ‘Member Class’ field to user profiles. CIMY lets you make such a field editable only by an admin, not by others, so users can’t change their own class. Then you could check that field in your code.

Viewing 1 replies (of 1 total)
  • The topic ‘php, users, custom menus!’ is closed to new replies.