Helping Organisations get organised!

Hooks and filters

All names below are as they appear in the code. The namespace is lh_crm. The four form HTML filters mix a hyphen into the name; they are documented as they are, since renaming a public hook needs a back-compat step.

Actions fired

Hook Arguments When
lh_crm_http_post_after_user $user After a submission’s user has been resolved (the logged-in user, or matched or created from the email), before anything else is saved. Plugins whose profile fields save themselves, such as LH User Experience Taxonomy, save here.
lh_crm_enquiry_created $post_id, $form_id, $user After an enquiry post is created. Only fires when the form was submitted from a singular page, since no enquiry is created otherwise. Nothing inside LH CRM listens to it since 1.5.8, when the relationships sync was removed; it is there for other plugins.
lh_post_ip_tax_insert_post $post_id Asks the bundled IP library to record the submitter’s IP on a new enquiry
lh_post_user_agent_insert_post $post_id Asks the bundled User Agent library to record the browser string
lh_as_queue_runner_enqueue_runner none After the auto-reply email is queued, to nudge the mail queue runner

Profile field saves also fire BuddyPress’s own xprofile_profile_field_data_updated and xprofile_updated_profile.

Filters

Hook Arguments Effect
lh_crm_init_plugin true Return false to skip the main bootstrap (frontend script, block, notices). The other component classes still load.
lh_crm_return_plugin_debugging_status true Whether to write debug log lines when WP_DEBUG is on
lh_crm_enquiry_action $action, $page_id, $user_id The “X enquired via Page on Site” string, which becomes the enquiry title
lh_crm_message_title $title, $user Receives the submitted subject. The result is currently not used anywhere.
lh_crm_message_content $content, $user Receives the submitted message. The result is only passed to the auto-reply as the default user summary; the enquiry itself stores the unfiltered message.
lh_crm_user_summary $summary, $user Value of the recipient.user_summary token in the auto-reply and the response template
lh_crm_send_notification_tokens $tokens, $user The full token array for the auto-reply email
lh_crm_format_notification $html, or $array, $link, $total, $text BuddyPress notification output for enquiry notifications (string or array format)
lh_crm_frontend_always_editable_field_types $field_types xProfile field type keys that stay editable on the logged-in form even when they already have a value. Defaults to lh_uet-tax and lh_uet-text (User Experience). These field types must save their own input, since they are left out of the submitted field_ids. Since 1.5.19.
lh_crm_frontend_field_display_value $value, $field_id, $user_id Plain-text value shown in the greyed box for a filled profile field on the logged-in form, for field types whose value is not returned by bp_get_the_profile_field_value(). If still empty, the box reads On your profile. Since 1.5.18.
lh_crm-form-after_full_name $html, $atts Form HTML after the name field or fields (runs for logged-in and logged-out forms)
lh_crm-form-after_frontend_email $html, $atts Form HTML after the email and profile fields
lh_crm-form-after_frontend_subject $html, $atts Form HTML after the subject field. Always fires, since the subject field is always output, either visible or as a hidden input.
lh_crm-form-after_frontend_submit $html, $atts Form HTML after the submit button

In the four form HTML filters, $atts holds the Contact Form block’s settings. The lh_crm_gmt_offset filter was removed in 1.5.9, when the hourly cron switched to comparing GMT dates directly.

Bundled library filters

  • IP address library: lh_post_ip_tax_get_applicable_post_types, lh_post_ip_tax_get_taxonomy_ip_args, lh_post_ip_tax_show_column_content_ip_address, lh_post_ip_tax_return_plugin_debugging_status.
  • User agent library: lh_post_user_agent_get_applicable_post_types, lh_post_user_agent_get_current_user_ua, lh_post_user_agent_show_column_content_user_agent, lh_post_user_agent_show_column_content, lh_post_user_agent_the_metabox_content, lh_post_user_agent_return_plugin_debugging_status.

Hooks from other plugins that LH CRM uses

  • Opts the enquiry post type in through lh_post_ip_tax_get_applicable_post_types, lh_post_user_agent_get_applicable_post_types and lh_comps_get_applicable_season_post_types_filter.
  • Opts it out through lh_archive_post_status_get_applicable_post_types_filter, lh_logged_in_post_status_get_applicable_post_types_filter, lh_r_post_status_get_applicable_post_types, lh_rejected_post_status_get_applicable_post_types, lh_bp_cpp_a_get_applicable_publish_post_types_filter, lh_ogp_meta_tags_get_applicable_post_types_filter, lh_html_sitemap_get_non_hierarchical_post_types, wp_sitemaps_post_types, lh_seo_meta_tags_get_applicable_post_types, lh_anon_comments_get_applicable_post_types, lh_attribution_get_applicable_post_types, lh_ui_pt_extender_get_applicable_post_types and lh_emoji_taxonomy_get_applicable_post_types.
  • Adds its five statuses to lh_membership_private_content_class_return_applicable_post_statuses for logged-in users.
  • Adds five per-user enquiry fields (count, last date, last ID, last title, last content of New enquiries) to Users Insights through usin_fields, usin_db_map and usin_query_join_table.
  • Removes the contact form post type from Co-Authors Plus (coauthors_supported_post_types).
  • Uses wp_statuses_registered to remove the core statuses from enquiries. Note that its own init priority 1000 status registration must be added before the wp-statuses library’s own callback at the same priority; see Architecture notes, Load order.
  • Adjusts bbPress: moves its menus under CRM, adds thumbnail support to forums, and replaces bbp_get_total_users with the site’s real user count.
  • Passes suppress_if_populated in the properties given to an xProfile field type’s edit_field_html() on the logged-in form. The extended field types in LH Profile Page and LH User Experience Taxonomy honour it by printing nothing when their stored value is already set, which is how LH CRM detects values kept outside BuddyPress’s own profile data.

If you like this plugin please consider making a donation to further development