show buttons only if logged in user is administrator

Asked

Viewed 8 times

-1

Guys, I’m trying to do something here, but it’s not working. Look, in my Model Usuarios I have the method LerAdmin :

$this->db->query(“SELECT * FROM usuarios WHERE level = 3”);
return $this->db->resultado();

In my Helpers / Sessao I have a method called estarLogado():

public static function estaLogado(){
    if (isset($_SESSION['usuario_id'])) :
        return true;
    else:
        return false;
    endif;
}

in my Controller Usuario i have the following instruction:

$admin = $this ->UsuarioModel -> lerAdmin()
$dados = [
‘Admin’ -> $admin
]

Here I hope to receive all data from my BD admin user

I have a TOP and RODAPE template, where I display my navbar. It happens that I would like to make the buttons of Register, Profile and Edit to be shown in the TOP only if there was logged in user and if this user was also administrator. I tried that, but it didn’t work:

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.