public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/setup.php
/**
 * Create screen optionsn for the course dashboard page.
 *
 * @since 4.1.0
 */
Create screen optionsn for the course dashboard page.
Create screen optionsn for the course dashboard page .
function WPCW_course_dashboard_screen_options() {
	$user_id = get_current_user_id();
	if ( isset( $_POST['course_dashboard_screen_options_submit'] ) AND $_POST['course_dashboard_screen_options_submit'] == 1 ) {
		if ( isset( $_POST['quiz_notification_hide'] ) && $_POST['quiz_notification_hide'] = 'show' ) {
			update_user_meta( $user_id, 'wpcw_course_dashboard_quiz_notification_hide', 'show', 'hide' );
		} else {
			update_user_meta( $user_id, 'wpcw_course_dashboard_quiz_notification_hide', 'hide', 'show' );
		}
		if ( isset( $_POST['wpcw_courses_per_page'] ) && $_POST['wpcw_courses_per_page'] > 0 ) {
			update_user_meta( $user_id, 'wpcw_courses_per_page', $_POST['wpcw_courses_per_page'], '' );
		}
	}
	$screen = get_current_screen();
	add_filter( 'screen_layout_columns', function ( $html ) {
		$user_id = get_current_user_id();
		$html    = sprintf( '<div id="screen-options-wrap">
			<form name="course_dashboard_screen_options_form" method="post">
				<input type="hidden" name="course_dashboard_screen_options_submit" value="1">
				<legend>WP Courseware - Course Dashboard Options</legend>
					<fieldset >
						<label>Enable/Disable - Quiz Notifications</label><input class="hide-column-tog" name="quiz_notification_hide" type="checkbox" id="quiz_notification_hide" value="%s" %s>
					</fieldset>
					<fieldset >
						<label for="wpcw_courses_per_page">Number of courses per page:</label><input type="number" step="1" min="1" max="50" class="screen-per-page" name="wpcw_courses_per_page" id="wpcw_courses_per_page" maxlength="3" value="%d">
					</fieldset>
						<p class="submit"><input type="submit" name="screen-options-apply" id="screen-options-apply" class="button button-primary" value="Apply"></p>
			</form>
			</div>',
			$quiz_notify = ( get_user_meta( $user_id, 'wpcw_course_dashboard_quiz_notification_hide', true ) != false ) ? get_user_meta( $user_id, 'wpcw_course_dashboard_quiz_notification_hide', true ) : 'hide',
			$quiz_notify_check = ( get_user_meta( $user_id, 'wpcw_course_dashboard_quiz_notification_hide', true ) != 'show' ) ? '' : 'checked',
			$course_per_page = ( get_user_meta( $user_id, 'wpcw_courses_per_page', true ) != false ) ? get_user_meta( $user_id, 'wpcw_courses_per_page', true ) : 20
		);
		echo $html;
	} );
	$screen->add_option( 'my_option', '' );
}
function WPCW_course_dashboard_screen_options ( ) { $ user_id = get_current_user_id ( ) ; if ( isset ( $ _POST [ 'course_dashboard_screen_options_submit' ] ) AND $ _POST [ 'course_dashboard_screen_options_submit' ] == 1 ) { if ( isset ( $ _POST [ 'quiz_notification_hide' ] ) && $ _POST [ 'quiz_notification_hide' ] = 'show' ) { update_user_meta ( $ user_id , 'wpcw_course_dashboard_quiz_notification_hide' , 'show' , 'hide' ) ; } else { update_user_meta ( $ user_id , 'wpcw_course_dashboard_quiz_notification_hide' , 'hide' , 'show' ) ; } if ( isset ( $ _POST [ 'wpcw_courses_per_page' ] ) && $ _POST [ 'wpcw_courses_per_page' ] > 0 ) { update_user_meta ( $ user_id , 'wpcw_courses_per_page' , $ _POST [ 'wpcw_courses_per_page' ] , '' ) ; } } $ screen = get_current_screen ( ) ; add_filter ( 'screen_layout_columns' , function ( $ html ) { $ user_id = get_current_user_id ( ) ; $ html = sprintf ( '<div id="screen-options-wrap">
			<form name="course_dashboard_screen_options_form" method="post">
				<input type="hidden" name="course_dashboard_screen_options_submit" value="1">
				<legend>WP Courseware - Course Dashboard Options</legend>
					<fieldset >
						<label>Enable/Disable - Quiz Notifications</label><input class="hide-column-tog" name="quiz_notification_hide" type="checkbox" id="quiz_notification_hide" value="%s" %s>
					</fieldset>
					<fieldset >
						<label for="wpcw_courses_per_page">Number of courses per page:</label><input type="number" step="1" min="1" max="50" class="screen-per-page" name="wpcw_courses_per_page" id="wpcw_courses_per_page" maxlength="3" value="%d">
					</fieldset>
						<p class="submit"><input type="submit" name="screen-options-apply" id="screen-options-apply" class="button button-primary" value="Apply"></p>
			</form>
			</div>' , $ quiz_notify = ( get_user_meta ( $ user_id , 'wpcw_course_dashboard_quiz_notification_hide' , true ) != false ) ? get_user_meta ( $ user_id , 'wpcw_course_dashboard_quiz_notification_hide' , true ) : 'hide' , $ quiz_notify_check = ( get_user_meta ( $ user_id , 'wpcw_course_dashboard_quiz_notification_hide' , true ) != 'show' ) ? '' : 'checked' , $ course_per_page = ( get_user_meta ( $ user_id , 'wpcw_courses_per_page' , true ) != false ) ? get_user_meta ( $ user_id , 'wpcw_courses_per_page' , true ) : 20 ) ; echo $ html ; } ) ; $ screen -> add_option ( 'my_option' , '' ) ; }
Create screen optionsn for the course dashboard page.
Create screen optionsn for the course dashboard page .
// Check for form submission // Initiate the $screen variable. // Add our custom HTML to the screen options panel. // Register our new screen options tab.