components/Roles/Roles.php
public function ajax_add( $params ) {

		global $wp_roles;

		$role_name  = pods_var_raw( 'role_name', $params );
		$role_label = pods_var_raw( 'role_label', $params );

		$params->capabilities = (array) pods_var_raw( 'capabilities', $params, array() );

		$params->custom_capabilities = (array) pods_var_raw( 'custom_capabilities', $params, array() );
		$params->custom_capabilities = array_filter( array_unique( $params->custom_capabilities ) );

		$capabilities = array();

		foreach ( $params->capabilities as $capability => $x ) {
			if ( empty( $capability ) || true !== (boolean) $x ) {
				continue;
			}

			$capabilities[ esc_attr( $capability ) ] = true;
		}

		foreach ( $params->custom_capabilities as $x => $capability ) {
			if ( empty( $capability ) || '--1' === $x ) {
				continue;
			}

			$capabilities[ esc_attr( $capability ) ] = true;
		}

		if ( empty( $role_name ) ) {
			return pods_error( __( 'Role name is required', 'pods' ) );
		}

		if ( empty( $role_label ) ) {
			return pods_error( __( 'Role label is required', 'pods' ) );
		}

		return add_role( $role_name, $role_label, $capabilities );
	}
public function ajax_add( $params ) {

		global $wp_roles;

		$role_name  = pods_var_raw( 'role_name', $params );
		$role_label = pods_var_raw( 'role_label', $params );

		$params->capabilities = (array) pods_var_raw( 'capabilities', $params, array() );

		$params->custom_capabilities = (array) pods_var_raw( 'custom_capabilities', $params, array() );
		$params->custom_capabilities = array_filter( array_unique( $params->custom_capabilities ) );

		$capabilities = array();

		foreach ( $params->capabilities as $capability => $x ) {
			if ( empty( $capability ) || true !== (boolean) $x ) {
				continue;
			}

			$capabilities[ esc_attr( $capability ) ] = true;
		}

		foreach ( $params->custom_capabilities as $x => $capability ) {
			if ( empty( $capability ) || '--1' === $x ) {
				continue;
			}

			$capabilities[ esc_attr( $capability ) ] = true;
		}

		if ( empty( $role_name ) ) {
			return pods_error( __( 'Role name is required', 'pods' ) );
		}

		if ( empty( $role_label ) ) {
			return pods_error( __( 'Role label is required', 'pods' ) );
		}

		return add_role( $role_name, $role_label, $capabilities );
	}
public function ajax_add ( $ params ) { global $ wp_roles ; $ role_name = pods_var_raw ( 'role_name' , $ params ) ; $ role_label = pods_var_raw ( 'role_label' , $ params ) ; $ params -> capabilities = ( array ) pods_var_raw ( 'capabilities' , $ params , array ( ) ) ; $ params -> custom_capabilities = ( array ) pods_var_raw ( 'custom_capabilities' , $ params , array ( ) ) ; $ params -> custom_capabilities = array_filter ( array_unique ( $ params -> custom_capabilities ) ) ; $ capabilities = array ( ) ; foreach ( $ params -> capabilities as $ capability => $ x ) { if ( empty ( $ capability ) || true !== ( boolean ) $ x ) { continue ; } $ capabilities [ esc_attr ( $ capability ) ] = true ; } foreach ( $ params -> custom_capabilities as $ x => $ capability ) { if ( empty ( $ capability ) || '--1' === $ x ) { continue ; } $ capabilities [ esc_attr ( $ capability ) ] = true ; } if ( empty ( $ role_name ) ) { return pods_error ( __ ( 'Role name is required' , 'pods' ) ) ; } if ( empty ( $ role_label ) ) { return pods_error ( __ ( 'Role label is required' , 'pods' ) ) ; } return add_role ( $ role_name , $ role_label , $ capabilities ) ; }
Handle the Add Role AJAX

@param $params

@return mixed|void
Handle the Add Role AJAX