Skip Navigation

[Resolved] list users with access to a custom post type

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 18 replies, has 2 voices.

Last updated by Ido Angel 7 years ago.

Assisted by: Nigel.

Author
Posts
#588343

F*** WC! 🙂

and thanks again for all the trouble!

i also tried this before after reading about it in this doc:

https://toolset.com/learn/create-an-ecommerce-wordpress-site/displaying-more-information-from-woocommerce/how-to-display-customers-who-also-bought-the-product/

I think i CAN show user names. I just need to see how i filter them according to "active membership":

hidden link

if you have any idea how i can get to this filter...

cheers!
ido

#588417

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ido

Quick update.

I took another look at exposing WC Orders to queries this morning and the issue is much simpler than I had thought when travelling down that rabbit hole yesterday.

WC Orders are stored with custom post statuses.

A View will query posts with a post status of publish or private.

So you need to modify the query arguments for the View in question to change the post status. You can change it to 'any', as shown in the example below, or you can use a particular status relevant for orders (you should check the slug of the status in the database to confirm the name used if you want to do this).

/**
 * Modify query for Orders for any post status
 */
function prefix_expose_orders( $view_args, $view_settings, $view_id ){

	if ( 197 == $view_id ) { // Edit View ID

		$view_args['post_status'] = 'any';
	}

	return $view_args;
}
add_filter( 'wpv_filter_query', 'prefix_expose_orders', 101, 3);
#588493

nice! great thinking.
but now i'm getting all user names from orders, and if i user the "wpv_woo_product_belongs_to_this_order" condition, i'm getting zero.
we're T_H_I_S close!
thanks!
ido

#588849

update:

https://wordpress.org/plugins/wc-product-customer-list

🙂

closed. although i do think we need to understand why the "wpv_woo_product_belongs_to_this_order" didn't work...

anyways - thanks for the great support and effort, you're the best!

ido