I am trying to add one more condition to this conditional code.
This code is working well. Only a user with a avatar/photo can send a message.
public static function addMessage($ID, $user, $message) {
$user_id = get_current_user_id();
$avatar=ThemexCore::getUserMeta($user_id, 'avatar');
if(empty($avatar)) {
$message=trim(preg_replace($filters, '', $message));
}
I trying to add is a condition that Only a user with a Description in their profile can send a message.
This code checks if a text description has been saved to the users profile.
if(!ThemexCore::checkOption('description')) {
$fields[]=array(
'label' => __('Description', 'theme'),
'name' => 'description',
'type' => 'text',
'default' => true,
);
}
I have tried many coding combinations, yet so far no joy.
Here is one example:
$user_id = get_current_user_id();
$description=ThemexCore::getUserMeta($user_id, 'description');
$description=ThemexCore::checkOption('description');
if(empty($description)) {
$message=trim(preg_replace($filters, '', $message));
}
All help appreciated