Member related widgets are freaking out
-
Okay, this one is maybe my own fault. I’ve been poking my fingers in places where they probably shouldn’t be, but I’ve reverted every bit of code that I’ve recently touched back to the 1.0b1 version and still no go.
Essentially, while my “members” page (bp-core-directory-members.php) works fine, the members widgets (bp-core-widgets.php) are not properly pulling members. Two blank members are being shown. “Blank” is the best way I can describe them. They are two identical gravitars that link to no existing member on the site.
If you want to see what I mean, I moved the widget to the news feed so is is not embarrassingly on the front page:
I had been messing with the widgets code, but I have reverted back to the original code. Debugging things I have tried:
hardcoding the max_members property as 10 inside bp-core-widgets.php
creating user objects, like on the members page with:
<?php $user_obj = new BP_Core_User( $user->user_id, true ); ?>
As I’m willing to explore avenues on my own, any directions you could point me would be helpful.
-
Something is trashing your members widget javascript. Firebug shows that instead of js you have the entire page being loaded as js or it thinks that is the js for the member widget. You’ve got google analytics running. Try disabling that and see what happens.
Still failing, but there are some silver linings.
I removed the Google Analytics; same results. Then I remembered that I removed the members widget JavaScript file because of a weird bug I was getting: when one clicked on “newest”, *every* member loaded in the page. For even moderate member rosters this can kill a browser. I’ve re-activated that Javascript. The two “blank” members are still there, but, funny thing: now if you click on any of the sort links (eg “newest” “active” “popular”) the proper members are displayed. The silver lining is that I am no longer seeing that first bug where all members were loaded in the page.
Narrowing the problem: I see that the $users array has 0 members. What could cause that? This line isn’t getting the users it should:
<?php $users = BP_Core_User::get_active_users($options) ?>
I checked, and $options is returning a number (in my case ‘5’).
Damn! I wish my PHP skills were above novice.
No, sorry, I’m wrong. $users array has 2 members.
The widget defaults to newest members and the line should be:
<?php $users = BP_Core_User::get_newest_users( $options ) ?>
The only way to get skills above novice is to play. Just gotta accept that you will probably meltdown the neighborhood a couple of times. Welcome to the club.
Haha. That’s the truth. It’s a shame for the people trying to play in my neighborhood.
Yeah, I changed it to default to active… or at least, that’s how I wanted to change it. get_newest_users, get_active_users and get_popular_users all do not work properly with bp-core-widgets.php. They *do* work in bp-core-directory-members.php. What’s the difference between those pages?
- The topic ‘Member related widgets are freaking out’ is closed to new replies.