View difference between Paste ID: z2yrXUcW and A0K10at8
SHOW: | | - or go back to the newest paste.
1
define('PRICE', '100');
2
3
add_filter('gform_pre_render', 'populate_preconference');
4
function populate_preconference($form) {
5
	foreach($form['fields'] as &$field) {
6
		if( $field['cssClass'] == 'inpersonprice') {	
7
			if( is_numeric(getInPersonPrice()) ) {
8
				$field['basePrice'] = getInPersonPrice();
9
			}
10
		}
11
	}
12
	return $form
13
}
14
15
function getInPersonPrice() {
16
	
17
	$validate_ccode = isValidCCode();
18
	$minus_fifty = 0;	
19
20
	if($validate_ccode) {
21
		$minus_fifty = 50;	
22
	}
23
24
	return PRICE - 50;
25
}