tag
__( 'Activity Log', 'aryo-aal' ), // menu label
'manage_options', // required cap to view this page
$this->slug = 'activity-log-settings', // page slug
array( &$this, 'display_settings_page' ) // callback
);
// this callback will initialize the settings for AAL
// add_action( "load-$this->hook", array( $this, 'register_settings' ) );
}
public function register_settings() {
// If no options exist, create them.
if ( ! get_option( $this->slug ) ) {
update_option( $this->slug, apply_filters( 'aal_default_options', array(
'logs_lifespan' => 'forever',
) ) );
}
// First, we register a section. This is necessary since all future options must belong to a
add_settings_section(
'general_settings_section', // ID used to identify this section and with which to register options
__( 'Display Options', 'aryo-aal' ), // Title to be displayed on the administration page
array( 'AAL_Settings_Fields', 'description' ), // Callback used to render the description of the section
$this->slug // Page on which to add this section of options
);
add_settings_field(
'logs_lifespan',
__( 'Keep logs for', 'aryo-aal' ),
array( 'AAL_Settings_Fields', 'select' ),
$this->slug,
'general_settings_section',
array(
'id' => 'logs_lifespan',
'page' => $this->slug,
'options' => array(
'' => __( 'Forever', 'aryo-aal' ),
'365' => __( 'A year', 'aryo-aal' ),
'90' => __( '6 months', 'aryo-aal' ),
'30' => __( 'A month', 'aryo-aal' ),
),
)
);
register_setting( 'aal-options', $this->slug );
}
public function display_settings_page() {
?>