Support

Home Forums Event Espresso Premium Filter hook issue

Filter hook issue

Posted: September 12, 2017 at 9:24 am


yondbee

September 12, 2017 at 9:24 am

I’m trying to fill with user data all atteedee fields. For that, I use ‘FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value’ filter.


class EED_CustomLogin_Module extends EED_Module {

	public static function set_hooks() {
		add_filter( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', array( 'EED_CustomLogin_Module', 'register_login_reg_step' ) );
		add_filter( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', array( 'EED_CustomLogin_Module', 'filter_answer_for_attendee' ), 100, 4 );
	}
	public function run($WP) {
	}
	public static function register_login_reg_step( $reg_steps ) {
		array_unshift(
			$reg_steps,
			array(
				'file_path'  => EE_CUSTOMLOGIN_PATH . 'core/steps/',
				'class_name' => 'CustomLoginStep',
				'slug'       => 'custom_login_step',
				'has_hooks'  => false,
			)
		);
		return $reg_steps;
	}
	public static function filter_answer_for_attendee($value, EE_Registration $registration, $question_id, $system_id = null ) {
		echo $question_id;
		echo "<br/>";
		if ( ! $registration->is_primary_registrant() ) {
			return $value;
		}

		if ( empty($value) ) {
			$current_user = wp_get_current_user();
			switch ($question_id) {
				case 14:
					$value = get_user_meta($current_user->ID, '_zip', true);
					break;
				default:
					break;
			}
		}
		return $value;
	}
}

Function allways print ID 14 (var_dump) instead of Question ID. Is this a bug or I need to use other filter for that?

Var_dump screenshot: https://user-images.githubusercontent.com/1681325/30333060-51a86714-97dc-11e7-8380-4f81eaae28bd.png
form screenshot: https://user-images.githubusercontent.com/1681325/30333072-5dfb0c60-97dc-11e7-851b-28620f2b2681.png


Josh

  • Support Staff

September 12, 2017 at 9:29 am

Hi there,

Normally we’d ask you to post this as a github issue but I see that you’ve already done that. One of the developers will review and follow up with your Github issue you already posted.


yondbee

September 12, 2017 at 9:33 am

Yes, please!!! If you need aditional details, please feel free to ask to me on Github!

The support post ‘Filter hook issue’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  yondbee 2 years, 3 months ago ago

Topic Tags

Tagged: 

Notifications

This topic is: not a support question
Do NOT follow this link or you will be banned from the site!