Line only for certain groups Line only for certain groups
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Line only for certain groups

Started by rgroen, January 10, 2005, 10:00:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rgroen

Hey Folks,

I have coded the next line:

// Indien groep HogeResolutie dan link
$path_to_hr = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] ."/Ergens/". $CURRENT_PIC_DATA['filename'];
$info['Hoge Resolutie'] = '<a target=_blank href="'.$CONFIG["ecards_more_pic_target"].'/'.$path_to_hr.'" >Gebruik als achtergrond</a>';


My idea is to show this line only to certain groups in my photo gallery. How can I do this.

Ciao

Nibbler

check the value of $USER_DATA['user_group'] or the $USER_DATA['groups'] array if you need to know multiple group membership.

rgroen

Quote from: Nibbler on January 10, 2005, 10:24:33 PM
check the value of $USER_DATA['user_group'] or the $USER_DATA['groups'] array if you need to know multiple group membership.

Oke, but whats the code so only members of a certain group can see this line and hit the link? Thats one thing I really dont know?! So if anyone can help me with this code.

Nibbler

if ($USER_DATA['user_group'] == 2){ <<your code here>> }

for example.

rgroen

Quote from: Nibbler on January 11, 2005, 07:36:29 PM
if ($USER_DATA['user_group'] == 2){ <<your code here>> }

for example.

Help, It doesn't work! I have tried everything but nothing was good!  :\'(

Tranz


rgroen

Quote from: TranzNDance on January 11, 2005, 10:47:04 PM
Could you please post your code?

No problem,


if ($CONFIG['read_iptc_data']) $iptc = get_IPTC($path_to_pic);

   if (isset($iptc) && is_array($iptc)) {
       if (isset($iptc['Title'])) $info[$lang_picinfo['iptcTitle']] = trim($iptc['Title']);
       if (isset($iptc['Copyright'])) $info[$lang_picinfo['iptcCopyright']] = trim($iptc['Copyright']);
       if (isset($iptc['Keywords'])) $info[$lang_picinfo['iptcKeywords']] = trim(implode(" ",$iptc['Keywords']));
       if (isset($iptc['Category'])) $info[$lang_picinfo['iptcCategory']] = trim($iptc['Category']);
       if (isset($iptc['SubCategories'])) $info[$lang_picinfo['iptcSubCategories']] = trim(implode(" ",$iptc['SubCategories']));
   }
   // Create the absolute URL for display in info
   $info['URL'] = '<a href="' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '" >' . $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . basename($_SERVER['PHP_SELF']) . "?pos=-$CURRENT_PIC_DATA[pid]" . '</a>';
// with subdomains the variable is $_SERVER["SERVER_NAME"] does not return the right value instead of using a new config variable I reused $CONFIG["ecards_more_pic_target"] no trailing slash in the configure

// If member of group HighResolution then...
$path_to_hr = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] ."/More/High/Orig/". $CURRENT_PIC_DATA['filename'];
$info['Hoge Resolutie'] = '<a target=_blank href="'.$CONFIG["ecards_more_pic_target"].'/'.$path_to_hr.'" >Use as wallpaper on your desktop</a>';
   
// Create the add to fav link
   if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
       $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['addFav'] . '</a>';
   } else {
       $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['remFav'] . '</a>';
   }

   return theme_html_picinfo($info);
}
// Displays comments for a specific picture


Hope you can get this baby work. Then we can post it on the forum.