pp_lc_load_class

Create class instance maybe bulk generate avatars uses the bp_core_set_avatar_globals hook via bp_setup_globals.

Description

pp_lc_load_class(); 

Usage

  1. if ( !function_exists( 'pp_lc_load_class' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-local-avatars/pp-local-avatars.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pp_lc_load_class(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/pp-local-avatars.php  
  1. function pp_lc_load_class() { 
  2. global $wpdb, $bp; 
  3.  
  4. $default = get_option('avatar_default'); 
  5.  
  6. if( $default == 'identicon_local' ) 
  7. $pp_local_avatar_instance = new PP_Local_Avatars(); 
  8.  
  9.  
  10. if( is_admin() ) { 
  11.  
  12. if( isset( $_GET['task'] ) && $_GET['task'] == 'bulk-generate' ) { 
  13.  
  14. if ( ! wp_verify_nonce($_GET['pp_nonce'], 'bulk_gen') ) 
  15. die( 'Security check' ); 
  16.  
  17. else { 
  18.  
  19. $users = get_users( array( 'fields' => 'ID' ) ); 
  20.  
  21. foreach ( $users as $user ) 
  22. $pp_local_avatar_instance->create( $user ); 
  23.  
  24.  
  25. $group_ids = $wpdb->get_col( "SELECT id FROM {$wpdb->prefix}bp_groups" ); 
  26.  
  27. foreach ( $group_ids as $group_id ) 
  28. $pp_local_avatar_instance->group_create( $group_id ); 
  29.  
  30. wp_redirect( admin_url( '/options-discussion.php?avs_gen=1' ) ); 
  31. exit; 
  32.