Hello.
I need to create a link is only visible to a particular user group. How I can do?
thanks
regards
Cherokee
Hello.
I think this is how I can show and hide the link.
How could display only a certain group of users?
thanks
regards
// Button "Download"
if ($CONFIG['plugin_enlargeit_buttondownload'] == '1' || ($CONFIG['plugin_enlargeit_buttondownload'] == 2 && USER_ID)) {
$meta .= <<< EOT
enl_buttonurl[{$loopCounter}] = 'index.php?file=enlargeit/download&pid=';
enl_buttontxt[{$loopCounter}] = '{$lang_plugin_enlargeit['download_this_file']}';
enl_buttonoff[{$loopCounter}] = -208;
EOT;
$loopCounter++;
}
$USER_DATA['groups'] contains an array of all user group IDs the current user belongs to, so something like
if (in_array(4, $USER_DATA['groups']))
should work if you want to display your button to the group with the ID "4". Depending where you want to add that code, you maybe need to add
global $USER_DATA;
before the if statement. When in doubt, add it as it won't break anything.
Thanks André
I am unable to make it work, I'll keep trying.
regards
Sorry
I think it is
This is how I put it:
// Button "Download"
global $USER_DATA; if (in_array(108, $USER_DATA['groups'])) {
if ($CONFIG['plugin_enlargeit_buttondownload'] == '1' || ($CONFIG['plugin_enlargeit_buttondownload'] == 2 && USER_ID)) {
$meta .= <<< EOT
enl_buttonurl[{$loopCounter}] = 'index.php?file=enlargeit/download&pid=';
enl_buttontxt[{$loopCounter}] = '{$lang_plugin_enlargeit['download_this_file']}';
enl_buttonoff[{$loopCounter}] = -208;
EOT;
$loopCounter++;
}
}
Just a question what if I close the post were several groups of users?
Thank you very much
Quote from: cherokee on February 22, 2014, 06:52:19 PM
Sorry
I think it is
This is how I put it:
// Button "Download"
global $USER_DATA; if (in_array(4, $USER_DATA['groups'])) {
if ($CONFIG['plugin_enlargeit_buttondownload'] == '1' || ($CONFIG['plugin_enlargeit_buttondownload'] == 2 && USER_ID)) {
$meta .= <<< EOT
enl_buttonurl[{$loopCounter}] = 'index.php?file=enlargeit/download&pid=';
enl_buttontxt[{$loopCounter}] = '{$lang_plugin_enlargeit['download_this_file']}';
enl_buttonoff[{$loopCounter}] = -208;
EOT;
$loopCounter++;
}
}
Just a question what if I close the post were several groups of users?
Thank you very much
Use something like
if (in_array(array(4, 5, 6), $USER_DATA['groups']))
Thank you very much