[buddypress-trac] [BuddyPress] #3769: WP Admin Bar - Cannot arrange "My Account" items
buddypress-trac
noreply at wordpress.org
Tue Oct 22 03:09:52 UTC 2013
#3769: WP Admin Bar - Cannot arrange "My Account" items
------------------------------+--------------------
Reporter: r-a-y | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 1.9
Component: Core | Version: 1.5.1
Severity: normal | Resolution:
Keywords: has-patch commit |
------------------------------+--------------------
Comment (by r-a-y):
Before I commit 02b.patch, here's something I just thought of.
The only bad thing about this technique is for plugins wanting to support
older BP versions.
This is something I'm currently doing in my custom extended BP_Component
class.
{{{
/**
* Custom version of the {@link BP_Component::start()} method.
*
* Since BuddyPress 1.9, start() has four parameters. However,
for backwards-
* compatibility with older versions of BuddyPress, we need to
pass three.
*/
protected function init() {
$menu_order = 65;
$rf = new ReflectionMethod( 'BP_Component', 'start' );
// as of BP 1.9, start() method accepts 4 parameters
if ( $rf->getNumberOfParameters() == 4 ) {
parent::start(
'blah',
__( 'Blah', 'bp-blah' ),
constant( 'BP_BLAH_DIR' ) . '/includes',
array(
'adminbar_myaccount_order' =>
(int) $menu_order
)
);
// older versions of BP
// this section will probably be removed in a future
version
} else {
parent::start(
'blah',
__( 'Blah', 'bp-blah' ),
constant( 'BP_BLAH_DIR' ) . '/includes',
);
// set properties manually
$this->adminbar_myaccount_order = (int)
$menu_order
}
}
}}}
init() is used in place of parent::start() in the constructor.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3769#comment:9>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list