Ejemplo n.º 1
0
?>
" />
				<p><div class="tips width95"><?php 
_e('Subject for retrieve password email.', 'mgm');
?>
</div></p>							
    		</div>
		</div>
  		<div class="row">
    		<div class="cell paddingtop10px">
				<b><?php 
_e('Body', 'mgm');
?>
:</b><br />
				<textarea name="setting[lost_password_email_template_body]" id="lost_password_email_template_body" class="height200px width820px"><?php 
echo mgm_print_template_content('lost_password_email_template_body', 'emails');
?>
</textarea>
				<p><div class="tips width95"><?php 
_e('Body for retrieve password email.', 'mgm');
?>
</div></p>			
    		</div>
		</div>
  		<div class="row">
    		<div class="cell">
			
    		</div>
		</div>
	</div>
 function edit()
 {
     global $wpdb;
     extract($_POST);
     // get object
     $cf_obj = mgm_get_class('member_custom_fields');
     // save
     if (isset($save_fields) && !empty($save_fields)) {
         // init
         $custom_field = $cf_obj->get_field($id);
         // name
         $custom_field['name'] = isset($name) && !empty($name) ? mgm_create_slug($name, 50) : mgm_create_slug($label, 50);
         // duplicate check:
         if ($cf_obj->is_duplicate(strtolower($custom_field['name']), $id)) {
             // messgae
             $message = __('Sorry, the field name should be unique, please try a different name', 'mgm');
             $status = 'error';
         } else {
             // label
             $custom_field['label'] = isset($label) ? __($label, 'mgm') : sprintf(__('User Field %d', 'mgm'), $id);
             // type
             if ((int) $system == 0) {
                 $custom_field['type'] = isset($type) ? $type : 'text';
             }
             //issue #1343
             if ($name == 'subscription_options' || $custom_field['name'] == 'subscription_options') {
                 $on_register = true;
                 $required = true;
                 $custom_field['type'] = isset($type) ? $type : 'radio';
             }
             // value
             $custom_field['value'] = isset($value) ? $value : '';
             // has options
             $custom_field['options'] = isset($options) ? $options : false;
             // display
             $display = array();
             // on register page
             $display['on_register'] = isset($on_register) ? $on_register : false;
             // on login page
             $display['on_login'] = isset($on_login) ? $on_login : false;
             // on login widget page
             $display['on_login_widget'] = isset($on_login_widget) ? $on_login_widget : false;
             // on profile page
             $display['on_profile'] = isset($on_profile) ? $on_profile : false;
             // on payment page
             $display['on_payment'] = isset($on_payment) ? $on_payment : false;
             // on public profile page
             $display['on_public_profile'] = isset($on_public_profile) ? $on_public_profile : false;
             // on another purchase
             // $display['on_another_purchase'] 						= (isset($on_another_purchase)) ? $on_another_purchase : false;
             // coupon issue #1285
             if (in_array($name, array('coupon', 'payment_gateways', 'autoresponder'))) {
                 // on extend page
                 $display['on_extend'] = isset($on_extend) ? $on_extend : false;
                 // on postpurchase page
                 $display['on_postpurchase'] = isset($on_postpurchase) ? $on_postpurchase : false;
             }
             // on upgrade page
             $display['on_upgrade'] = isset($on_upgrade) ? $on_upgrade : false;
             // on multiple membership level purchase page - issue #860
             $display['on_multiple_membership_level_purchase'] = isset($on_multiple_membership_level_purchase) ? $on_multiple_membership_level_purchase : false;
             // set
             $custom_field['display'] = $display;
             // attributes
             $attributes = array();
             // required field
             $attributes['required'] = isset($required) ? $required : false;
             // read only
             $attributes['readonly'] = isset($readonly) ? $readonly : false;
             // hide label
             $attributes['hide_label'] = isset($hide_label) ? $hide_label : false;
             // to autoresponder
             $attributes['to_autoresponder'] = isset($to_autoresponder) ? $to_autoresponder : false;
             //capture only
             $attributes['capture_only'] = isset($capture_only) ? $capture_only : false;
             //capture field alias
             $attributes['capture_field_alias'] = isset($capture_field_alias) ? $capture_field_alias : '';
             //profile by membership types - issue#1573
             $attributes['profile_by_membership_types'] = isset($profile_by_membership_types) ? $profile_by_membership_types : false;
             //profile by membership types field alias
             $attributes['profile_membership_types_field_alias'] = isset($profile_membership_types_field_alias) ? $profile_membership_types_field_alias : '';
             //register by membership types
             $attributes['register_by_membership_types'] = isset($register_by_membership_types) ? $register_by_membership_types : false;
             //register by membership types field alias
             $attributes['register_membership_types_field_alias'] = isset($register_membership_types_field_alias) ? $register_membership_types_field_alias : '';
             //password min length -issue #973
             $attributes['password_min_length'] = isset($password_min_length) ? $password_min_length : false;
             //default value
             if (isset($password_min_length_field_alias) && empty($password_min_length_field_alias) || trim($password_min_length_field_alias) == 0) {
                 $password_min_length_field_alias = 6;
             }
             //password min length field alias
             $attributes['password_min_length_field_alias'] = isset($password_min_length_field_alias) ? $password_min_length_field_alias : '';
             //password max length - issue #973
             $attributes['password_max_length'] = isset($password_max_length) ? $password_max_length : false;
             //default value
             if (isset($password_max_length_field_alias) && empty($password_max_length_field_alias) || trim($password_max_length_field_alias) == 0) {
                 $password_max_length_field_alias = 13;
             }
             //password max length field alias
             $attributes['password_max_length_field_alias'] = isset($password_max_length_field_alias) ? $password_max_length_field_alias : '';
             // auto_checked field
             $attributes['auto_checked'] = isset($auto_checked) ? $auto_checked : false;
             // email_confirm field
             $attributes['email_confirm'] = isset($email_confirm) ? $email_confirm : false;
             // birthdate
             if (in_array($name, array('birthdate'))) {
                 // verify_age
                 $attributes['verify_age'] = isset($verify_age) ? $verify_age : '';
                 $attributes['verify_age_unit'] = isset($verify_age_unit) ? $verify_age_unit : '';
                 $attributes['verify_age_period'] = isset($verify_age_period) ? $verify_age_period : '';
             }
             // set
             $custom_field['attributes'] = $attributes;
             // save
             $success = $cf_obj->set_custom_field($custom_field, $id);
             // saved
             if ($success) {
                 // update on success
                 $cf_obj->save();
                 // also update template, default subscription_introduction
                 if ($name == 'subscription_introduction') {
                     // value
                     if (isset($value)) {
                         mgm_get_class('system')->set_template('subs_intro', $value);
                     }
                 } elseif ($name == 'terms_conditions') {
                     // default terms_conditions
                     // value
                     if (isset($value)) {
                         mgm_get_class('system')->set_template('tos', $value);
                     }
                 }
                 // message
                 $message = sprintf(__('Successfully updated custom field: <b>%s</b>', 'mgm'), mgm_stripslashes_deep($label));
                 $status = 'success';
             } else {
                 // messgae
                 $message = sprintf(__('Error while updating custom field: <b>%s</b>', 'mgm'), mgm_stripslashes_deep($label));
                 $status = 'error';
             }
         }
         // return response
         echo json_encode(array('status' => $status, 'message' => $message));
         exit;
     }
     // data
     $data = array();
     // types
     $data['input_types'] = $cf_obj->get_input_types();
     // get field
     $data['custom_field'] = $cf_obj->get_field($id);
     // default subscription_introduction
     if ($data['custom_field']['name'] == 'subscription_introduction') {
         // no value
         if (empty($data['custom_field']['value'])) {
             $data['custom_field']['value'] = mgm_print_template_content('subs_intro');
         }
     }
     // default terms_conditions
     if ($data['custom_field']['name'] == 'terms_conditions') {
         // no value
         if (empty($data['custom_field']['value'])) {
             $data['custom_field']['value'] = mgm_print_template_content('tos');
         }
     }
     // load template view
     $this->load->template('custom_fields/edit', array('data' => $data));
 }
Ejemplo n.º 3
0
?>
</div></p>
			</div>
		</div>
  		<div class="row">
    		<div class="cell">
	    		<p><b><?php 
_e('Profile Form Row Template', 'mgm');
?>
:</b></p>
			</div>
		</div>
  		<div class="row">
    		<div class="cell">
				<textarea name="setting[profile_form_row_template]" id="setting_profile_form_row_template" class="height200px width820px"><?php 
echo mgm_print_template_content('profile_form_row_template', 'templates');
?>
</textarea>
				<p><div class="tips"><?php 
_e('Template for user profile form field row.', 'mgm');
?>
</div></p>
			</div>
		</div>
	</div>	
	<?php 
mgm_box_bottom();
?>

	<p class="submit">
		<input class="button" type="submit" name="msgs_update" value="<?php