forum.coppermine-gallery.net

Support => cpg1.6.x Support => cpg1.6 permissions => Topic started by: Fity on July 19, 2018, 06:28:54 am

Title: Permissions for anycontent.php
Post 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.

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
}

When I change the first line from this

Quote
if (!GROUP_GROUP_SET == 119)

To this

Quote
if (!USER_ID)


It detects logged in users.
Title: Re: Permissions for anycontent.php
Post by: Fity on July 19, 2018, 06:48:47 am
I just realised that typo on the first line.  :-[

Quote
if (!GROUP_GROUP_SET == 119) {

Is now

Quote
if (!USER_GROUP_SET == 119) {

and the problem remains.
Title: Re: Permissions for anycontent.php
Post by: ron4mac on July 19, 2018, 03:45:49 pm
USER_GROUP_SET is a comma separated text list. You'll have to do something like:

Code: [Select]
$ugs = explode(',', trim(USER_GROUP_SET, '()'));

if (in_array(119, $ugs)) {
....
Title: Re: Permissions for anycontent.php
Post by: Fity on July 20, 2018, 01:32:23 am
Thanks ron4mac, that worked perfectly.  Your speedy help is appreciated.  :)
Title: Re: Permissions for anycontent.php
Post by: Fity on July 20, 2018, 07:17:04 am
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?
Title: Re: Permissions for anycontent.php
Post by: ron4mac on July 20, 2018, 02:57:22 pm
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.
Title: Re: Permissions for anycontent.php
Post by: Fity on July 20, 2018, 02:59:20 pm
Thanks.  I might tackle a plug in one day.
Title: Re: Permissions for anycontent.php
Post by: Αndré on August 16, 2018, 03:05:10 pm
I'd solve it this way. Disable the random images meta album in the config and add this to anycontent.php:
Code: [Select]
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).
Title: Re: Permissions for anycontent.php
Post by: Fity on August 22, 2018, 01:09:21 am
Thanks André, I will give that a try.  In the meantime i have written a menu that changes with the user group. Works ok.