Runner::before_invoke_command()
Contents
Source Source
File: libraries/lifterlms-cli/src/Commands/Restful/Runner.php
public static function before_invoke_command() { /** * If `--user` was passed the user will already be set, otherwise there won't be a user. * * It is "safe" to assume that someone using the CLI has admin access and we'll set the current * user to be the first admin we find in the DB that has the `manage_options` cap. */ if ( ! get_current_user_id() ) { $user = \LLMS_Install::get_can_install_user_id(); if ( $user ) { wp_set_current_user( $user ); } } if ( \WP_CLI::get_config( 'debug' ) && ! defined( 'SAVEQUERIES' ) ) { define( 'SAVEQUERIES', true ); } }
Expand full source code Collapse full source code View on GitHub