[buddypress-trac] [BuddyPress Trac] #6859: WP Admin Bar - Sort "My Account" subnav items
buddypress-trac
noreply at wordpress.org
Thu Feb 4 00:32:38 UTC 2016
#6859: WP Admin Bar - Sort "My Account" subnav items
----------------------------------------+--------------------
Reporter: r-a-y | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.5
Component: General - Toolbar/BuddyBar | Version: 1.5.1
Severity: normal | Resolution:
Keywords: has-patch |
----------------------------------------+--------------------
Comment (by r-a-y):
> And that this is for plugin backpat rather than BP backpat?
Yes, that's correct.
> I don't understand your position backfill code. Why all the not_set_pos
stuff? Wouldn't just incrementing current position by 1 be adequate?
Let's say plugins have already injected their subnav item between the
Activity's "Personal" and "Mentions" tab without adding a `'position'`
key.
"Personal" has a position of 10; "Mentions" has a position of 20. We want
the iterator to only go up to 9, so the last subnav item will have a
`'position'` of 19, not 20 and up.
The `if ( $pos % 10 === 0 )` portion of the code is to reset the iterator
back to 1 when we are on a new subnav range. So if a plugin injected
their subnav between "Mentions" (at position 20) and "Favorites" (at
position 30), the subnav `'position'` key will be 21 instead of whatever
`$not_set_pos` was last at in the previous subnav range.
I could be forgetting other use cases here. Let me know if the code can
be improved.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6859#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list