wp_lib_dash_action_ - roberts-sandbox/create-repo GitHub Wiki
###Description
This action hook allows developers to modify a specific Dash action. Dash actions are requests from the Library Dashboard to modify the library in some way. This hook could be used to add a custom Dash action.
Call this hook with the name of the action you want to modify/add, so to modify WP-Librarian's behaviour when returning an item use wp_lib_dash_action_return-item.
###Context
To access the Library Dashboard users must be at the minimum a librarian and thus logged in as a WordPress user. No nonce validation has yet happened as nonces are specific to the Dash page they came from.
###Parameters
$ajax_action
The instance of WP-Librarian's Dashboard action class WP_LIB_AJAX_ACTION. Access to this is necessary to handle completing the AJAX request properly.
###Example
Suppose you want to disallow all non-Library Admins from deleting Items, Members, Loans or Fines. You could use the following code:
add_action('wp_lib_dash_action_delete-object', 'my_fortune');
function my_fortune(WP_LIB_AJAX_ACTION $ajax_action) {
// If user a is a library admin, allows them to continue
if (wp_lib_is_library_admin())
return;
$ajax_action->addNotification('Only Library Admins are allowed to delete things', 1);
$ajax_action->endAction(false);
}
So, when non-admins try to delete something they see:

Note: In order to get the notification to display on the Dashboard as an error you need to pass 1 after your message to addNotification(). This tells WP-Librarian that it's an error message but it hasn't got its own WP-Librarian error code. If you've used an appropriate filter to add your own custom error to the plugin's error listings then by all means use that instead.
###See Also
wp_lib_dash_action wp_lib_dash_page wp_lib_dash_page_ wp_lib_dash_api wp_lib_dash_api_