Loading...

Introduction to Hooks

Hooks allow developers to tweak and modify their code without changing the core code. They let you interact with the core code at predefined spots.

They make up the base for plugins and themes to interact with WordPress Core. They’re also used extensively by the Core code itself.

Developers can use two types of hooks, action hook, and filter hook.

Action Hook: It acts on something and resumes back to the normal flow without modifying anything.

Filter Hook: Collects the info and modifies it. Then returns the revised version to the hook for later use.

 

Using Hooks:

To use a hook to add or manipulate code, you can add your custom code in a variety of ways:

  • To a custom child theme’s functions.php file.
  • Using a plugin.

 

Using action hooks

To execute your functionality, you hook in by using the action hook do_action('the_action_name');.

Here is how to place your code:

add_action( 'the_action_name', 'your_function_name' );

function your_function_name() {
// Your code
}

Using filter hooks

Filter hooks are called throughout the plugin using apply_filter( 'filter_name', $variable );.

To manipulate the passed variable, you can do something like the following:

add_filter( 'filter_name', 'your_function_name' );

function your_function_name( $variable ) {
// Your code
return $variable;
}

With filters, you must return a value.

 

The following is a list of Action and Filter hooks for PieRegister:

 

PIEREGISTER ACTION HOOKS:

    1. pie_register_after_user_created: This action fires when user is created with Pie Register registration
      form.
    2. pieregister_divi: Initializes “Divi” widget.
    3. pieregister_elementor: Initializes “Elementor” widget.
    4. pieregister_gutenberg: Initializes “Gutenberg” block.
    5. piereg_email_service: Shows settings in the Marketing Tab (MailChimp Addon Settings).
    6. pireg_after_verification_users: Adds Subscriber to the Mail Chimp list after registration and verification.
    7. pie_user_control_on_registration: User restriction on registration. (Premium)
    8. pie_user_control_on_login: User restriction on login. (Premium)
    9. pie_validate_before_login: Hooks a function to validate form before login.
    10. admin_notices_specific_pages: Release notices on both PR Basic and PR Premium.
    11. check_payment_method_paypal: Adds PayPal payment method.
    12. pie_register_login_after_registration: Auto-logins users after registration.
    13. payment_validation_paypal: Validates PayPal payment method.
    14. add_select_payment_script: Defines script for the selection of payment method.
    15. show_icon_payment_gateway: Displays icon for payment gateway (PayPal).
    16. pr_licenseKey_errors: Displays PR License notice.
    17. piereg_validate_user_expiry_period: Validates user expiry period.
    18. add_payment_method_script: Adds jQuery script for payment method.
    19. retrieve_password_key: Gets password key for specific user.
    20. pieresetpass: Hooks a function on reset password.
    21. piereg_action_hook_before_user_activate: Hooks a function before user activation.
    22. piereg_action_hook_after_user_activate: Hooks a function after user activation.
    23. pie_deactivation_base: Hooks a function on plugin deactivation.
    24. pie_uninstall_base: Hooks a function on plugin uninstallation.
    25. pieregister_meta_update_woocommerce_billing_address: Updates user’s woocommerce billing address.
    26. pieregister_meta_update_woocommerce_shipping_address: Updates user’s woocommerce shipping address.
    27. pieregister_registration_validation_before: Hooks a function before validating registration.
    28. pieregister_registration_validation_after: Hooks a function after validating registration.
    29. pieregister_update_usermeta_piereg_field: Updates User Meta for specific PR field.
    30. pieregister_plugin_installed: Hooks a function on successful plugin installation.
    31. piereg_show_bulk_email_settings: Use to display Bulk Email Settings.
    32. pieregister_print_shortcode: Prints short code on “Pie Register Help”.
    33. pieregister_addons_listing: Use to list Pie Register’s Add-Ons.
    34. pie_register_payment_setting_menus: Adds Authorize.Net settings menu.
    35. pie_register_Authorize_Net_paymentgateways: Adds Authorize.Net settings page.
    36. pie_register_PaymentGateways: Gets payment gateway’s page.
    37. admin_notices_specific_pages: Displays notice on the Manage Form page.
    38. piereg_getting_geo_location_menu: Displays geo-location Add-On Page.
    39. pieregister_plugin_activated: Hooks a function on Pie Register activation.
    40. pieregister_plugin_deactivated: Hooks a function on Pie Register deactivation.
    41. piereg_action_hook_before_user_verified: Hooks a function before user verification.
    42. pie_register_after_social_login: Hooks a function before login through social login.
    43. pie_register_after_login: Hooks a function after successful login.
    44. piereg_user_login_before_redirect_hook: Hooks a function before redirecting user after successful login.
    45. piereg_add_addon_menu_profile_search: Adds “Profile Search Add On” menu in dashboard.
    46. piereg_add_addons_menu: Hooks a function to add Add-on’s menu in dashboard.
    47. pie_register_add_menu: Hooks a function to add menu.
    48. pie_fields_save: Hooks a function to save PR field’s data.
    49. pie_register_before_register_validate: Hooks a function before validating registration form.
    50. pie_register_after_register_validate: Hooks a function after validating registration form.
    51. pie_register_after_register: Hooks a function to add new user after registration.
    52. piereg_action_before_admin_notify_email: Hooks a function before admin notification email.
    53. piereg_new_user_import: Hooks a function on user import.
    54. piereg_update_profile_event: Hooks a function when user updates profile.
    55. piereg_admin_login_before_redirect_hook: Hooks a function before redirecting user, after successful login.
    56. piereg_before_deleting_user_unverified_list: Hooks a function before deleting an unverified user.

 

