WebSite X5Help Center

 
Franco F.
Franco F.
User

User management  en

Autor: Franco F.
Besucht 1382, Followers 2, Geteilt 0  

Hi everybody. I'd like to understand ho to make ma wesite main menu to be responsive by the group that belong to the user actually logged.

I've followed the example in here, that can helping me into making the user menu as a dropdown list that can be enougth to me (and leave the normal pages of the site to be driven by the standard menu).

The only point with that is that i cannot recognize the user group of the user. I would not basic user to see menu of the advanced one.

Gepostet am
5 ANTWORTEN - 1 KORREKT
Aleksej H.
Aleksej H.
Moderator

Hello.There is currently no way to hide objects depending on the user group.You can allow access for certain groups of users to certain pages.

Mehr lesen
Gepostet am von Aleksej H.
Esahc ..
Esahc ..
Moderator

Franco, further to what Aleksej correctly stated, you could have a locked page to which only appropriate groups get access, and on that page add a menu object starting at a (hidden) level under which all the user pages have been placed. Until a user logged in to see that page the menu would not be visible.

Mehr lesen
Gepostet am von Esahc ..
Franco F.
Franco F.
User
Autor

So, what is exactly the group that is retrieved by that function (in x5engine.php)?

I've displayed into a page and i so is something coded.

public function getUserByUsername($username)
    {
        $imSettings = Configuration::getSettings();        // Search in the file
        if (isset($imSettings['access']['users'][$username])) {
            $user = $imSettings['access']['users'][$username];
            return array(
                "id"        => $user['id'],
                ...
                "validated" => true,
                "groups"    => $user['groups'],
                "hash"      => $this->_getUserHash($username, $user['password'])
            );
        }
        // Search in the DB
        if ($this->db) {
            $res = $this->db->query("SELECT * FROM `" . $this->db_table . "` WHERE `email`='" . $this->db->escapeString($username) . "'");
            if (is_array($res) && count($res) > 0) {
                $user = $res[0];
                return array(
                    "id"        => $user['id'],
                    ..
                    "validated" => $user['validated'],
                    "groups"    => array($imSettings['access']['webregistrations_gid']),
                    "hash"      => $this->_getUserHash($user['email'], $user['password'])
                );
            }
        }
        return null;
    }

By checking x5engine.php i've found this function:

public function checkAccess($page)

Is there ANY way to get the id number of certain pages?

What if i set 3 hidden pages for the 3 type of level of user and by this function i can know if the actual user belong to any of those level, so i will know which level is the user?!

I just saw that page ID is compiled runtime, so i think it can dinamically change between download!

Mehr lesen
Gepostet am von Franco F.
Franco F.
Franco F.
User
Autor

It works. 

By using checkAccess($page) i can indirectly recognize the user level. Now it just miss how to recognize automatically the page id of a specific page.

Mehr lesen
Gepostet am von Franco F.
Esahc ..
Esahc ..
Moderator

Suddenly I am out of my depth.

Good luck playing with code.

Mehr lesen
Gepostet am von Esahc ..