mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Important fix for first release
This commit is contained in:
@@ -26,8 +26,6 @@ class UM_Admin_Columns {
|
||||
$new_columns['title'] = __('Title');
|
||||
$new_columns['mode'] = __('Type') . $admin->_tooltip( 'This is the type of the form' );
|
||||
$new_columns['shortcode'] = __('Shortcode') . $admin->_tooltip( 'Use this shortcode to display the form' );
|
||||
$new_columns['impressions'] = __('Impressions') . $admin->_tooltip( 'The total number of times this form has been viewed' );
|
||||
$new_columns['conversions'] = __('Conversions') . $admin->_tooltip( 'The total number of conversions. e.g. Successful sign-ups' );
|
||||
$new_columns['date'] = __('Date');
|
||||
|
||||
return $new_columns;
|
||||
@@ -72,23 +70,6 @@ class UM_Admin_Columns {
|
||||
echo '<span class="um-admin-tag um-admin-type-'.$mode.'">'. $ultimatemember->form->display_form_type($mode, $id) . '</span>';
|
||||
break;
|
||||
|
||||
case 'impressions':
|
||||
$impressions = $ultimatemember->query->get_attr('impressions', $id);
|
||||
echo (!empty( $impressions )) ? $impressions : 'N/A';
|
||||
break;
|
||||
|
||||
case 'conversions':
|
||||
$impressions = $ultimatemember->query->get_attr('impressions', $id);
|
||||
$conversions = $ultimatemember->query->get_attr('conversions', $id);
|
||||
|
||||
if ($impressions && $conversions){
|
||||
$pct = ($conversions / $impressions) * 100;
|
||||
$pct = round($pct, 2);
|
||||
}
|
||||
|
||||
echo (!empty( $conversions )) ? $conversions . '<span class="um-admin-txtspace"></span>' . '(' . $pct . '%)' : 'N/A';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,6 +87,10 @@
|
||||
|
||||
um_fetch_user( $user_id );
|
||||
|
||||
if ( !isset( $args['role'] ) ) {
|
||||
$role = um_get_option('default_role');
|
||||
}
|
||||
|
||||
$ultimatemember->user->set_role( $role );
|
||||
|
||||
$ultimatemember->user->set_registration_details( $args['submitted'] );
|
||||
@@ -205,6 +209,8 @@
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
if ( isset( $args['custom_fields']['role_select'] ) || isset( $args['custom_fields']['role_radio'] ) ) return;
|
||||
|
||||
if (isset($args['role']) && !empty($args['role'])){
|
||||
|
||||
echo '<input type="hidden" name="role" id="role" value="'.$args['role'].'" />';
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @add an impression to form
|
||||
***/
|
||||
add_action('um_before_form_is_loaded', 'um_add_page_view');
|
||||
function um_add_page_view($args){
|
||||
global $ultimatemember;
|
||||
extract($args);
|
||||
if ( isset( $form_id ) ) {
|
||||
if ( !isset( $impressions ) ) $impressions = 0;
|
||||
$ultimatemember->form->add_pageview( $form_id, $impressions );
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @track a successful event
|
||||
***/
|
||||
add_action('track_approved_user_login', 'um_add_conversion');
|
||||
add_action('track_approved_user_registration', 'um_add_conversion');
|
||||
function um_add_conversion($args){
|
||||
global $ultimatemember;
|
||||
extract($args);
|
||||
$ultimatemember->form->add_conversion( $form_id );
|
||||
}
|
||||
+24
-6
@@ -1279,6 +1279,9 @@ class UM_Fields {
|
||||
|
||||
/* Select dropdown */
|
||||
case 'select':
|
||||
|
||||
$form_key = str_replace('role_select','role',$key);
|
||||
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="'.$key.'">';
|
||||
|
||||
if ( isset( $data['allowclear'] ) && $data['allowclear'] == 0 ) {
|
||||
@@ -1293,7 +1296,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
$output .= '<select name="'.$key.'" id="'.$key.'" data-validate="'.$validate.'" data-key="'.$key.'" class="'.$this->get_class($key, $data, $class).'" style="width: 100%" data-placeholder="'.$placeholder.'">';
|
||||
$output .= '<select name="'.$form_key.'" id="'.$form_key.'" data-validate="'.$validate.'" data-key="'.$key.'" class="'.$this->get_class($key, $data, $class).'" style="width: 100%" data-placeholder="'.$placeholder.'">';
|
||||
|
||||
if ( isset($options) && $options == 'builtin'){
|
||||
$options = $ultimatemember->builtin->get ( $filter );
|
||||
@@ -1311,8 +1314,14 @@ class UM_Fields {
|
||||
|
||||
$v = rtrim($v);
|
||||
|
||||
$output .= '<option value="'.$v.'" ';
|
||||
if ( $this->is_selected($key, $v, $data) ) {
|
||||
if ( !is_numeric( $k ) ) {
|
||||
$option_value = $k;
|
||||
} else {
|
||||
$option_value = $v;
|
||||
}
|
||||
|
||||
$output .= '<option value="'.$option_value.'" ';
|
||||
if ( $this->is_selected($key, $option_value, $data) ) {
|
||||
$output.= 'selected';
|
||||
}
|
||||
$output .= '>'.$v.'</option>';
|
||||
@@ -1385,6 +1394,9 @@ class UM_Fields {
|
||||
|
||||
/* Radio */
|
||||
case 'radio':
|
||||
|
||||
$form_key = str_replace('role_radio','role',$key);
|
||||
|
||||
$output .= '<div class="um-field' . $classes . '"' . $conditional . ' data-key="'.$key.'">';
|
||||
|
||||
if ( isset( $data['label'] ) ) {
|
||||
@@ -1400,6 +1412,12 @@ class UM_Fields {
|
||||
|
||||
$v = rtrim($v);
|
||||
|
||||
if ( !is_numeric( $k ) ) {
|
||||
$option_value = $k;
|
||||
} else {
|
||||
$option_value = $v;
|
||||
}
|
||||
|
||||
$i++;
|
||||
if ($i % 2 == 0 ) {
|
||||
$col_class = 'right';
|
||||
@@ -1407,7 +1425,7 @@ class UM_Fields {
|
||||
$col_class = '';
|
||||
}
|
||||
|
||||
if ( $this->is_radio_checked($key, $v, $data) ) {
|
||||
if ( $this->is_radio_checked($key, $option_value, $data) ) {
|
||||
$active = 'active';
|
||||
$class = "um-icon-android-radio-button-on";
|
||||
} else {
|
||||
@@ -1416,9 +1434,9 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
$output .= '<label class="um-field-radio '.$active.' um-field-half '.$col_class.'">';
|
||||
$output .= '<input type="radio" name="'.$key.'" value="'.$v.'" ';
|
||||
$output .= '<input type="radio" name="'.$form_key.'" value="'.$option_value.'" ';
|
||||
|
||||
if ( $this->is_radio_checked($key, $v, $data) ) {
|
||||
if ( $this->is_radio_checked($key, $option_value, $data) ) {
|
||||
$output.= 'checked';
|
||||
}
|
||||
|
||||
|
||||
@@ -137,27 +137,4 @@ class UM_Form {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Adds a page view for form
|
||||
***/
|
||||
function add_pageview( $form_id, $impressions ) {
|
||||
global $ultimatemember;
|
||||
$new_impressions = (int)$impressions+1;
|
||||
$ultimatemember->query->update_attr('impressions', $form_id, $new_impressions);
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Adds a page conversion for form
|
||||
***/
|
||||
function add_conversion( $post_id ) {
|
||||
global $ultimatemember;
|
||||
|
||||
$conversions = $ultimatemember->query->get_attr('conversions', $post_id);
|
||||
$new_conversions = (int)$conversions+1;
|
||||
|
||||
$ultimatemember->query->update_attr('conversions', $post_id, $new_conversions);
|
||||
|
||||
return $new_conversions;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user