LLMS_Admin_Post_Tables::add_links( array $actions, WP_Post $post )

Adds clone links to post types which support lifterlms post cloning


Parameters Parameters

$actions

(array) (Required) Existing actions.

$post

(WP_Post) (Required) Post object.


Top ↑

Return Return

(string[])


Top ↑

Source Source

File: includes/admin/post-types/class.llms.post.tables.php

	public function add_links( $actions, $post ) {

		if ( current_user_can( 'edit_course', $post->ID ) && post_type_supports( $post->post_type, 'llms-clone-post' ) ) {
			$url                   = add_query_arg(
				array(
					'post_type' => $post->post_type,
					'action'    => 'llms-clone-post',
					'post'      => $post->ID,
				),
				admin_url( 'edit.php' )
			);
			$actions['llms-clone'] = '<a href="' . esc_url( $url ) . '">' . __( 'Clone', 'lifterlms' ) . '</a>';
		}

		if ( current_user_can( 'edit_course', $post->ID ) && post_type_supports( $post->post_type, 'llms-export-post' ) ) {
			$url                    = add_query_arg(
				array(
					'post_type' => $post->post_type,
					'action'    => 'llms-export-post',
					'post'      => $post->ID,
				),
				admin_url( 'edit.php' )
			);
			$actions['llms-export'] = '<a href="' . esc_url( $url ) . '">' . __( 'Export', 'lifterlms' ) . '</a>';
		}

		return $actions;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.33.1 Use edit_course instead of edit_post when checking capabilities.
3.3.0
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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