1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57:
<?php
/**
* User Query
* @name User Queries
* @description DDefinitions and Lookup Maps for User Data
* @uthor Inbound Now
* @contributors: Hudson Atwell
* @package Automation
* @subpackage Queries
*
*/
if ( !class_exists( 'Inbound_Automation_Query_User' ) ) {
class Inbound_Automation_Query_User {
/**
* Build Query Loopup Dataset
*/
public static function get_key_map( ) {
$queries['user_role'] = __( 'User Role' , 'inbound-pro' );
return $queries;
}
/* Gets Page View Count for Lead
* @param ARRAY $trigger_data dataset of arguments sent over by trigger. One of the arguments must contain key 'lead_id'
*
* @return page_views INT
*/
public static function query_user_role( $argument_id , $arguments ) {
$user_id = $arguments[ 'user_id' ];
if ( !$user_id ) {
return null;
}
$user = new WP_User( $user_id );
$roles = array();
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role ) {
$roles[] = $role;
}
}
return json_encode($roles);
}
}
}