PIEREGISTER FILTER HOOKS:

  1. pie_register_forgot_pass_container_class: To add additional css classes for forgot password form.
  2. piereg_forgot_invalid_captcha_error: Message shown for invalid captcha on forgot password form.
  3. piereg_forgot_invalid_user_error: message shown if matching user account is not found on submission of forgot password form.
  4. allow_password_reset: Check if user is active and is allowed to reset password.
  5. piereg_password_reset_not_allowed_text: message shown if user is not allowed to reset password.
  6. piereg_message_will_be_sent_to_your_email: message shown when user is allowed to reset password.
  7. piereg_reset_password_warning: Displays message to enter new password.
  8. piereg_reset_password_error: Displays an error message when new and confirm password fields do not match.
  9. piereg_reset_password_success: Displays message when password has been reset.
  10. pie_getpassword_form_links: Displays anchor links on reset password form.
  11. pie_register_frontend_login_container_class: To add additional css wrapper classes for login form.
  12. piereg_success_message: Displays message on successful payment.
  13. piereg_cancled_message: Displays message when user cancels the payment.
  14. piereg_login_error: Displays an error message on login.
  15. piereg_now_logout: Displays message when user has logged out.
  16. piereg_check_yor_emailconfrm_link: Displays message to ask user to check email for confirmation link.
  17. piereg_canelled_your_registration: Displays message when user has cancels the registration.
  18. piereg_thank_you_for_registration: Displays thank You message on registration.
  19. piereg_your_account_is_now_active: Displays message when user account is active.
  20. piereg_invalid_activation_key: Displays message on invalid activation key.
  21. piereg_canelled_your_registration: Displays message when registration has been cancelled if certain user account already exists.
  22. piereg_you_key_has_been_expired: Displays message when reset password link has been expired.
  23. piereg_this_reset_key_invalid_or_no_longer_exists: Displays message when reset key is invalid or expired.
  24. piereg_invalid_password: Displays an error message if user enters invalid password.
  25. piereg_minimum_8_characters_required_in_password: Displays a validation message that password must be at least 8 characters long.
  26. piereg_the_passwords_do_not_match: Displays an error message when new password and confirm new password fields doesnot match.
  27. piereg_your_password_has_been_reset: Displays message when password has been reset.
  28. piereg_messages: Use to display messages.
  29. piereg_messages_error: Use to display error messages.
  30. piereg_messages_warning: Use to display warning messages.
  31. get_payment_content_area: Defines HTML structure for payment area.
  32. Add_payment_option: Displays payment options.
  33. piereg_profile_image_url: Filters the image URL for profile picture.
  34. pie_getb_admin_path: Filters the plugin’s admin path.
  35. piereg_dropdown_please_select: Filters the first option for select field i.e.: “–Please Select –“
  36. piereg_fail_to_upload_profile_picture: Displays message when failed to upload profile picture.
  37. piereg_invalid_file_type_in_profile_picture: Displays message when user uploads profile picture with invalid file type.
  38. piereg_terms_field_text: Displays text for terms and Conditions Field.
  39. piereg_invalid_file: Displays message when user uploads invalid file.
  40. piereg_invalid_Email_address: Displays message when user enters invalid email address.
  41. piereg_password_Fields_do_not_match: Displays message when New and Confirm Password fields do not match.
  42. piereg_old_password_Fields_do_not_match: Displays message when user enters invalid old password.
  43. piereg_old_password_and_new_password_same: Displays message when old password and new password fields are identical.
  44. piereg_problem_and_the_email_was_probably_not_sent: Displays message when there is a problem in sending email.
  45. piereg_invalid_invitaion_code: Displays message when user enters invalid invitation code.
  46. piereg_invitaion_code_expired: Displays message when invitation code has been expired.
  47. piereg_field_must_contain_only_numbers: Displays a validation message that field must only contain numbers.
  48. piereg_field_may_only_contain_alpha_numeric_characters: Displays a validation message that field must only contain alpha-numeric characters.
  49. piereg_field_may_only_contain_alphabetic_characters: Displays a validation message that field must only contain letters.
  50. piereg_field_must_contain_a_valid_email_address: Displays a validation message that field must contain a valid email address.
  51. piereg_must_be_a_valid_URL: Displays a validation message that field must contain a valid URL.
  52. piereg_invalid_phone_field: Displays message when user enters invalid phone number.
  53. piereg_useredit_data_before_updating: Filters the user data on edit profile before updating user.
  54. piereg_invalid_profile_picture: Displays message when user uploads invalid profile picture.
  55. piereg_Invlid_upload_file: Displays message when user uploads invalid file.
  56. piereg_Invalid_Username: Displays message when user enters invalid username.
  57. piereg_Username_already_exists: Displays message when entered username already exists.
  58. piereg_Email_address_already_exists: Displays message when entered email address already exists.
  59. piereg_ipaddress_blocked: Displays message when IP address has been blocked by the administrator.
  60. piereg_username_blocked: Displays message when user ID has been blocked by the administrator.
  61. piereg_email_blocked: Displays message when email address has been blocked by the administrator.
  62. piereg_form_limit_submissions: Displays message when form submission limit has been exceeded.
  63. piereg_form_time_submission: Displays message when form submission time has been exceeded.
  64. pie_addon_field_visibility_conditions: Filters visibility check on certain field.
  65. piereg_invalid_expiry_date: Displays message when expiry date for invitation code is invalid.
  66. piereg_Invalid_Security_Code: Displays message when user enters invalid security code (Captcha Value).
  67. piereg_userreg_data_before_adding: Filters the user data on registration before adding user.
  68. pieregister_divi_builder_form_title: Filters form title on “Divi Builder”.
  69. pieregister_divi_builder_form_desc: Filters form description on “Divi Builder”.
  70. pieregister_print_woocommerce_fields_tab: Displays tabs for woocommerce fields.
  71. pie_forgotpassword_form_links: Displays links on forgot password form.
  72. pie_password_strength_length: Defines minimum required length for password.
  73. piereg_edit_above_form_data: Filters form data (css, label and description).
  74. pie_login_form_links: Displays links on login form.
  75. pr_backend_hook_suffixes: Filters list of “backend hook suffixes”.
  76. pie_reg_form_logged_in_msg: Displays logged in message.
  77. piereg_invalid_verification_key: Displays message on invalid verification key.
  78. piereg_Invalid_username_or_password: Displays message when user enters Invalid username or password.
  79. blocked_ip_due_to_many_attempts_failed: Displays message when IP Address is blocked due to too many failed login attempts.
  80. pie_invalid_username_password_msg_txt: Displays message when user enters Invalid username or user email.
  81. pie_invalid_user_password_msg_txt: Displays message when user enters Invalid password.
  82. piereg_your_account_is_not_active: Displays message when inactive user attempts to login.
  83. piereg_something_went_wrong_msg: Displays message for login error when something goes wrong.
  84. piereg_username_allowed: Displays message when certain user has not been allowed by administrator.
  85. piereg_email_allowed: Displays message when certain email address has not been allowed by administrator.
  86. piereg_thank_you_for_your_registration_admin_veri: Displays thank you message on registration when admin verification is enabled.
  87. piereg_thank_you_for_your_registration_email_veri: Displays thank you message on registration when email verification is enabled.
  88. piereg_thank_you_for_your_registration_admin_email_veri: Displays thank you message on registration when both admin and admin verifications are enabled.
  89. piereg_settings_saved: Displays message when user saves settings.
  90. piereg_didnt_select_file_to_import: Displays message when the user does not select a file to import users
  91. piereg_msg_deleted_unverified_user: Displays message when an unverified user has been removed.
  92. pie_register_frontend_container_class: To add additional css classes for registration form.
  93. pie_login_form_logged_in_msg: Displays message on login form when user is already logged in.
  94. pie_forgot_form_logged_in_msg: Displays message on forgot password form when user is already logged in.
  95. piereg_after_profile_printed: Filters the profile form content.
  96. piereg_profile_if_not_loggedin: Displays message on profile when user is not logged in.
  97. piereg_invalid_auth_keys_hash: Displays message on invalid renew account key hash.
  98. piereg_invalid_auth_keys: Displays message on invalid user authentication.
  99. you_are_already_active: Displays message if user is already active.
  100. piereg_Please_Select_any_payment_method: Displays message that asks user to select any payment method.
  101. piereg_Invalid_Fields: Displays message when user attempts to login with invalid field input.
  102. piereg_problem_and_the_email_was_probably_not_sent: Displays message when problem occurs in s ending email.
  103. pieregister_docs_url: Filters the Pie Register documentation URL.
  104. pieregister_support_url: Filters the Pie Register support URL.
  105. pie_add_hidden_field_addon: Filters readability of field if field visibility Add On is active.
  106. pieregister_print_woocommerce_billing_address_front: Displays woocommerce billing address on frontend.
  107. pieregister_print_woocommerce_shipping_address_front: Displays woocommerce shipping address on frontend.
  108. pieregister_print_woocommerce_billing_address_front_template: Displays frontend template for woocommerce billing address.
  109. pieregister_print_woocommerce_shipping_address_front_template: Displays frontend template for woocommerce shipping address.
  110. pieregister_create_woocommerce_billing_fields: Creates woocommerce billing fields.
  111. pieregister_create_woocommerce_shipping_fields: Creates woocommerce shipping fields.
  112. pieregister_display_woocommerce_billing_address: Displays woocommerce billing address.
  113. pieregister_display_woocommerce_shipping_address: Displays woocommerce shipping address.
  114. pieregister_print_woocommerce_billing_address_admin_profile: Displays woocommerce billing address on admin profile.
  115. pieregister_print_woocommerce_shipping_address_admin_profile: Displays woocommerce shipping address on admin profile.
  116. pieregister_print_woocommerce_billing_address_admin: Displays woocommerce billing address on admin.
  117. pieregister_print_woocommerce_shipping_address_admin: Displays woocommerce shipping address on admin.
  118. get_enable_social_sites_button_widgets: Displays content for social login form in widgets.
  119. piereg_login_sms_form: Displays login SMS form when PR Add On Twilio is activated.
  120. pie_register_frontend_login_output_before: Before output hook to render PR login form.
  121. pie_register_frontend_login_output_after: After output hook to render PR login form.
  122. pie_register_frontend_output_before: Before output hook to render selected form.
  123. pie_register_frontend_output_after: After output hook to render selected form.
  124. pie_register_forgot_pass_output_before: Before output hook to render “Forgot Password Form”
  125. pie_register_forgot_pass_output_after: After output hook to render “Forgot Password Form”.
  126. piereg_renew_account_error: Displays an error message on ‘Renew Account’.
  127. piereg_Renew_Account: Filters renew account message.
  128. pie_profile_image_frontend_widget: Displays profile image in widget; on frontend.
  129. pie_profile_username_frontend_widget: Displays profile username in widget; on frontend.
  130. pie_addon_field_visibility_settings: Displays settings for “Field Visibility” Add On.
  131. pie_add_hidden_field_addon: Filters readability of field when ‘Field Visibility’ Add On is activated.
  132. pie_addon_readibility: Filters read-only property for field when ‘Field Visibility’ Add On is activated.
  133. pie_visibility_on_reg: Filters visibility of field on registration form when ‘Field Visibility’ Add On is activated.
  134. get_payment_gateway_content: Displays payment gateway form.
  135. pieregister_print_subscription_checkbox: Use to display Mail Chimp’s newsletter subscription checkbox.
  136. puc_is_slug_in_use: Gets absolute path to the main plugin file.
  137. pie_user_veri_by_email_admin: Displays message when user has been verified by “Admin Email Verification”
  138. piereg_user_from_social_login: User verification for social login.
  139. piereg_generate_unique_username: Filters Boolean value; whether to generate unique username or not.
  140. piereg_generate_username_with_prifex: Filters Boolean value; whether to get username with prefix or not.
  141. piereg_login_after_registration_error: Shows error message on login after registration.
  142. piereg_check_email_allowed_to_send: Checks if admin notifications are enabled or not before sending admin notifications.
  143. admin_footer_text: Modifies the “Thank you” text displayed in the admin footer
  144. pre_get_users: Search users by PR Forms and Search users by Invitation Codes.
  145. piereg_payment_success: Use to display a message after successful payment.
  146. piereg_select_field: Use to display dropdown for three specific fields; ‘dropdown’,’multiselect’, and ‘custom_role’.
  147. piereg_before_visibility_restrictions_metabox: Checks if  Pie Register – Page Restrictions settings per post/page are to be shown.
  148. piereg_invitation_code_char_check: Modifies the Invitation Code Character Regex.
  149. piereg_invitation_code_char_verification: Modifies the Invitation Code Character verification Regex.
  150. piereg_set_redirect_uri: Modifies the redirect URL after login.