custom button depending on field value?

prettem

Member
Hello Eugenio,
is it possible to have a custom button in grid view on row level, depending on variable value?
I wand to show the button only if a value of email is present.

if (!is_null ($row['email'])) >> show button

Can I use the button permission function in any way?

Thank you very much for your help.
best regards
Manuel

About/upgrade​

DaDaBIK™ is a product conceived and developed by Eugenio Tacchini
Copyright © 2001-2022 Eugenio Tacchini
Proudly ❤️ made in Emilia
dadabik.com

Your current DaDaBIK version​

You are using DaDaBIK version 11.6-Elba enterprise, installed on 16.06.2022 (installation code: 1780462288396de6b1), the latest version of DaDaBIK is 11.7-Elba released on 18.08.2022

You are not running the last release of DaDaBIK, the release you are running might have bugs and security holes, see the official change log for further information. You can upgrade DaDaBIK here.

In case you want to upgrade to a more powerful edition (from Pro to Enterprise/Platinum, from Enteprise to Platinum) please contact us.

System info​

PHP Version: 7.3.27

mysql version: 5.7.33-0ubuntu0.16.04.1

Web server: Apache

Client: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 OPR/92.0.0.0
 

eugenio

Administrator
Staff member
Hello Manuel,
yes, the permission function has ($table_name, $where_field, $where_value) as parameters so you can execute an SQL SELECT query to get the value of a field. This could make things slower though (for each row, a query is executed).

Best,
 

prettem

Member
Thank you its running, this is my function:

function dadabik_permission_Vorstand($table_name, $where_field, $where_value)
# nur Vorstand darf das. vorstand=5, admin=1
{
global $conn, $current_id_group;

if ($current_id_group === '5'){
$sql = "SELECT `email` FROM `Stammdaten` WHERE $where_field = :where_value";
$res_prepare = prepare_db($conn, $sql);
$res_bind = bind_param_db($res_prepare, ':where_value', $where_value);
$res = execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);

if (!is_null ($row['email'])){
return true;
}
else
{
return false;
}
}
else{
return false;
}
}
 
Top