uCare Hooks
November 30, 2017
Hooks and Filters in WordPress allow you to insert code or edit content without having to edit core files. uCare makes the use of various hooks internally, which developers can leverage to extend the functionality of the plugin.
See below for a list of hooks that uCare uses. We plan on adding more hooks in the future. If you have any requests or recommendations regarding hooks that would help you make better use of uCare, get in touch and let us know.
Using uCare Hooks
This is no different that using any WordPress hook. You can create your own functions that hook on to certain actions.
ucare_enqueue_scripts
Use this hook to enqueue files to uCare. You can use this hook to load in custom css, javascript, font files. You can also enqueue your theme CSS & JS with this hook. It works exactly like the WordPress core enqueue system. See an example here.
support_user_registered
Fires right after a user registers and is added as a WP user. This hook receives an array of user data.
add_action( 'support_user_registered', 'your_function_name' ); function your_function_name( $userdata ) { // your code goes here }
support_ticket_created
Fires right after a new ticket is created. This hook receives a Post object.
add_action( 'support_ticket_created', 'your_function_name' ); function your_function_name( $ticket ) { // your code goes here }
support_ticket_updated
Fires right after a ticket has been updated. This hook receives the ticket as a parameter.
support_ticket_reply
Fires right after a response has been posted to a ticket. This hook receives the ticket as a parameter.
support_mark_ticket_stale
Fires right before a ticket is marked stale. This hook runs during a daily cron, and receives the ticket as a parameter.
support_autoclose_ticket
Fires right after a ticket is auto-closed. This hook runs during a daily cron, and receives the ticket as a parameter.
ucare_head
Useful for adding in-page CSS, JavaScript, linking in fonts etc..
add_action( 'ucare_head', function() { // add in your CSS // add your JS here });
ucare_body
Inject HTML to the top of the body
ucare_before_navbar
Before the navbar
ucare_after_navbar
After the navbar
ucare_ticket_side_bar
After the sidebar in the single ticket tab view
ucare_after_registration_fields
After the registration fields
ucare_before_filter_sidebar
Before the search bar in the sidebar filter