I am trying to show the bootstrap alert box based on below condition
// These arrays can be empty if not set
$operations = [] // array of operations
$positions = [] // array of posisionts
$employees = [] // array of employess
Now I want to show alert box if any of these arrays is empty or the current employee is in their respective array. I am stuck to find the robust way to do. As I believe simple if(){}else{} condition might not work. Like this what I have tried.
if (
( empty( $operations ) || in_array( $this->cur_operation, $operations ) ) ||
( empty( $positions ) || in_array( $this->cur_position, $positions ) ) ||
( empty( $employees ) || in_array( bp_loggedin_user_id(), $employees ) )
) {
echo ac_get_alert_box( $type, $message, $dismissible, $id );
}
This condition is showing alert all the time.
Please help me to solve this issue.
Thanks
Aucun commentaire:
Enregistrer un commentaire