1

I'm developing an extension that uses the member_update_end hook. This extension requires communicating with a 3rd party API, which I can't guarantee will always be active.

As a side note, the hook will be called when a specific custom member field is updated, which I do in my templates via Freemember.

Should this 3rd party API fail to respond with the output I want, how can I present (or redirect to?) an error message/template to the user? Is there an EE method (or best practice) for such things while inside an extension, that makes sure it won't interrupt anything else that needs to happen (like other hooks that may be set, etc.)?

Thanks in advance.

1 Answer 1

1

In the hooked function you can return the error message which will be displayed as "User Message".

Like:

function function_name($member_id, $data)
{
$errors = array();
#####
Data processing with API

Put all the errors into the array $errors

#####

if( count ($errors) > 0 )
return $this->EE->output->show_user_error('general', $errors);
}

I hope, it would help you.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.