Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6384 closed enhancement (fixed)

Create Members Loop markup class function

Reported by: hnla's profile hnla Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.3 Priority: normal
Severity: minor Version:
Component: Members Keywords: needs-patch
Cc:

Description

Currently BP has a bp_get_group_class() function located in 'bp-groups-template.php' the purpose of which is to render class tokens to the groups loop 'li' element.

The members loop however does not have a similar function.

With the introduction of member_types this would be more of a relevant issue and useful, even without member types we ought to match major components and functions like for like? If groups template provides this for groups loop members template should also as should 'Blogs' for their respective loops.

I have a need to be able target 'me' for the companion styling I'm tackling so the first 'class' I would be adding (and likely only one short term) is a logged in user, displayed user check.

It looks to me that we could relatively simply copy over majority of the bp_get_group_class() to members-template and tweak to suit?

I would be willing to make an initial clumsy first pass at this in order that we could get it underway & squeezed into 2.3?

Attachments (2)

6384.01 (1.5 KB) - added by hnla 9 years ago.
Update members-loop for class function , add class for loggedin users entry
6384.02 (1.5 KB) - added by hnla 9 years ago.
Update patch to remove test function params.

Download all attachments as: .zip

Change History (17)

#1 @DJPaul
9 years ago

Do you mean like bp_member_class? :)

#2 @hnla
9 years ago

Darn it, maybe I do :( will check it out and why we aren't employing it on main loop as we do on groups loop.

#3 @hnla
9 years ago

Soo.. lets re-phrase this ticket to:
'Lets actually use this bp_member_class()

And perhaps add a class to mark the current users list entry.

#4 @hnla
9 years ago

Patch 6384.01 updates members-loop.php & bp-members-template.php

  • Bring bp_member_class() into use on members loop 'li' elements
  • Update bp_get_member_class() for a comparison check between logged in user and member list entry to add a class 'my-entry' on matches.

We gain the use of the class 'is-online' which existed and marks each entry if user logged in and active and we have the addition of being able to identify the current users entry and style accordingly

Moving forward I would expect we'll need the class for 'member_type' classes as well.

@hnla
9 years ago

Update members-loop for class function , add class for loggedin users entry

#5 @DJPaul
9 years ago

  • Keywords needs-patch added

<li <?php bp_member_class('floppy'); ?>

??

@hnla
9 years ago

Update patch to remove test function params.

This ticket was mentioned in Slack in #buddypress by hnla. View the logs.


9 years ago

#7 @r-a-y
9 years ago

I'm okay with this patch, hnla.

Not a fan of the 'my-entry' class name though. Perhaps 'is-me' to match 'is-online'?

#8 @hnla
9 years ago

@r-a-y yes agree on the naming didn't like it either but hate choosing names :)

my only problem with 'is-me' is that it can tend to sound / read as a question whereas we are really stating a fact, this li entry is me; but I'm fine with whatever is thought best.

Only other concern I had was whether there was some reason this hadn't been included before.

#9 @DJPaul
9 years ago

What is most consistent with other similar BP classes?

#10 @hnla
9 years ago

@r-a-y and I did throw some names back and forth on slack, can't see those entries though.
think the choice boils down to 'bp-is-me' or 'is-me'. In user accounts we use 'just-me', 'my-groups' so 'is-me' seems suitable even though I dislike the vague nature of the phrase as a possible question.

This ticket was mentioned in Slack in #buddypress by hnla. View the logs.


9 years ago

This ticket was mentioned in Slack in #buddypress by jjj. View the logs.


9 years ago

#13 @johnjamesjacoby
9 years ago

In 9884:

Members: Updates to bp_member_class()

  • Actually use it in members-loop.php
  • Allow custom classes to be passed in via array parameter
  • Add current user class
  • Clean up comparisons and variable definitions

Props hnla. See #6384.

#14 @johnjamesjacoby
9 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 9885:

Groups: Updates to bp_get_group_class()

  • Allow custom classes to be passed in via array parameter
  • Clean up comparisons and variable definitions

Fixes #6384. See r9884.

#15 @johnjamesjacoby
9 years ago

In 9886:

Blogs: Updates to bp_get_blog_class()

  • Allow custom classes to be passed in via array parameter
  • Clean up comparisons and variable definitions

See #6384. See r9884, r9885.

Note: See TracTickets for help on using tickets.