[Resolved] Extend bp_members() – Custom Query
-
Hello BP Community.
I’m currently working on a website that uses a combination of WordPress 3.6.1, Buddy Press 1.8, BAUT Pro, WPMU.org’s Membership plugin and an Auction Theme.
A list of general info about the dynamic of the site:
– The site will allow users to post items to be auctioned. A niche-specific ebay of sorts.
– Upon Registration, users can choose to be either an Individual Seller, or a Pawn Shop. Depending on the user_type selected, a user is either assigned a Subscriber or a Contributor level (BAUT Pro does this)
– If a user registers as a Pawn Shop, they’re later permitted to purchase a monthly subscription plan that will allow them to have a Custom Profile page where they can add a custom header, all their store locations, promotions, and much more. Individual users are not presented with any of this.
– Finally, there is a DIRECTORY that lists all Pawn shops that have purchased the monthly subscription and links to each of their pagesThis last point is where I have the issue.
Because I split users in Subscribers and Contributors upon registration, I’m able to use my members-loop.php page to list all Contributors. This gives me an updated list of all users that were registered as Pawn shops, but I would like that SQL Query to also LEFT JOIN with my membership table, where it only lists Contributor level users that have an active subscription.
My current solution was to add this line at the top of my members-loop.php:
$subscribers = $wpdb->get_results('SELECT <code>user_id<code>FROM</code>wp_m_membership_relationships<code>WHERE</code>expirydate
>= NOW( ) ‘ , ARRAY_N );
.. then, y added the following:
while ( bp_members() ) : bp_the_member(); if(count($subscribers[0])>0){ if (in_array(bp_get_member_user_id(), $subscribers[0])) { ... } } endwhile;
Essentially I skip any user that is not part of the initial array. However, this doesn’t work since this guy:
bp_members_pagination_count()
and this guybp_members_pagination_links()
still show the total amount of Contributors/Pawn shops.I’ve concluded that the ideal solution would be to try and alter bp_members() only when accessing that specific page so that I may extend the actual MYSQL query, that way I get the correct count and pagination.
What do you think?
Am I way off?
Is there a better way?
- The topic ‘[Resolved] Extend bp_members() – Custom Query’ is closed to new replies.