bp_nouveau_document_activity_edit_button( array $buttons, int $activity_id )

Edit button alter when document activity other than activity page.

Description

Parameters

$buttons

(Required) Array of Buttons visible on activity entry.

$activity_id

(Required) Activity ID.

Return

(mixed)

Source

File: bp-templates/bp-nouveau/includes/document/functions.php

function bp_nouveau_document_activity_edit_button( $buttons, $activity_id ) {
	if ( isset( $buttons['activity_edit'] ) && ( bp_is_document_component() || ! bp_is_activity_component() ) && ! empty( $_REQUEST['action'] ) && 'document_get_activity' === $_REQUEST['action'] ) {
		$activity = new BP_Activity_Activity( $activity_id );

		if ( ! empty( $activity->id ) && 'document' !== $activity->privacy ) {
			$buttons['activity_edit']['button_attr']['href']  = bp_activity_get_permalink( $activity_id ) . 'edit';

			$classes  = explode( ' ', $buttons['activity_edit']['button_attr']['class'] );
			$edit_key = array_search( 'edit', $classes, true );
			if ( ! empty( $edit_key ) ) {
				unset( $classes[ $edit_key ] );
			}
			$buttons['activity_edit']['button_attr']['class'] = implode( ' ', $classes );
		}
	}

	return $buttons;
}

Changelog

Changelog
Version Description
BuddyBoss 1.5.1 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.