LLMS_Admin_Review::admin_footer( string $text )

On LifterLMS admin screens replace the default footer text with a review request.


Parameters Parameters

$text

(string) (Required) Default footer text.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/admin/class-llms-admin-review.php

	public function admin_footer( $text ) {

		global $current_screen;

		// Show footer on our custom post types in admin, but not on the block editor.
		if (
			isset( $current_screen->post_type ) &&
			in_array( $current_screen->post_type, array( 'course', 'lesson', 'llms_review', 'llms_membership', 'llms_engagement', 'llms_order', 'llms_coupon', 'llms_voucher', 'llms_form', 'llms_achievement', 'llms_my_achievement', 'llms_certificate', 'llms_my_certificate', 'llms_email' ), true ) &&
			false === $current_screen->is_block_editor
		) {
			$show_footer = true;
		}

		// Show footer on our settings pages.
		// phpcs:disable WordPress.Security.NonceVerification.Recommended -- No nonce verification needed here
		// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No sanitization needed here, we're not gonna use this value other than for checks
		// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- No unslash needed here, we're not gonna use this value other than for checks
		if (
			( ! empty( $_GET['page'] ) && strpos( $_GET['page'], 'llms-' ) === 0 ) ||
			( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'lifterlms' ) === 0 )
		) {
			$show_footer = true;
		}
		// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
		// phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash

		// Exclude the wizard.
		if ( ! empty( $_GET['page'] ) && 'llms-setup' === $_GET['page'] ) {
			$show_footer = false;
		}
		// phpcs:enable WordPress.Security.NonceVerification.Recommended

		// Don't show footer on the Course Builder.
		if ( isset( $current_screen->base ) && 'admin_page_llms-course-builder' === $current_screen->base ) {
			$show_footer = false;
		}

		// Conditionally filter footer text with our content.
		if ( ! empty( $show_footer ) ) {

			$url  = 'https://wordpress.org/support/plugin/lifterlms/reviews/#new-post';
			$text = sprintf(
				wp_kses(
					/* Translators: %1$s = LifterLMS plugin name; %2$s = WP.org review link; %3$s = WP.org review link. */
					__( 'Please rate %1$s <a class="llms-rating-stars" href="%2$s" target="_blank" rel="noopener noreferrer">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href="%3$s" target="_blank" rel="noopener">WordPress.org</a> to help us spread the word. Thank you from the LifterLMS team!', 'lifterlms' ),
					array(
						'a' => array(
							'class'  => array(),
							'href'   => array(),
							'target' => array(),
							'rel'    => array(),
						),
					)
				),
				'<strong>LifterLMS</strong>',
				$url,
				$url
			);

		}

		return $text;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
7.1.3 Using strpos instead of str_starts_with for compatibility.
7.1.0 Show footer on our custom post types in admin, but not on the block editor.
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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