ExpressionEngine® 3 User Guide

Legacy Documentation

You are using the documentation for version 3.5.17. Go here for the latest version or check here for your available upgrades to the latest version.

Legacy Member Model Extension Hooks

member_create_start

member_create_start($data, $cdata)

Provides an opportunity for extra code to be executed upon member creation, and also gives the opportunity to modify the member data by altering the arrays of data that we pass to the hook.

How it’s called:

list($data, $cdata) = $this->extensions->call('member_create_start', $data, $cdata);
Parameters:
  • $data (array) – Data to be inserted into exp_members table
  • $cdata (array) – Optional custom member data
Returns:

Array containing the $data array and $cdata array (see below)

Return type:

Array

Example of array to return:

array($data, $cdata)

New in version 2.6.0.

member_create_end

member_create_end($member_id, $data, $cdata)

Provides an opportunity for extra code to be executed after member creation.

How it’s called:

$this->extensions->call('member_create_end', $member_id, $data, $cdata);
Parameters:
  • $member_id (int) – ID of the member just created
  • $data (array) – Data to be inserted into exp_members table
  • $cdata (array) – Optional custom member data
Return type:

Void

New in version 2.6.0.

member_update_start

member_update_start($member_id, $data)

Provides an opportunity for extra code to be executed upon member update, and also gives the opportunity to modify the update for member data by altering the array of data that we pass to the hook.

How it’s called:

$data = $this->extensions->call('member_update_start', $member_id, $data);
Parameters:
  • $member_id (int) – ID of the member to be edited
  • $data (array) – Data to be updated
Returns:

Updated $data array

Return type:

Array

New in version 2.6.0.

member_update_end

member_update_end($member_id, $data)

Provides an opportunity for extra code to be executed immediately before the update of the member data and member custom field data.

How it’s called:

$this->extensions->call('member_update_end', $member_id, $data);
Parameters:
  • $member_id (int) – ID of the member to be edited
  • $data (array) – Data to be updated
Return type:

Void

New in version 2.6.0.

member_delete

member_delete($member_ids)

When a member is about to be deleted, this hook gives the chance to run a custom deletion routine and/or stop ExpressionEngine from running its own member deletion routine for certain members.

How it’s called:

$member_ids = $this->extensions->call('member_delete', $member_ids);
Parameters:
  • $member_ids (array) – Array of member IDs about to be deleted
Returns:

Array of member IDs to delete after adding or removing IDs

Return type:

Array

New in version 2.4.0.