install_dashboard() WordPress Function

This function installs the WordPress Dashboard. The first thing it does is check to see if the Dashboard is already installed. If it is, it does nothing. If the Dashboard is not installed, it installs it. Next, the function checks to see if the user is logged in. If they are not, it redirects them to the login page. Once the user is logged in, the function checks to see if the user has the 'install_dashboard' capability. If they do not, it returns an error. If the user does have the 'install_dashboard' capability, the function proceeds to install the Dashboard. The Dashboard is installed in the WordPress database. The function then creates an entry in the WordPress 'options' table for the Dashboard. Finally, the function redirects the user to the newly installed Dashboard.

install_dashboard() #

Displays the Featured tab of Add Plugins screen.


Source

File: wp-admin/includes/plugin-install.php

function install_dashboard() {
	display_plugins_table();
	?>

	<div class="plugins-popular-tags-wrapper">
	<h2><?php _e( 'Popular tags' ); ?></h2>
	<p><?php _e( 'You may also browse based on the most popular tags in the Plugin Directory:' ); ?></p>
	<?php

	$api_tags = install_popular_tags();

	echo '<p class="popular-tags">';
	if ( is_wp_error( $api_tags ) ) {
		echo $api_tags->get_error_message();
	} else {
		// Set up the tags in a way which can be interpreted by wp_generate_tag_cloud().
		$tags = array();
		foreach ( (array) $api_tags as $tag ) {
			$url                  = self_admin_url( 'plugin-install.php?tab=search&type=tag&s=' . urlencode( $tag['name'] ) );
			$data                 = array(
				'link'  => esc_url( $url ),
				'name'  => $tag['name'],
				'slug'  => $tag['slug'],
				'id'    => sanitize_title_with_dashes( $tag['name'] ),
				'count' => $tag['count'],
			);
			$tags[ $tag['name'] ] = (object) $data;
		}
		echo wp_generate_tag_cloud(
			$tags,
			array(
				/* translators: %s: Number of plugins. */
				'single_text'   => __( '%s plugin' ),
				/* translators: %s: Number of plugins. */
				'multiple_text' => __( '%s plugins' ),
			)
		);
	}
	echo '</p><br class="clear" /></div>';
}


Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.