Page 1 of 1

Category dependent links in navigation

Posted: Mon Mar 30, 2015 11:57 am
by snifty
Version of script: 2.6.2

Does anybody know if there is a simple way to find out if a user is in a category?
I want to add items to the navigation for users that are members of eg. category 1.

In other words, I'm trying to add lines to show_admin_nav.inc.php that will do:

if ($_SESSION['name'] is in category 1) {
<td><a href=.....
}

Thank you!

Re: Category dependent links in navigation

Posted: Mon Mar 30, 2015 4:36 pm
by Klemen
You can use the hesk_okCategory function:

Code: Select all

if ( hesk_okCategory(1, false) )
{
        // show the link...
}
The first parameter is category ID (1 in this case) and the second must be set to "false" to prevent HESK showing an error page.

Re: Category dependent links in navigation

Posted: Tue Mar 31, 2015 8:45 am
by snifty
Hi Klemen!

Thank you very much for your fast answer.
This is excactly what i was looking for! :D
For some reason I didn't find this function so I was fiddling with SQL Statements like "SELECT `categories` FROM `hesk_users` WHERE `name` = $_SESSION['name']" which is not really that nice...

HESK - and of course your support - is really worth each Cent! That's the reason we're using it since 2010.