Support > cpg1.6 permissions
Permissions for anycontent.php
Fity:
I am trying to create an anycontent.php file that will display a different message depending on users groups.
This is the code that I am using. With this code it always outputs the ELSE option. I have tried several different conditions but nothing works. CPG1.6 is bridged with VB4 and all users have a common secondary user group.
--- Quote ---if (!GROUP_GROUP_SET == 119) {
starttable("100%", $lang_index_php['welcome']);
echo <<<EOT
<tr>
<td class="tableb">
Welcome to the photo gallery.<br />
Browse through and see what we have been up to lately.<br />
</td>
</tr>
EOT;
endtable();
//EOF
}
ELSE {
starttable("100%", $lang_index_php['welcome']);
echo <<<EOT
<tr>
<td class="tableb">
Welcome to the photo gallery.<br />
Please log in to view more images.<br />
</td>
</tr>
EOT;
endtable();
//EOF
}
--- End quote ---
When I change the first line from this
--- Quote ---if (!GROUP_GROUP_SET == 119)
--- End quote ---
To this
--- Quote ---if (!USER_ID)
--- End quote ---
It detects logged in users.
Fity:
I just realised that typo on the first line. :-[
--- Quote ---if (!GROUP_GROUP_SET == 119) {
--- End quote ---
Is now
--- Quote ---if (!USER_GROUP_SET == 119) {
--- End quote ---
and the problem remains.
ron4mac:
USER_GROUP_SET is a comma separated text list. You'll have to do something like:
--- Code: ---$ugs = explode(',', trim(USER_GROUP_SET, '()'));
if (in_array(119, $ugs)) {
....
--- End code ---
Fity:
Thanks ron4mac, that worked perfectly. Your speedy help is appreciated. :)
Fity:
Now that I can have different front page welcome messages based on the user groups using the anycontent.php file, I would like to display different content also.
Example:
For non logged in / unregistered users I don't want to display random images, however for logged in users I do. Is this possible?
Navigation
[0] Message Index
[#] Next page
Go to full version