groupaccess
Quote
groupaccess ( string $field )
Parameters
field
The MySQL field where you want to check the access from
Return Values
This function will return the $field with the correct values of access the current user or guest has.
Example
Code
<?php
echo groupaccess("field_1");
?>
Lets see what happens when we run this function. Notice how it changes depending of the users rights.
Output from above example
For guests groupaccess() will return this:
For members groupaccess() will return this:
Quote
(field_1='0' OR field_1='101')
For Administrators groupaccess() will return this:
Quote
(field_1='0' OR field_1='101' OR field_1='102')
For Super Administrators groupaccess() will return this:
groupaccess() advanced example
Code
<?php
$result = dbquery(
"SELECT item, access
FROM ".DB_TABLE."
WHERE ".groupaccess('access')."
ORDER BY item DESC"
);
?>
Output from above example
For guests groupaccess() will return this:
Quote
$result = dbquery(
"SELECT item, access
FROM ".DB_TABLE."
WHERE (access='0')
ORDER BY item DESC"
);
For members groupaccess() will return this:
Quote
$result = dbquery(
"SELECT item, access
FROM ".DB_TABLE."
WHERE (access='0' OR access='101')
ORDER BY item DESC"
);
For Administrators groupaccess() will return this:
Quote
$result = dbquery(
"SELECT item, access
FROM ".DB_TABLE."
WHERE (access='0' OR access='101' OR access='102')
ORDER BY item DESC"
);
For Super Administrators groupaccess() will return this:
Quote
$result = dbquery(
"SELECT item, access
FROM ".DB_TABLE."
WHERE 1 = 1
ORDER BY item DESC"
);