BBP_Admin::modify_plugin_action_links( array $links, string $file )

Add Settings link to plugins area

Description

Parameters

$links

(array) (Required) Links array in which we would prepend our link

$file

(string) (Required) Current plugin basename

Return

(array) Processed links

Source

File: bp-forums/admin/admin.php

	public static function modify_plugin_action_links( $links, $file ) {

		// Return normal links if not Forums
		if ( plugin_basename( bbpress()->file ) !== $file ) {
			return $links;
		}

		// New links to merge into existing links
		$new_links = array();

		// Settings page link
		if ( current_user_can( 'bbp_settings_page' ) ) {
			$new_links['settings'] = '<a href="' . esc_url( add_query_arg( array( 'page' => 'bbpress'   ), admin_url( 'options-general.php' ) ) ) . '">' . esc_html__( 'Settings', 'buddyboss' ) . '</a>';
		}

		// About page link
		if ( current_user_can( 'bbp_about_page' ) ) {
			$new_links['about']    = '<a href="' . esc_url( add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php'           ) ) ) . '">' . esc_html__( 'About',    'buddyboss' ) . '</a>';
		}

		// Add a few links to the existing links array
		return array_merge( $links, $new_links );
	}

Changelog

Changelog
Version Description
bbPress (r2737) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.