Actions - roberts-sandbox/create-repo GitHub Wiki

Actions are a core part of WordPress development that allow plugins to hook the execution of code to specific contexts in the running of WordPress or a plugin, such that the code is executed when the context arises.

WP-Librarian contains a very limited range of actions as they only started being added around Spring 2015. Actions are slowly being added to appropriate places but please feel free to pester me via email if you want some actions added to particular parts of the plugin.

The two other reasons slowing addition of actions are:

  • Adding new actions requires writing up a whole documentation page. I have little free time between uni work as it is to work on coding WP-Librarian so adding/documenting actions eats into that time.
  • WP-Librarian is still in Alpha release, so many parts of it are subject to great change. I don't want to waste my time adding and documenting a actions only to then depreciate it a few months later.

###Dashboard Actions

Actions called from the AJAX classes, which handle loading Library Dashboard pages, performing Dash actions and Dash API requests.

wp_lib_dash_action
Called on all Dash Actions, which are AJAX requests from the Dashboard to modify the library in some way (such as loaning an item)

wp_lib_dash_action_
Called from a specific Dash Action based on the text after the last underscore. Allows you to modify the behaviour of a specific Dash Action.

wp_lib_dash_page
Called when loading any Dash Page. A Dash Page is a dynamically loaded page on the Dashboard, such as the 'Managing Item' page.

wp_lib_dash_page_
Called from a request to load a specific Dash Page based on the text after the last underscore. Allows you to add/override a specific Dash Page's content.

wp_lib_dash_api
Called when processing every Dash API requests. These handle fetching data or modifying the library in some way (such as dynamically displaying the selected member's metabox when loaning an item).

wp_lib_dash_api_
Called when processing a specific Dash API request. This plugin's Dev Kit uses this hook to create and delete fixture data.

###Library Actions

Actions called when loan/returning items and other similar behaviour

wp_lib_loan_created
Called after a Loan has been created, which occurs when scheduling a loan or loaning an Item but not when giving an Item.

wp_lib_fine_created
Called after a Fine has been created, which occurs if an Item has been returned late and the librarian explicitly chooses to fine the Member.

###Settings Actions

Actions called when loading the settings page or processing settings updates

wp_lib_settings_page
Called when loading the plugin's settings page. This hook can be used to enqueue custom scripts/styles. Potentially to be used with a custom settings tab

⚠️ **GitHub.com Fallback** ⚠️