forum.coppermine-gallery.net
Support => cpg1.6.x Support => cpg1.6 permissions => Topic started by: Fity on July 19, 2018, 06:28:54 am
-
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.
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
}
When I change the first line from this
if (!GROUP_GROUP_SET == 119)
To this
if (!USER_ID)
It detects logged in users.
-
I just realised that typo on the first line. :-[
if (!GROUP_GROUP_SET == 119) {
Is now
if (!USER_GROUP_SET == 119) {
and the problem remains.
-
USER_GROUP_SET is a comma separated text list. You'll have to do something like:
$ugs = explode(',', trim(USER_GROUP_SET, '()'));
if (in_array(119, $ugs)) {
....
-
Thanks ron4mac, that worked perfectly. Your speedy help is appreciated. :)
-
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?
-
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.
You would need a plugin to accomplish that.
Core files could be modified to do that but doing so is definitely not recommended.
-
Thanks. I might tackle a plug in one day.
-
I'd solve it this way. Disable the random images meta album in the config and add this to anycontent.php:
if (USER_ID) {
display_thumbnails('random', 0, 1, 4, 1, false);
}
(maybe you need to adjust the numbers to your needs or use values from the $CONFIG array).
-
Thanks André, I will give that a try. In the meantime i have written a menu that changes with the user group. Works ok.