Hot answers tagged

5 votes
Accepted

before_channel_entry_save hook

This was driving me insane but I've figured it out. You need to edit the $entry object (1st parameter of the function) in order for this to work. You can, however, use the 2nd parameter, $values, for ...
user avatar
3 votes
Accepted

Structure of an Extension

Extensions are for backend or server side stuff, whereas Modules can interact via the frontend or EE Control Panel. So an Extension captures a hook from another class, but can't capture a form ...
user avatar
  • 5,353
3 votes

Structure of an Extension

It depends on whether the events that trigger the functions trigger a hook. If a button click, form submission, page load etc triggers a hook, then an extension is the right place for your custom ...
user avatar
  • 4,885
2 votes
Accepted

With the hook entry_submission_end, is it possible to know if the entry is inserted or updated?

I usually check if entry_id = 0 (for new entry) $this->EE->input->get_post('entry_id') == 0
user avatar
  • 5,781
2 votes
Accepted

Solspace Friends - Friend Request Hook

If it's not in the list of hooks, and no hooks are found in the Friends core files where you need one, then the hook doesn't exist. I recommend submitting this as a Feature Request under the specific ...
user avatar
  • 6,139
2 votes
Accepted

member_delete hook isn't deleting member after my code

Take return statement out of } else {. You should always return member_ids that should be deleted. So, change if (!empty($cleared_entries)) { $this->entry_update_del($cleared_entries, $...
user avatar
  • 2,846
2 votes
Accepted

Altering item data from store_order_item_add hooks (_start or _end)

I have often used store_order_item_add_end to modify product attributes. $item is an object, and pass by reference does indeed work in this context. So this code in your extension should change every ...
user avatar
  • 17.4k
2 votes
Accepted

Hook for when status is updated

I would use the entry_submission_ready extension hook, and write a mini-extension that looks at the meta array in the api for the entry status value, and compares it to the previous value for that ...
user avatar
  • 5,900
2 votes

Get member id in ExpressionEngines session hook

First initial thought is: can you use sessions_end hook instead? Looking at the Session.php code for where the session_start is fired, this hook kicks in before the user data is set from the cookie/...
user avatar
  • 5,353
2 votes
Accepted

Expresso Store Hook store_order_complete_end

You might find the EE Extension Development guide useful. Basically, you need to create an extension which handles the store_order_complete_end hook. I'm not sure what you mean by the $data parameter,...
user avatar
2 votes

Custom add-on accessing method from another custom add-on …

I agree with the advice provided by Brian in EECMS Slack. You can do this: require_once PATH_THIRD . 'your_addon/somefile.php' $someFile = new SomeFile(); $someFile->method();
user avatar
  • 1,232
2 votes
Accepted

Using the cp_custom_menu hook

The cp_custom_menu hook, although sounding like it will automatically add an item to the menu, in fact just adds your add-on as a new option when creating a custom menu via Settings -> Menu Manager ...
user avatar
  • 17.4k
2 votes
Accepted

Updating hooks from v2 to v4

There were certainly several extension hook changes with the arrival of EE3, possibly with EE4 too, so you may well need to update the naming of the hooks in your addon. You can find a complete list ...
user avatar
  • 3,572
1 vote

Expresso store : add on, hook store_order_complete_end creates order id+1

Using $this->extensions->last_call in the hook turned out to be redundant.
user avatar
  • 21
1 vote
Accepted

How to get data from a hook?

At the end of hook "channel_form_submit_entry_end" it is using the Channel Form Class so $obj->entry['entry_id'] a class property which is not available. Good news is you can use the method $obj->...
user avatar
1 vote

Is there a way to get the member_id of a user that was just logged out?

Although the hook doesn't provide any information you can use, you could do a query on the exp_members table where ip_address is equal to the users ip, and sort the results by last_activity descending....
user avatar
1 vote

Hook when member updates password

These what you are after? It appears these are planned for conversion to services down the road. But should still work now. https://docs.expressionengine.com/latest/development/extension_hooks/...
user avatar
  • 1,987
1 vote

Using the cp_custom_menu hook

add this at the end of public function cp_menu_array($menu) { if ($this->EE->extensions->last_call !== FALSE) { $menu = $this->EE->extensions->...
user avatar
1 vote

Do something after hook

Well, you are killing the process when you throw a redirect. The redirect() function basically causes a die() affect, ending code termination. You know you can declare a redirect in the template with ...
user avatar
  • 5,900
1 vote
Accepted

How to use the SQL Manager to find which extensions use a certain hook?

Use this query... SELECT * FROM exp_extensions WHERE hook = 'hook_youre_looking_for'; The class column will indicate what Extension it belongs to, and the method column will tell you what method (...
user avatar
  • 5,900
1 vote

How to use the SQL Manager to find which extensions use a certain hook?

look in the exp_extensions table. you should find everything you need there
user avatar
  • 1,987
1 vote

Cannot modify $item->modifiers in store_order_item_add_end hook

Apparently the key is to use: $modifiers = $item->modifiers; // modify the $modifiers data $item->setModifiersAttribute($modifiers); in the store_order_item_add_end hook.
user avatar
  • 43
1 vote
Accepted

DataGrab - is there a hook?

It looks like DataGrab has three hooks: ajw_datagrab_pre_import ajw_datagrab_modify_data ajw_datagrab_post_import If you open up datagrab_model.php and search for active_hook you will find them. ...
user avatar
  • 7,941
1 vote

Programmatically Adding an Item to an Expresso Order

If I use either my or Bryan's solution to add an item programmatically, I can add an item in the store_order_recalculate_start hook. To make it work in the store_order_recalculate_end hook, I have to ...
user avatar
  • 35
1 vote

Error on Postmaster Parcel or Hook save

What's the url of the the page that's getting the page not found error? Postmaster uses the domain you have specified in your config. This may be the problem. This is particularly true if you're using ...
user avatar
  • 85
1 vote
Accepted

Clear cache when Expresso Store Sale is created

Just documenting this if someone else might run into the same issue. It turns out there isn't a hook in Expresso Store (yet) that will allow you to clear caching on updating/inserting of a sale/...
user avatar
  • 241
1 vote
Accepted

cp_menu_array hook : nav_ not getting picked up

You can try to add next lines into your cp_menu_array code in case if you need to have some dynamic code: ee()->lang->language['nav_giftcards'] = 'Giftcards'; ee()->lang->language['...
user avatar
  • 5,781

Only top scored, non community-wiki answers of a minimum length are eligible