help with group based quality

Hi, I'm trying, in an ad hoc way, to force the guest to be able to only see the small image quality. I pretty much manage to do it by modifying the "quality_links" block in album.tpl.php and imageview.tpl.php as follows :

<? if(!isset($pa_user["groups"]["guest"])){ ?>
<? foreach( $quality_links as $link){ ?>
<? if ( $link['actual']) {?>
<? print $link['name']; ?>  
<? } else { ?>
"><? print $link['name']; ?>  
<? } ?>
<? } ?>
<? } else { ?>
<? foreach( $quality_links as $link){ ?>
<? if ($link['name'] == "small") { ?>
<? print $link['name']; ?>  
<? if (!$link['actual']) { ?>
<?
PROBLEM "main.php?cmd=setquality&var1=".$val["id"]."&var2=album&var3=".urlencode($var1)."&var4=$start_with" ?>

<? } ?>
<? } ?>

<? } ?>
<? } ?>

The thing I don't know how to do is identified as PROBLEM. The line "main.php?cmd=setquality..." is the link executed when someone click on a quality link. However, in the case where the "actual" quality is not already the "small" one (for any reason), I want the album database to be updated as if the user had clicked on the "small" link.

Is there a way to launch this line automatically? I'm not that familiar with PHP prog. Or is there an equivalent function I can call from main.php to update / set the quality to "small" ?

Thanks

JR

found a solution

There's a neat and simple solution to my problem. Open main.php and add the following right after the groups of the user have been set, that is around line 2525, just before the comments :
//take all groups where the user is a member
//and merge the grants to be easy to check it later if needed

just paste the following

if(isset($pa_user["groups"]["guest"])){
$rec=db_select_all("quality","default=='true'");
$pa_quality=$rec[0];

}

Don't forget to set your default image quality as small (in setup/thumbnails of the album). Essentially, this code forces the quality back to the default, thus bypassing the quality found in any phpAlbum cookies left on the machine. I think this is a good way to do it since a guest would need to modify the group it belongs to in order to see better quality images, which requires much more effort than simply putting the correct command in the browser address bar (main.php?cmd=setquality... ).

JR

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-8698264690166658"
data-ad-slot="4417389723">