Advertisement:

Author Topic: List of errors used in flash messages?  (Read 274 times)

Xefiron

  • Newbie
  • *
  • Posts: 32
  • Software developer - Desarrollador de software
List of errors used in flash messages?
« on: May 07, 2019, 01:23:36 am »
For example, within UserActions.php are these two error messages, which are then stored in an array:
Code: [Select]
$flash_error .= sprintf(_m('The specified e-mail is already used by %s') , $user_email['s_username']) . PHP_EOL;
                    $error[] = 3;

Code: [Select]
$flash_error .= _m('The name cannot be empty').PHP_EOL;
                $error[] = 10;

 Is there a list of errors to follow in order to implement error messages?

calinbehtuk

  • Sr. Member
  • ****
  • Posts: 450
Re: List of errors used in flash messages?
« Reply #1 on: May 07, 2019, 10:28:00 am »
You can simply use the filter available for errors

Code: [Select]

function user_register_error($flash_error){
    $my_field = Params::getParam('my_field');
    if($my_field !='some_value'){
        $flash_error .= __('Error', 'my_theme') . PHP_EOL;
    }
   
    return $flash_error;
}

osc_add_filter('user_add_flash_error', 'user_register_error');