Visibility of customized buttons based on the user

saet

New member
Hello,

Is there a way to make custom buttons visible based on the group the user belongs to?

Thanks.

----------------------------------------------------------

You are using DaDaBIK version 10.6-Manarola enterprise, installed on 04-12-2021 (installation code: 16794605dc449b439c), the latest version of DaDaBIK is 10.6-Manarola released on 01-26-2021

System info

PHP Version: 7.3.27
mysql version: 5.5.5-10.4.18-MariaDB
Web server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27
Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0
URL installation: http://localhost/
 
Hello,

I think you must use

[pre]
$custom_buttons['tableNameHere'][$cnt]['permission_needed'] = 'custom_function';
[/pre]


The explanation on Manual says:

custom_function: DaDaBIK shows the button (and allows the current user to execute the related function) based on a custom function you wrote; you have to define the name of the function with the additional parameter permission_custom_function, the function must return TRUE or FALSE.

When you use it you also need to use the following:

[pre]
$custom_buttons['tableNameHere'][$cnt]['permission_custom_function'] = 'dadabik_custom_function_name_here';
[/pre]

then write the php function on same page.
 
By the way, the example I found on manual is showing exactly how to use it for group permission:

[pre]
function dadabik_permission_change_status($table_name, $where_field, $where_value)
{
global $current_id_group;

if ($current_id_group === '3'){
return true;
}
else{
return false;
}
}
[/pre]
 
Top