Skip Navigation

[Resolved] Displaying list of contractors with active showcase

This support ticket is created 2 years, 7 months 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by info308 2 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2156939

Hi,
I have followed this instructions:
https://toolset.com/lesson-placement/lesson-placements-1622969-1929573/
It works all great.
But I need to display a list of contractors, who have at least one published showcase (not draft or pending).
I don't want to display users who didn't pay for publishing at least one post.

#2157087

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please tell me what view you created and on what page you wanted to list the contractors which is having at least one post published on what page?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2162593

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following view's filter hook "wpv_filter_query" to "Custom Code" section offered by Toolset:
=> hidden link

add_filter('wpv_filter_query', 'func_list_only_profiles_publish_posts', 999, 3);
function func_list_only_profiles_publish_posts($query_args, $view_settings, $view_id){
 global $wpdb;
  
  if($view_id == 2150){ //view's ID
    
    $users_having_posts =  $wpdb->get_col($wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users INNER JOIN $wpdb->usermeta ON ( $wpdb->users.ID = $wpdb->usermeta.user_id ) WHERE 1=1 AND $wpdb->users.ID IN ( SELECT DISTINCT $wpdb->posts.post_author FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type IN ( 'dzielo-sztuki' ) ) group by $wpdb->users.ID ORDER BY $wpdb->users.user_login ASC"));
    
    
      
        $query_args['author__in'] = $users_having_posts ; 
    }
    return $query_args;
}

Can you please confirm it works at your end as well: hidden link

#2163307

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please confirm that the solution I shared help you to resolve your issue.

#2163421

My issue is resolved now. Thank you! It works great.

#2163471

My issue is resolved now. Thank you! It works great!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.