'wpal_host',
'name' => 'host',
)
);
add_settings_field(
'wpal_user',
'Username',
array( $this, 'wpal_field_input' ),
'wpal-db-settings',
'wpal-settings-section',
array(
'label_for' => 'wpal_user',
'name' => 'user',
)
);
add_settings_field(
'wpal_pass',
'Password',
array( $this, 'wpal_field_input' ),
'wpal-db-settings',
'wpal-settings-section',
array(
'label_for' => 'wpal_pass',
'name' => 'pass',
'type' => 'password',
)
);
add_settings_field(
'wpal_db',
'Database',
array( $this, 'wpal_field_input' ),
'wpal-db-settings',
'wpal-settings-section',
array(
'label_for' => 'wpal_db',
'name' => 'database',
)
);
}
/**
* Renders individual input fields for the database settings form.
*
* Generates input fields (text or password) based on provided arguments.
* Retrieves current values from the wpal-settings option and ensures proper
* escaping for security.
*
* @since 1.0.0
*
* @param array $args {
* Arguments for rendering the input field.
*
* @type string $label_for HTML 'id' and 'for' attribute for the input label.
* @type string $name Name of the input field in the wpal-settings array.
* @type string $type Input type (e.g., 'text', 'password'). Default 'text'.
* }
*/
public function wpal_field_input( $args ) {
$options = get_option( 'wpal-settings' );
$value = isset( $options[ $args['name'] ] ) ? $options[ $args['name'] ] : '';
$type = isset( $args['type'] ) ? $args['type'] : 'text';
?>
wpal_features = $wpal_features;
}
/**
* Renders the main WPAL plugin dashboard page.
*
* Displays the title "User Activity Logs" and delegates to the WPAL_Features
* class’s wpal_display_log method to render a table of user activity logs.
*
* @since 1.0.0
*/
public function wpal_settings_page() {
?>
wpal_features ) {
$this->wpal_features->wpal_display_log();
}
}
/**
* Logs all existing WordPress users into the activity log database.
*
* Retrieves all WordPress users and logs their details (ID, username, email, role)
* using the WPAL_Features class. Typically called during plugin activation to
* populate the user log table.
*
* @since 1.0.0
*/
public function wpal_users_init() {
if ( $this->wpal_features ) {
$this->wpal_features->wpal_initialize_users();
}
}
}
?>