BBP_Forums_Admin::row_actions( array $actions = array(), object $forum = false )

Forum Row actions


Description Description

Remove the quick-edit action link and display the description under the forum title and add the open/close links


Parameters Parameters

$actions

(Optional) Actions

Default value: array()

$forum

(Optional) Forum object

Default value: false


Top ↑

Return Return

(array) $actions Actions


Top ↑

Source Source

File: includes/admin/forums.php

	public function row_actions( $actions = array(), $forum = false ) {

		// Disable quick edit (too much to do here)
		unset( $actions['inline hide-if-no-js'] );

		// Only show the actions if the user is capable of viewing them :)
		if ( current_user_can( 'edit_forum', $forum->ID ) ) {

			// Show the 'close' and 'open' link on published, private, hidden and closed posts only
			if ( in_array( $forum->post_status, array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id(), bbp_get_closed_status_id() ), true ) ) {
				$close_uri = wp_nonce_url( add_query_arg( array( 'forum_id' => $forum->ID, 'action' => 'bbp_toggle_forum_close' ), remove_query_arg( array( 'bbp_forum_toggle_notice', 'forum_id', 'failed', 'super' ) ) ), 'close-forum_' . $forum->ID );
				if ( bbp_is_forum_open( $forum->ID ) ) {
					$actions['closed'] = '<a href="' . esc_url( $close_uri ) . '" title="' . esc_attr__( 'Close this forum', 'bbpress' ) . '">' . _x( 'Close', 'Close a Forum', 'bbpress' ) . '</a>';
				} else {
					$actions['closed'] = '<a href="' . esc_url( $close_uri ) . '" title="' . esc_attr__( 'Open this forum',  'bbpress' ) . '">' . _x( 'Open',  'Open a Forum',  'bbpress' ) . '</a>';
				}
			}
		}

		// simple hack to show the forum description under the title
		bbp_forum_content( $forum->ID );

		// Sort & return
		return $this->sort_row_actions( $actions );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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