Update 1.0.76

This commit is contained in:
ultimatemember
2015-03-07 13:07:49 +02:00
parent 6ff2da7672
commit 22d5c2d24a
41 changed files with 453 additions and 242 deletions
+15 -15
View File
@@ -162,6 +162,8 @@
<?php echo $output; ?>
<?php do_action('um_after_account_delete'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Delete Account','ultimatemember'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_delete_button'); ?>
@@ -171,9 +173,7 @@
<?php
}
do_action('um_after_account_delete');
}
/***
@@ -192,6 +192,8 @@
<?php echo $output; ?>
<?php do_action('um_after_account_privacy'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Privacy','ultimatemember'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_privacy_button'); ?>
@@ -201,9 +203,7 @@
<?php
}
do_action('um_after_account_privacy');
}
/***
@@ -222,6 +222,8 @@
<?php echo $output; ?>
<?php do_action('um_after_account_general'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Account','ultimatemember'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_general_button'); ?>
@@ -231,9 +233,7 @@
<?php
}
do_action('um_after_account_general');
}
/***
@@ -252,6 +252,8 @@
<?php echo $output; ?>
<?php do_action('um_after_account_password'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Password','ultimatemember'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_password_button'); ?>
@@ -261,9 +263,7 @@
<?php
}
do_action('um_after_account_password');
}
/***
@@ -282,6 +282,8 @@
<?php echo $output; ?>
<?php do_action('um_after_account_notifications'); ?>
<div class="um-col-alt um-col-alt-b">
<div class="um-left"><input type="submit" name="um_account_submit" id="um_account_submit" value="<?php _e('Update Notifications','ultimatemember'); ?>" class="um-button" /></div>
<?php do_action('um_after_account_notifications_button'); ?>
@@ -291,9 +293,7 @@
<?php
}
do_action('um_after_account_notifications');
}
/***
+6
View File
@@ -228,6 +228,12 @@
switch( $array['validate'] ) {
case 'numeric':
if ( $args[$key] && !is_numeric( $args[$key] ) ) {
$ultimatemember->form->add_error($key, __('Please enter numbers only in this field','ultimatemember') );
}
break;
case 'phone_number':
if ( !$ultimatemember->validation->is_phone_number( $args[$key] ) ) {
$ultimatemember->form->add_error($key, __('Please enter a valid phone number','ultimatemember') );
+4 -4
View File
@@ -76,10 +76,10 @@
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time( 'timestamp' );
if ( $form_timestamp == '' )
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
wp_die( __('Hello, spam bot!') );
if ( $live_timestamp - $form_timestamp < 3 )
if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 )
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
if ( strlen(trim( $_POST['username_b'] ) ) == 0 ) {
@@ -107,10 +107,10 @@
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time( 'timestamp' );
if ( $form_timestamp == '' )
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
wp_die( __('Hello, spam bot!') );
if ( $live_timestamp - $form_timestamp < 3 )
if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 )
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
if ( !$args['user_password'] ) {
+7
View File
@@ -21,6 +21,7 @@ class UM_Cron {
public function schedule_Events() {
$this->weekly_events();
$this->daily_events();
$this->twicedaily_events();
$this->hourly_events();
}
@@ -36,6 +37,12 @@ class UM_Cron {
}
}
private function twicedaily_events() {
if ( ! wp_next_scheduled( 'um_twicedaily_scheduled_events' ) ) {
wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'um_twicedaily_scheduled_events' );
}
}
private function hourly_events() {
if ( ! wp_next_scheduled( 'um_hourly_scheduled_events' ) ) {
wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'um_hourly_scheduled_events' );
+17 -5
View File
@@ -378,6 +378,8 @@ class UM_Files {
delete_user_meta( $user_id, $type );
do_action("um_after_remove_{$type}", $user_id);
$dir = $this->upload_basedir . $user_id . '/';
$prefix = $type;
chdir($dir);
@@ -417,16 +419,23 @@ class UM_Files {
}
/***
*** @new user upload
*** @make a user folder for uploads
***/
function new_user_upload( $user_id, $source, $key ) {
// if he does not have uploads dir yet
function new_user( $user_id ) {
if ( !file_exists( $this->upload_basedir . $user_id . '/' ) ) {
$old = umask(0);
@mkdir( $this->upload_basedir . $user_id . '/' , 0755, true);
umask($old);
}
}
/***
*** @new user upload
***/
function new_user_upload( $user_id, $source, $key ) {
// if he does not have uploads dir yet
$this->new_user( $user_id );
// name and extension stuff
$source_name = basename( $source );
@@ -443,7 +452,10 @@ class UM_Files {
$name = str_replace( $ext, '', $source_name );
$filename = $name . $ext;
// copy file
// copy & overwrite file
if ( file_exists( $this->upload_basedir . $user_id . '/' . $filename ) ) {
unlink( $this->upload_basedir . $user_id . '/' . $filename );
}
copy( $source, $this->upload_basedir . $user_id . '/' . $filename );
// thumbs
+33
View File
@@ -0,0 +1,33 @@
<?php
/***
*** @add-ons panel
***/
add_filter("redux/options/um_options/sections", 'um_add_addons_settings_tab', 8 );
function um_add_addons_settings_tab($sections){
global $ultimatemember;
foreach( $ultimatemember->addons as $addon_id => $addon ) {
$array[] = array(
'id' => 'addon_' . $addon_id,
'type' => 'switch',
'title' => $addon[0],
'desc' => $addon[1],
'on' => __('Activated','ultimatemember'),
'off' => __('Deactivated','ultimatemember'),
);
}
$array = apply_filters('um_builtin_addons_options', $array );
$sections[] = array(
'icon' => 'um-faicon-plug',
'title' => __( 'Add ons','ultimatemember'),
'fields' => $array
);
return $sections;
}
+2 -2
View File
@@ -78,10 +78,10 @@ class UM_Form {
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time( 'timestamp' );
if ( $form_timestamp == '' )
if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
wp_die( __('Hello, spam bot!') );
if ( $live_timestamp - $form_timestamp < 3 )
if ( $live_timestamp - $form_timestamp < 6 && um_get_option('enable_timebot') == 1 )
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
}
+1 -1
View File
@@ -60,7 +60,7 @@ class UM_Permalinks {
function activate_account_via_email_link(){
global $ultimatemember;
if ( isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 30 &&
if ( isset($_REQUEST['act']) && $_REQUEST['act'] == 'activate_via_email' && isset($_REQUEST['hash']) && strlen($_REQUEST['hash']) == 40 &&
isset($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id']) ) { // valid token
um_fetch_user( $_REQUEST['user_id'] );
+10
View File
@@ -4,6 +4,8 @@ class UM_Setup {
function __construct() {
add_action('init', array(&$this, 'install_basics'), 9);
add_action('init', array(&$this, 'install_default_forms'), 9);
add_action('init', array(&$this, 'install_default_roles'), 9);
@@ -226,6 +228,14 @@ class UM_Setup {
}
}
/***
*** @Basics
***/
function install_basics() {
if ( !get_option('__ultimatemember_sitekey') )
update_option('__ultimatemember_sitekey', str_replace( array('http://','https://'), '', sanitize_user( get_bloginfo('url') ) ) . '-' . wp_generate_password( 20, false ) );
}
/***
*** @Default Forms
***/
+7 -1
View File
@@ -252,7 +252,8 @@ class UM_Shortcodes {
$pattern_array = array(
'{first_name}',
'{last_name}',
'{display_name}'
'{display_name}',
'{user_avatar_small}',
);
$pattern_array = apply_filters('um_allowed_user_tags_patterns', $pattern_array);
@@ -265,6 +266,11 @@ class UM_Shortcodes {
$usermeta = str_replace('{','',$pattern);
$usermeta = str_replace('}','',$usermeta);
if ( $usermeta == 'user_avatar_small' ) {
$value = um_user('profile_photo', 40);
$str = preg_replace('/'.$pattern.'/', $value , $str );
}
if ( um_user( $usermeta ) ){
$str = preg_replace('/'.$pattern.'/', um_user($usermeta) , $str );
}
+157
View File
@@ -0,0 +1,157 @@
<?php
class UM_Tracking {
private $data;
public function __construct() {
$this->schedule_send();
add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
}
/***
*** @setup info array
***/
private function setup_data() {
global $ultimatemember;
$data = array();
// Retrieve current theme info
if ( get_bloginfo( 'version' ) < '3.4' ) {
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
$theme = $theme_data['Name'];
$theme_ver = $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme = $theme_data->Name;
$theme_ver = $theme_data->Version;
}
$data['url'] = home_url();
$data['theme'] = $theme;
$data['theme_version'] = $theme_ver;
$data['wp_version'] = get_bloginfo( 'version' );
$data['version'] = ultimatemember_version;
$result = count_users();
$data['users_count'] = $result['total_users'];
// Retrieve current plugin information
if( ! function_exists( 'get_plugins' ) ) {
include ABSPATH . '/wp-admin/includes/plugin.php';
}
$plugins = array_keys( get_plugins() );
$active_plugins = get_option( 'active_plugins', array() );
foreach ( $plugins as $key => $plugin ) {
if ( in_array( $plugin, $active_plugins ) ) {
// Remove active plugins from list so we can show active and inactive separately
unset( $plugins[ $key ] );
}
}
$data['active_plugins'] = $active_plugins;
$data['inactive_plugins'] = $plugins;
$data['language'] = get_bloginfo('language');
$data['multisite'] = ( is_multisite() ) ? 1 : 0;
if ( !get_option('__ultimatemember_sitekey') ) {
$ultimatemember->setup->install_basics();
}
$data['unique_sitekey'] = get_option('__ultimatemember_sitekey');
$this->data = $data;
}
/***
*** @check if tracking is allowed
***/
private function tracking_allowed() {
if ( !um_get_option('allow_tracking') )
return 0;
return 1;
}
/***
*** @get last send time
***/
private function get_last_send() {
return get_option( 'um_tracking_last_send' );
}
/***
*** @send a report
***/
public function send_checkin( $override = false ) {
if( ! $this->tracking_allowed() && ! $override )
return;
// Send a maximum of once per period
$last_send = $this->get_last_send();
if( $last_send && $last_send > strtotime( '-1 day' ) )
return;
$this->setup_data();
$request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array(
'method' => 'POST',
'timeout' => 20,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'body' => $this->data,
'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ),
) );
update_option( 'um_tracking_last_send', time() );
}
/***
*** @run a scheduled report
***/
private function schedule_send() {
add_action( 'um_daily_scheduled_events', array( $this, 'send_checkin' ) );
}
/***
*** @show admin notices
***/
public function admin_notices() {
if( ! current_user_can( 'manage_options' ) )
return;
$hide_notice = get_option('um_tracking_notice');
if ( $hide_notice )
return;
$optin_url = add_query_arg( 'um_adm_action', 'opt_into_tracking' );
$optout_url = add_query_arg( 'um_adm_action', 'opt_out_of_tracking' );
echo '<div class="updated" style="border-color: #3ba1da;"><p>';
echo __( 'Help us improve Ultimate Members compatibility with other plugins and themes by allowing us to track non-sensitive data on your site. Click <a href="https://ultimatemember.com/tracking/" target="_blank">here</a> to see what data we track.', 'ultimatemember' );
echo '</p>';
echo '<p><a href="' . esc_url( $optin_url ) . '" class="button button-primary">' . __( 'Allow tracking', 'ultimatemember' ) . '</a>';
echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow tracking', 'ultimatemember' ) . '</a></p></div>';
}
}