Advertisement
verygoodplugins

Untitled

Aug 22nd, 2024
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1.     public function batch_init() {
  2.  
  3.         global $wpdb;
  4.         $members = array();
  5.  
  6.         $query = "
  7.                     SELECT u.ID FROM $wpdb->users u
  8.                     LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id
  9.                     LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id
  10.                     WHERE mu.membership_id > 0
  11.                     GROUP BY u.ID
  12.                     ORDER BY u.user_registered ASC
  13.                     ";
  14.  
  15.         $result = $wpdb->get_results( $query, ARRAY_A );
  16.  
  17.         if ( ! empty( $result ) ) {
  18.             foreach ( $result as $member ) {
  19.                 $members[] = $member['ID'];
  20.             }
  21.         }
  22.  
  23.         return $members;
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement