[buddypress-trac] [BuddyPress Trac] #7532: BP_Button needs to update `$parent_element` and `$parent_attr`

buddypress-trac noreply at wordpress.org
Tue May 30 20:55:53 UTC 2017


#7532: BP_Button needs to update `$parent_element` and `$parent_attr`
--------------------------+--------------------
 Reporter:  r-a-y         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.9
Component:  Core          |     Version:  2.8.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+--------------------
Description changed by r-a-y:

Old description:

> If you are filtering `'bp_get_button'` and want to make adjustments to
> the button based on what the $parent_element or $parent_attr is, you
> can't since those properties are not updated in the `BP_Button` class.
>
> For example:
>
> add_filter( 'bp_get_button', function( $retval, $args, $button ) {
>         // Check to see if we're using an older button.
>         // This will fail at the moment.
>         // You could use $button->wrapper, but then you would need to re-
> render
>         // the button element with $button->parent_attr, which would also
> need
>         // to be updated.
>         if ( 'div' === $button->parent_element) {
>                 // Do something here like re-render the button.
>         }
>         return $retval;
> }, 10, 3 );

New description:

 If you are filtering `'bp_get_button'` and want to make adjustments to the
 button based on what the $parent_element or $parent_attr is, you can't
 since those properties are not updated in the `BP_Button` class.

 For example:

 {{{#!php
 <?php
 add_filter( 'bp_get_button', function( $retval, $args, $button ) {
         // Check to see if we're using an older button.
         // This will fail at the moment.
         // You could use $button->wrapper, but then you would need to re-
 render
         // the button element with $button->parent_attr, which would also
 need
         // to be updated.
         if ( 'div' === $button->parent_element) {
                 // Do something here like re-render the button.
         }
         return $retval;
 }, 10, 3 );
 }}}

--

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7532#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list