[buddypress-trac] [BuddyPress] #3271: groups admin manage members buttons hardcoded to core awkward for theme devs

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Thu Jun 9 09:14:55 UTC 2011


#3271: groups admin manage members buttons hardcoded to core awkward for theme
devs
----------------------------------------+-----------------------------
 Reporter:  hnla                        |      Owner:
     Type:  enhancement                 |     Status:  new
 Priority:  normal                      |  Milestone:  Awaiting Review
Component:  Core                        |    Version:  1.3
 Keywords:  bp-group-template, buttons  |
----------------------------------------+-----------------------------
 At present the markup for the group admin manage members screen is
 predominately hardcoded to bp-groups-template.php line ~801.

 The buttons for mods & admins list i.e 'promote to', 'Demote to' are
 rendered nested in a heading tag.

 Rendering the buttons in a heading tag is both odd from a semantic view -
 it could be strongly argued that a name is not a heading, but also, and
 the real issue is, it hugely limits what can be done from a presentational
 aspect.

 I need these buttons to not be nested in this element or any element other
 than the parent 'li' so I can properly style them.

 '''The solution?'''

 Possibly two fold?

 I'm hacking /groups/single/admin.php
 {{{
 bp_group_admin_memberlist( true, false, true )
 }}}
 Adding in a further parameter

 In  bp-groups-template.php I added:


 {{{
 bp_group_admin_memberlist( $admin_list = false, $group = false,
 $group_buttons_ul = false )
 }}}

 Setting the variable to 'false' to create a default state that doesn't
 change existing layouts so in bp-group-template I do:

 {{{
                                 <h5>

                                         <?php echo bp_core_get_userlink(
 $admin->user_id ); ?>

                                         <?php if ( empty(
 $group_buttons_ul ) ) : ?>
                                         <span class="small">
                                                 <a class="button confirm
 admin-demote-to-member" href="<?php
 bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to
 Member', 'buddypress' ) ?></a>
                                         </span>
                                         <?php endif; ?>

                                 </h5>

                                         <?php if ( !empty(
 $group_buttons_ul ) ) : ?>
                                         <ul id="manage-mem-<?php echo
 $admin->user_id ?>-buttons" class="small">
                                                 <li>
                                                         <a class="button
 confirm admin-demote-to-member" href="<?php
 bp_group_member_demote_link($admin->user_id) ?>"><?php _e( 'Demote to
 Member', 'buddypress' ) ?></a>
                                                 </li>
                                         </ul>
                                         <?php endif; ?>

                         </li>
 }}}

 Ideally I would take this further and add all the buttons admin, mods to a
 function and simply return the function to the above instead of repeating
 the markup over again, which is simple? enough to do.

 '''Alternatively'''

 I notice that there is an inconsistency in methods as in admin.php after
 the admin. mods lists are rendered via the template tag we run a group
 members loop for members not admin or mod already this loop hardcodes the
 buttons but this time in the frontend view so  so does it not make more
 sense to quickly pull all the markup from bp-groups-template.php into the
 frontend (my preference) although the matter of backwards compat is not
 clear but shouldn't be an issue if done correctly to allow the previous
 button placement to hold true.

 I can patch to the first example if feedback suggests this is worthwhile,
 if not I'll likely end up having to hack core regardless which I would
 rather not do.

-- 
Ticket URL: <https://trac.buddypress.org/ticket/3271>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list