Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

verygoodplugins May 22nd, 2020 1,038 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. if ( ! defined( 'ABSPATH' ) ) {
  4.     exit; // Exit if accessed directly
  5. }
  6.  
  7.  
  8. class WPF_Users_Insights extends WPF_Integrations_Base {
  9.  
  10.     /**
  11.      * Gets things started
  12.      *
  13.      * @access  public
  14.      * @since   1.0
  15.      * @return  void
  16.      */
  17.  
  18.     public function init() {
  19.  
  20.         $this->slug = 'users-insights';
  21.  
  22.         add_filter( 'usin_fields', array( $this, 'add_module_fields' ) );
  23.         add_filter( 'usin_user_db_data', array( $this, 'get_tags_data' ) );
  24.  
  25.     }
  26.  
  27.     /**
  28.      * Adds CRM tags field to filters
  29.      *
  30.      * @access public
  31.      * @return array Fields
  32.      */
  33.  
  34.     public function add_module_fields( $fields ) {
  35.  
  36.         $available_tags = wp_fusion()->settings->get_available_tags_flat();
  37.  
  38.         $data = array();
  39.  
  40.         foreach ( $available_tags as $id => $label ) {
  41.  
  42.             $data[] = array(
  43.                 'key' => $id,
  44.                 'val' => $label,
  45.             );
  46.  
  47.         }
  48.  
  49.         $fields[] = array(
  50.             'name'      => sprintf( __( '%s tags', 'wp-fusion' ), wp_fusion()->crm->name ),
  51.             'id'        => 'wpf_tags',
  52.             'order'     => false,
  53.             'show'      => true,
  54.             'fieldType' => 'general',
  55.             'filter'    => array(
  56.                 'type'    => 'include_exclude',
  57.                 'options' => $data,
  58.             ),
  59.         );
  60.  
  61.         return $fields;
  62.  
  63.     }
  64.  
  65.     /**
  66.      * Gets CRM tags for display
  67.      *
  68.      * @access public
  69.      * @return array Data
  70.      */
  71.  
  72.     public function get_tags_data( $data ) {
  73.  
  74.         $tag_ids = wp_fusion()->user->get_tags( $data->ID );
  75.  
  76.         $tag_names = array_map( array( wp_fusion()->user, 'get_tag_label' ), $tag_ids );
  77.  
  78.         $data->wpf_tags = implode( ', ', $tag_names );
  79.  
  80.         return $data;
  81.  
  82.     }
  83. }
  84.  
  85. new WPF_Users_Insights();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top