LLMS_Admin_Menus::builder_page_actions()

Handle init actions on the course builder page


Description Description

Used for post-locking redirects when taking over from another user on the course builder page.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class.llms.admin.menus.php

	public function builder_page_actions() {

		if ( ! isset( $_GET['page'] ) || 'llms-course-builder' !== $_GET['page'] ) {
			return;
		}

		if ( ! empty( $_GET['get-post-lock'] ) && ! empty( $_GET['course_id'] ) ) {
			$post_id = absint( $_GET['course_id'] );
			check_admin_referer( 'lock-post_' . $post_id );
			if ( ! current_user_can( 'edit_post', $post_id ) ) {
				wp_die( esc_html__( 'You are not authorized to edit this course.', 'lifterlms' ) );
			}
			wp_set_post_lock( $post_id );
			wp_safe_redirect(
				add_query_arg(
					array(
						'page'      => 'llms-course-builder',
						'course_id' => $post_id,
					),
					admin_url( 'admin.php' )
				)
			);
			exit();

		}

		add_action( 'admin_bar_menu', array( 'LLMS_Admin_Builder', 'admin_bar_menu' ), 100, 1 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
9.2.3 Add capability check before setting post lock.
3.16.7 Unknown.
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.