We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Hook for overriding Output?

Developer Preview

Bjørn Børresen's avatar
Bjørn Børresen
629 posts
9 years ago
Bjørn Børresen's avatar Bjørn Børresen

Hi,

upgrading Simple Registration from EE2 to EE3 I had to deprecate some functionality, specifically JSON response for errors on registration and the ability to skip the standard EE user messages.

I’d like to ask for a hook in Output->show_message() that get the $data array and that can end the execution before the final;

echo  stripslashes($row['template_data'] );
exit;

The “User Message” functionality of EE has always been something many users want modified/removed, whether it be during registration or any other form that will give you the standard EE error message - so I think something that enables this would be useful for many add ons/users.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Hey Bjørn,

Sorry for the delay. I think we can add this hook for you. What if we replace those last couple of lines in show_message with this:

$output = stripslashes($row['template_data']);

if (ee()->extensions->active_hook('output_show_message') === TRUE)
{
    $output = ee()->extensions->call('output_show_message', $data, $output);
}

echo $output;
exit;

Does that do what you need? Then you can just return whatever output data you want from the hook.

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
9 years ago
Bjørn Børresen's avatar Bjørn Børresen

That’s great news, Kevin, and yes that should do the trick!

For the JSON responses I’d probably just do the output in the extension and exit myself, but looks like that should work fine there since not much else will be happening there after that call anyway.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Cool! We’ll get this in for 3.2, then.

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
9 years ago
Bjørn Børresen's avatar Bjørn Børresen

Excellent, thanks! 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.