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

Extension hook not being called?

Development and Programming

viewcreative's avatar
viewcreative
116 posts
16 years ago
viewcreative's avatar viewcreative

Extension hook not being called?

I’ve got two extensions making use of the same hook: member_register_validate_members

With the following activation details respectively:

$DB->query($DB->insert_string('exp_extensions', array(
  'extension_id' => '',
  'class'        => get_class($this),
  'method'       => 'subscribe_member',
  'hook'         => 'member_register_validate_members',
  'settings'     => '',
  'priority'     => 10,
  'version'      => $this->version,
  'enabled'      => 'y'
)));
$hook = array(
    'extension_id'    => '',
    'class'           => __CLASS__,
    'method'          => 'validate_members',
    'hook'            => 'member_register_validate_members',
    'settings'        => serialize($settings),
    'priority'        => 1,
    'version'         => $this->version,
    'enabled'         => 'y'
);

According to the documentation I would expect the validate_members method to be called first as it has a priority of 1, and it does exactly that, but for some reasons the subscribe_member method never get’s called/executed. I know this because I kill the script right at the top of the method like so:

function subscribe_member($member_id)
{        
  global $DB;
  die("HERE?");

  ...

But just get presented with the normal “Account Activated” message.

I’m running EE 1.6.6 and can’t upgrade due to numerous core hacks

Any ideas?

Moved to Extensions Technical Support by Moderator

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Hi, viewcreative. We have a dedicated forum for extension help. I’m going to move this there for other community members to help.

       
viewcreative's avatar
viewcreative
116 posts
16 years ago
viewcreative's avatar viewcreative
Hi, viewcreative. We have a dedicated forum for extension help. I’m going to move this there for other community members to help.

Thanks Sue - yes I am aware of that, I’ve made numerous posts to the extension forum and received almost no replies! It seems only to be ever frequented by community members who (and why should they) rarely offer any assistance - which can be rather frustrating.

I posted it to the Technical Support forum in the vain hope that it might be picked up (which it has) and dealt with by a member of the EE development team (which it hasn’t! just moved to a forum where it’ll never be answered!)

–

If there is anyone out there…

I have tried disabling the other extension and the hook gets called. Any ideas why it doesn’t get called. I was under the impression that multiple hooks / multiple extensions were supported, and were managed by priority. Any idea what I’m doing wrong?

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones
Thanks Sue - yes I am aware of that, I’ve made numerous posts to the extension forum and received almost no replies! It seems only to be ever frequented by community members who (and why should they) rarely offer any assistance - which can be rather frustrating.

Our development team is very small, and while we try to pop in to these forums occasionally, we’d never get any work done if we answered every question posted about writing add-ons for ExpressionEngine. We’re hoping to increase this interaction when we aren’t so fully buried in working on 2.0. As to why should community members help one another? The ones that do would tell you that both offering and receiving help from other third parties is extremely helpful both to their skill, their involvement in this cottage industry, and the success of their business.

As for not receiving answers, particularly when you’re talking about troubleshooting someone else’s code, how the questions are framed plays a large role. Someone coming along to help you will be asking in their head “how much am I going to be on the hook for if I reply to this person’s question?”. Is it clear from the question that this person has read the developer documentation? Do they have a solid understanding of PHP? Does the information that they have shared demonstrate that they know what’s relevant? Between “can’t upgrade due to numerous core hacks” and not showing your method’s code, the possibilities are near endless - more information would make people more inclined to assist.

I’ll take a stab at it based on what you’ve stated. First make sure that error reporting is enabled in your installation and your PHP environment. Next check your exp_extensions table to make sure that both methods were properly added to the database on activation, and that there are not other extensions that also utilize this hook that might interfere. Lastly, keep both hooks registered, but remove all of the code from your first method that is being called, to rule out an issue with the code being executed in that method. If none of those lead you to discover the issue, I’d suggest zipping your extension and posting it as an attachment so someone can look at your code.

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

Any conclusions or need some additional help, viewcreative?

       

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.