Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#6262 closed defect (bug) (fixed)

No 'type' property in BP_Core_Members_Template

Reported by: henry.wright Owned by: boonebgorges
Milestone: 2.3 Priority: normal
Severity: normal Version:
Component: Members Keywords:
Cc:

Description

In the constructor for BP_Core_Members_Template, I'm seeing $type being assigned to a property: $this->type = $type

But I don't see where the type property is declared in that class? The class doesn't extend another class either.

A forum member has mentioned they are having problems with the sort order. See:

https://buddypress.org/support/topic/only-one-result-for-certain-types-in-members-loop/

Change History (7)

#1 @boonebgorges
5 years ago

  • Keywords reporter-feedback close added

$type is the first variable passed to the constructor. See https://buddypress.trac.wordpress.org/browser/trunk/src/bp-members/bp-members-template.php#L546. Are you seeing PHP notices or anything like that?

#2 @henry.wright
5 years ago

Yep, it's passed to the constructor and then in the constructor it's assigned to a property. For example: $this->type = $type. But shouldn't that property be defined in the class definition? Something like:

class BP_Core_Members_Template {

    public $type;

    // etc...
}

It doesn't seem to be in this case. Not sure if that would cause issues?

Last edited 5 years ago by henry.wright (previous) (diff)

#3 @boonebgorges
5 years ago

  • Keywords reporter-feedback close removed
  • Milestone changed from Awaiting Review to 2.3

Ah, I see - sorry for not understanding before. Not having it defined in the class definition shouldn't cause any technical problems, but the documentation should be provided in any case.

#4 @boonebgorges
5 years ago

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

In 9563:

Add documentation for BP_Core_Members_Template::$type property.

Props henry.wright.
Fixes #6262.

#5 follow-up: @henry.wright
5 years ago

Regarding the docblock summary "The type of member being requested. Used for ordering results", is it worth making it clearer that the attribute is nothing to do with the new member type feature? Because this particular attribute is more to do with the sort order, 'active', 'random', 'newest', 'popular'.

#6 in reply to: ↑ 5 @boonebgorges
5 years ago

Replying to henry.wright:

Regarding the docblock summary "The type of member being requested. Used for ordering results", is it worth making it clearer that the attribute is nothing to do with the new member type feature? Because this particular attribute is more to do with the sort order, 'active', 'random', 'newest', 'popular'.

I feel like the documentation to BP_Core_Members_Template::__construct() and especially BP_User_Query makes this point pretty clear. But if you have a suggestion for wording, feel free to write up a patch and reopen this ticket.

#7 @henry.wright
5 years ago

Ok no problem. It's probably just me. When I first read it, for some reason I thought of the new member type feature, and it threw me for a few seconds.

Note: See TracTickets for help on using tickets.