Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created January 23, 2014 16:25
Show Gist options
  • Select an option

  • Save objectivehtml/8581639 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/8581639 to your computer and use it in GitHub Desktop.
<?php
public function trigger($data, $member_id)
{
// The $data variable contains the member data passed by the hook itself
// The $member_id available is also available.
// Lets say you want to pass additional data to the template aside
// from the member data already given to you. So...
// Assign the data var to a new variable name, I like to use $parse_vars
$parse_vars = $data;
// Now just assign new variables to the array like so...
$parse_vars['member_id'] = $member_id;
$parse_vars['custom_var_1'] = 'Custom Variable 1';
$parse_vars['custom_var_2'] = 'Custom Variable 2';
// So you would access your member data and custom variable like so...
// {hook:member_id}
// {hook:custom_var_1}
// {hook:custom_var_2}
// Just FYI, you have more options for parsing than I mention here.
// I just wanted to keep the example concise without too many variations
// but the fact is, you can do a lot more than you see here.
return $this->send($parse_vars);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment