wpal_db = $wpal_db; $this->wpal_log = $wpal_log; add_action( 'admin_init', array( $this->wpal_db, 'wpal_exportData' ) ); } /** * Logs all existing WordPress users into the activity log database. * * Retrieves all WordPress users using the get_users function and logs their details * (ID, username, email, and primary role) using the WPAL_LOG class. This method is * typically called during plugin activation to populate the user log table, ensuring * an initial record of all users for activity tracking purposes. Handles cases where * a user may not have a role assigned. * * @since 1.0.0 */ public function wpal_initialize_users() { $users = get_users(); if($users){ foreach ( $users as $user ) { $user_id = $user->ID; $user_name = $user->user_login; $user_email = $user->user_email; $user_role = $user->roles[0]; $this->wpal_log->wpal_user_log( $user_id, $user_name, $user_email, $user_role ); } } } /** * Displays the activity log table in the admin interface. * * Invokes the wpal_displayActivityTable method of the WPAL_DB class to render the * activity log table within the WordPress admin dashboard. This method provides a * user-friendly interface for administrators to view logged activities, leveraging * the database operations handled by the WPAL_DB class. * * @since 1.0.0 */ public function wpal_display_log() { $this->wpal_db->wpal_displayActivityTable(); } } ?>