LinkedIn® Profile Synchronization: Hooks

LiPS adds two filter hooks and one action, to allow developers to add additional functions to the tool, such as a facebook url for each company, or data retrieved from online yellow pages containing more company details. Adding functions like that implies changes to the template as well. And you’ll need to check LinkedIns’ Terms of Service.

Filters

WordPress allows developers to filter content, by hooking a custom function to a certain event. The lips tool defines two filters: the profile_filter and the pre_template_filter. Each filter is called with an associated array which is used later on.

lips_profile_filter

The lips_profile_filter hook is invoked immediately after the profile is downloaded from LinkedIn. This hook is not invoked when the tool uses the Locally Stored Profile. The tool uses this filter too, it subscribes jsonStringToAssociativeArrayFilter, groupPositionByCompanyFilter, addCompanyDetailsFilter and addRecommendatorProfileLinkFilter.

If you’re adding data which should be read by the template, be sure to use an unique key name. $lips, $x_lips and $statics are reserved.

Remember: a filter must return data. The tool throws a FiltersMockedStuffUpException exception when the filters do not return an array. You would typically see a blank page when that happens.

lips_pre_template_filter

This hook is called when the profile is processed. It allows developers to do stuff before the template processes data. Examples of use of this hook are a hook which creates a post for each position, a hook which saves the profile to a page and a hook which saves the profile for future use.

A hook is called with one parameter, an associative array.

Actions

Actions are things that don’t return data.

lips_profile_updated

This action is executed when LiPS has successfully processed your profile.