Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.


Handle tools actions

Return Return


Top ↑

Source Source

File: includes/admin/

	private static function do_tool() {

		if ( ! llms_verify_nonce( '_wpnonce', 'llms_tool' ) || ! current_user_can( 'manage_lifterlms' ) ) {
			wp_die( __( 'Action failed. Please refresh the page and retry.', 'lifterlms' ) );

		$tool = llms_filter_input_sanitize_string( INPUT_POST, 'llms_tool' );

		 * Custom and 3rd party tools can use this action to perform the tool's action
		 * @since Unknown
		 * @see llms_status_tools For the filter used to register tools.
		 * @param string $tool Tool name or ID.
		do_action( 'llms_status_tool', $tool );

		switch ( $tool ) {

			case 'clear-cache':
				global $wpdb;
				$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
					"DELETE FROM {$wpdb->usermeta} WHERE meta_key = 'llms_overall_progress' or meta_key = 'llms_overall_grade';"


			case 'reset-tracking':
				update_option( 'llms_allow_tracking', 'no' );

			case 'setup-wizard':
				llms_redirect_and_exit( esc_url_raw( admin_url( 'admin.php?page=llms-setup' ) ) );


Top ↑

Changelog Changelog

Version Description
5.9.0 Stop using deprecated FILTER_SANITIZE_STRING.
4.13.0 The automatic-payments tool has been moved to LLMS_Admin_Tool_Reset_Automatic_Payments.
4.0.0 The clear-sessions tool has been moved to LLMS_Admin_Tool_Clear_Sessions.
3.37.14 Verify user capabilities when doing a tool action. Use llms_redirect_and_exit() in favor of wp_safe_redirect().
3.35.0 Sanitize input data.
3.11.2 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.