Skip to:
Content

Opened 3 years ago

Closed 8 months ago

Last modified 3 months ago

#2696 closed defect (fixed)

Double usage of action 'bbp_author_metabox'

Reported by: cyrilbatillat Owned by:
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5.4
Component: API - Actions/Filters Keywords:
Cc:

Description

Hi,

I just stumbled on 2 different action hooks carrying the same name : 'bbp_author_metabox'. This hook is triggered at 2 places :

  • Just after author metabox registration, via function author_metabox() in /includes/admin/topics.php
  • During rendering of Author metabox, via bbp_author_metabox() function in /includes/admin/metaboxes.php

So, trying to display additionnal fields in the author metabox, your code will be displayed two times : at the very top of the page, and in the metabox.

Change History (4)

#1 @netweb
3 years ago

  • Keywords needs-patch added

Thanks for the ticket and at a quick glance you are correct.

A probable work around at the moment would be to use some bbPress conditionals, bbp_is_topic_edit(), bbp_is_reply_edit(), is_admin(), is_bbPress() etc, http://codex.bbpress.org/bbpress-conditional-tags/

Will need to dig around a research this a bit to see what plugins may already be using these hooks so we don't break any back compat.

#2 @netweb
3 years ago

  • Milestone changed from Awaiting Review to 2.7

#3 @netweb
8 months ago

  • Keywords needs-patch removed
  • Milestone changed from 2.7 to 2.6
  • Resolution set to fixed
  • Status changed from new to closed

This has just been fixed as part of r6197

#4 @ryanhellyer
3 months ago

I stumbled across this just now.

If anyone needs to work around this before 2.6 is out, you can do so by putting

if ( ! did_action( 'admin_head' ) ) {
    return;
}

before your output.

I don't think the suggestions above for other conditionals would work.

Last edited 3 months ago by ryanhellyer (previous) (diff)
Note: See TracTickets for help on using tickets.