Merge conflicts

This commit is contained in:
jonfalcon
2016-04-05 16:13:22 -07:00
13 changed files with 200 additions and 109 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ Ultimate Member is a powerful and flexible WordPress plugin that makes it a bree
| Latest Version |Requires at least|Stable Tag|
| :------------: |:------------:|:------------:|
| 1.3.44| WordPress 4.1 or higher| 1.3.38 |
| 1.3.47| WordPress 4.1 or higher| 1.3.38 |
##Features of the plugin include:
@@ -47,7 +47,7 @@ GNU Version 2 or Any Later Version
Releases
====================
[Latest Release: Ultimate Member v1.3.44](https://github.com/ultimatemember/ultimatemember/releases).
[Latest Release: Ultimate Member v1.3.45](https://github.com/ultimatemember/ultimatemember/releases).
Changelog
====================
+3 -1
View File
@@ -78,7 +78,9 @@
add_action( 'um_before_login_fields', 'um_display_login_errors' );
function um_display_login_errors( $args ) {
global $ultimatemember;
$error = '';
if( $ultimatemember->form->count_errors() > 0 ) {
$error = array_values( $ultimatemember->form->errors );
$error = array_shift( $error );
+2 -1
View File
@@ -120,7 +120,8 @@
do_action('um_user_after_updating_profile', $to_update );
if ( !isset( $args['is_signup'] ) ) {
exit( wp_redirect( um_edit_my_profile_cancel_uri() ) );
$url = $ultimatemember->permalinks->profile_url();
exit( wp_redirect( um_edit_my_profile_cancel_uri( $url ) ) );
}
}
+35 -59
View File
@@ -481,7 +481,7 @@ class UM_Files {
$info = @getimagesize( $file );
if ( $info['mime'] == 'image/gif' ){
$img_r = imagecreatefromgif( $file );
@@ -491,12 +491,12 @@ class UM_Files {
} else if ( $info['mime'] == 'image/png' ){
$srcImage = imagecreatefrompng( $file );
$targetImage = imagecreatetruecolor( $targ_x2, $targ_y2 );
imagealphablending( $targetImage, false );
imagesavealpha( $targetImage, true );
imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
imagepng( $srcImage, $this->path_only( $file ) . basename( $file ) );
$img_r = imagecreatefrompng( $file );
$dst_r = imagecreatetruecolor( $targ_x2, $targ_y2 );
imagealphablending( $dst_r, false);
imagesavealpha( $dst_r, true);
imagecopy( $dst_r, $img_r, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
imagepng( $dst_r, $this->path_only( $file ) . basename( $file ) );
}else{
@@ -539,19 +539,8 @@ class UM_Files {
wp_die( __('Unauthorized to do this attempt.','ultimatemember') );
}
// name and extension stuff
$source_name = basename( $source );
if ( $key == 'profile_photo' ) {
$source_name = 'profile_photo.jpg';
}
if ( $key == 'cover_photo' ) {
$source_name = 'cover_photo.jpg';
}
$ext = '.' . pathinfo($source_name, PATHINFO_EXTENSION);
$name = str_replace( $ext, '', $source_name );
$ext = '.' . pathinfo($source, PATHINFO_EXTENSION);
$name = $key;
$filename = $name . $ext;
// copy & overwrite file
@@ -565,11 +554,14 @@ class UM_Files {
// thumbs
if ( $key == 'profile_photo' ) {
list($w, $h) = @getimagesize( $source );
list($w, $h) = @getimagesize( $source );
$sizes = um_get_option('photo_thumb_sizes');
foreach( $sizes as $size ) {
$ratio = round( $w / $h, 2 );
$height = round( $size / $ratio, 2 );
if ( file_exists( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext ) ) {
unlink( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
@@ -581,30 +573,21 @@ class UM_Files {
$thumb_s = imagecreatefromjpeg( $source );
$thumb = imagecreatetruecolor( $size, $size );
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . $ext, 100);
}else if ( $info['mime'] == 'image/png' ){
$thumb_s = imagecreatefrompng( $source );
$thumb = imagecreatetruecolor( $size, $size );
imagealphablending( $thumb, false);
imagesavealpha( $thumb, true);
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
imagepng( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
}else if ( $info['mime'] == 'image/gif' ){
$thumb_s = imagecreatefromgif( $source );
$thumb = imagecreatetruecolor( $size, $size );
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
}
if ( $info['mime'] == 'image/jpeg' ){
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
}else if ( $info['mime'] == 'image/png' ){
$srcImage = imagecreatefrompng( $source );
$targetImage = imagecreatetruecolor( $size, $size );
imagealphablending( $targetImage, false );
imagesavealpha( $targetImage, true );
imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, $size, $size, $w, $h );
imagepng( $srcImage, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 0 ,PNG_ALL_FILTERS);
}else if ( $info['mime'] == 'image/gif' ){
imagegif( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext);
imagegif( $thumb, $this->upload_basedir . $user_id . '/' . $name . $ext);
}
}
@@ -632,28 +615,21 @@ class UM_Files {
if ( $size < $w ) {
if ( $info['mime'] == 'image/jpeg' ){
$thumb = imagecreatetruecolor( $size, $height );
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
$thumb_s = imagecreatefromjpeg( $source );
}else if ( $info['mime'] == 'image/gif' ){
$thumb = imagecreatetruecolor( $size, $height );
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
$thumb_s = imagecreatefromgif( $source );
}
if ( $info['mime'] == 'image/jpeg' ){
$thumb = imagecreatetruecolor( $size, $height );
$thumb_s = imagecreatefromjpeg( $source );
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
}else if ( $info['mime'] == 'image/png' ){
$srcImage = imagecreatefrompng( $source );
$targetImage = imagecreatetruecolor( $size, $height );
imagealphablending( $targetImage, false );
imagesavealpha( $targetImage, true );
imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, $size, $height, $w, $h );
imagepng($srcImage, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 0 ,PNG_ALL_FILTERS);
$thumb_s = imagecreatefrompng( $source );
$thumb = imagecreatetruecolor( $size, $height );
imagealphablending( $thumb, false);
imagesavealpha( $thumb, true);
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
imagepng( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
}else if ( $info['mime'] == 'image/gif' ){
$thumb = imagecreatetruecolor( $size, $height );
$thumb_s = imagecreatefromgif( $source );
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
imagegif( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext);
}
}
+9 -2
View File
@@ -43,9 +43,16 @@
if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
$avatar_url = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
$avatar_url = add_query_arg('s',400, $avatar_url);
if( um_get_option('use_um_gravatar_default_image') ){
$avatar_url = add_query_arg('d', um_get_default_avatar_uri(), $avatar_url );
$gravatar_type = um_get_option('use_um_gravatar_default_builtin_image');
if( $gravatar_type == 'default' ){
if( um_get_option('use_um_gravatar_default_image') ){
$avatar_url = add_query_arg('d', um_get_default_avatar_uri(), $avatar_url );
}
}else{
$avatar_url = add_query_arg('d', $gravatar_type, $avatar_url );
}
}
$avatar = '<img src="' .$avatar_url .'?d='. $default . '&amp;s=' . $size . $rating .'" class="func-um_get_avatar gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
+5 -6
View File
@@ -238,13 +238,12 @@
/***
*** @sorting random
***/
add_filter( 'pre_user_query', 'um_sortby_random' );
function um_sortby_random( $query ) {
if($query->query_vars["orderby"] == 'random') {
add_filter('pre_user_query','um_modify_sortby_randomly');
function um_modify_sortby_randomly( $query ){
if($query->query_vars["orderby"] == 'random') {
$query->query_orderby = 'ORDER by RAND()';
}
return $query;
}
return $query;
}
/***
+26 -8
View File
@@ -107,45 +107,61 @@
$value = $slugname;
}
$value = apply_filters("um_permalink_base_before_filter", $value );
$raw_value = $value;
switch( $permalink_base ){
case 'name':
if( ! empty( $value ) && strrpos( $value ,".") > -1 ){
$value = str_replace( '.', ' ', $value );
}
// Checks if last name has a dash
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
$value = str_replace( '_', '. ', $value );
}
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
$value = str_replace( '_', '-', $value );
}
if( ! empty( $value ) && strrpos( $value ,".") > -1 && strrpos( $raw_value ,"_" ) <= -1 ){
$value = str_replace( '.', ' ', $value );
}
$value = apply_filters("um_permalink_base_after_filter_name", $value, $raw_value );
break;
case 'name_dash':
if( ! empty( $value ) && strrpos( $value ,"-") > -1 ){
$value = str_replace( '-', ' ', $value );
}
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
$value = str_replace( '_', '-', $value );
}
// Checks if last name has a dash
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
$value = str_replace( '_', '-', $value );
}
$value = apply_filters("um_permalink_base_after_filter_name_dash", $value, $raw_value );
break;
case 'name_plus':
if( ! empty( $value ) && strrpos( $value ,"+") > -1 ){
$value = str_replace( '+', ' ', $value );
}
// Checks if last name has a dash
if( ! empty( $value ) && strrpos( $value ,"_") > -1 ){
$value = str_replace( '_', '+', $value );
}
$value = apply_filters("um_permalink_base_after_filter_name_plus", $value, $raw_value );
break;
default:
@@ -155,6 +171,8 @@
$value = str_replace( '_', '-', $value );
}
$value = apply_filters("um_permalink_base_after_filter", $value, $raw_value );
break;
}
+31 -9
View File
@@ -221,9 +221,11 @@ class UM_Permalinks {
{
$full_name = um_user( 'full_name' );
$last_name = um_user( 'last_name' );
$count = intval( um_is_meta_value_exists( 'full_name', $full_name ) );
$first_name = um_user( 'first_name' );
$count = intval( um_is_meta_value_exists( 'full_name', $full_name ) );
if( $count > 1 )
{
$full_name .= ' ' . um_user( 'ID' );
@@ -231,7 +233,7 @@ class UM_Permalinks {
switch( um_get_option('permalink_base') )
{
case 'name':
case 'name': // dotted
$full_name_slug = $full_name;
$difficulties = 0;
@@ -248,11 +250,17 @@ class UM_Permalinks {
$full_name = str_replace('_.', '_', $full_name );
$difficulties++;
}
$full_name_slug = str_replace( '-' , '.', $full_name_slug );
$full_name_slug = str_replace( ' ' , '.', $full_name_slug );
$full_name_slug = str_replace( '..' , '.', $full_name_slug );
if( strpos( $full_name, '.' ) > -1 ){
$full_name = str_replace('.', ' ', $full_name );
$difficulties++;
}
if( $difficulties > 0 ){
update_user_meta( um_user('ID'), 'um_user_profile_url_slug_name_'.$full_name_slug, $full_name );
}
@@ -262,17 +270,22 @@ class UM_Permalinks {
break;
case 'name_dash':
case 'name_dash': // dashed
$difficulties = 0;
$full_name_slug = strtolower( $full_name );
// if name has dashed replace with underscore
// if last name has dashed replace with underscore
if( strpos( $last_name, '-') > -1 && strpos( $full_name, '-' ) > -1 ){
$difficulties++;
$full_name = str_replace('-', '_', $full_name );
}
// if first name has dashed replace with underscore
if( strpos( $first_name, '-') > -1 && strpos( $full_name, '-' ) > -1 ){
$difficulties++;
$full_name = str_replace('-', '_', $full_name );
}
// if name has space, replace with dash
$full_name_slug = str_replace( ' ' , '-', $full_name_slug );
@@ -292,20 +305,29 @@ class UM_Permalinks {
break;
case 'name_plus':
case 'name_plus': // plus
$difficulties = 0;
$full_name_slug = strtolower( $full_name );
// if name has dashed replace with underscore
// if last name has dashed replace with underscore
if( strpos( $last_name, '+') > -1 && strpos( $full_name, '+' ) > -1 ){
$difficulties++;
$full_name = str_replace('-', '_', $full_name );
}
// if first name has dashed replace with underscore
if( strpos( $first_name, '+') > -1 && strpos( $full_name, '+' ) > -1 ){
$difficulties++;
$full_name = str_replace('-', '_', $full_name );
}
if( strpos( $last_name, '-') > -1 || strpos( $first_name, '-') > -1 || strpos( $full_name, '-') > -1 ){
$difficulties++;
}
// if name has space, replace with dash
$full_name_slug = str_replace( ' ' , '+', $full_name_slug );
$full_name_slug = str_replace( '-' , '+', $full_name_slug );
// if name has period
if( strpos( $last_name, '.') > -1 && strpos( $full_name, '.' ) > -1 ){
$difficulties++;
+2
View File
@@ -165,6 +165,8 @@ class UM_Rewrite {
}
exit( wp_redirect( $url ) );
}else{
exit( wp_redirect( home_url() ) );
}
}
+31 -18
View File
@@ -803,10 +803,15 @@ function um_reset_user() {
/***
*** @remove edit profile args from url
***/
function um_edit_my_profile_cancel_uri() {
$url = remove_query_arg( 'um_action' );
$url = remove_query_arg( 'profiletab', $url );
$url = add_query_arg('profiletab', 'main', $url );
function um_edit_my_profile_cancel_uri( $url = '' ) {
global $ultimatemember;
if( empty( $url ) ){
$url = remove_query_arg( 'um_action' );
$url = remove_query_arg( 'profiletab', $url );
$url = add_query_arg('profiletab', 'main', $url );
}
return $url;
}
@@ -1187,11 +1192,12 @@ function um_fetch_user( $user_id ) {
function um_get_cover_uri( $image, $attrs ) {
global $ultimatemember;
$uri = false;
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo.jpg' ) ) {
$uri = um_user_uploads_uri() . 'cover_photo.jpg?' . current_time( 'timestamp' );
$ext = '.' . pathinfo($image, PATHINFO_EXTENSION);
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo'.$ext ) ) {
$uri = um_user_uploads_uri() . 'cover_photo'.$ext.'?' . current_time( 'timestamp' );
}
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo-' . $attrs. '.jpg' ) ){
$uri = um_user_uploads_uri() . 'cover_photo-'.$attrs.'.jpg?' . current_time( 'timestamp' );
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo-' .$attrs.$ext ) ){
$uri = um_user_uploads_uri() . 'cover_photo-'.$attrs.$ext.'?' . current_time( 'timestamp' );
}
return $uri;
}
@@ -1211,28 +1217,28 @@ function um_fetch_user( $user_id ) {
global $ultimatemember;
$uri = false;
$find = false;
$ext = '.' . pathinfo($image, PATHINFO_EXTENSION);
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $attrs. $ext ) ) {
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $attrs. '.jpg' ) ) {
$uri = um_user_uploads_uri() . 'profile_photo-'.$attrs.'.jpg?' . current_time( 'timestamp' );
$uri = um_user_uploads_uri() . 'profile_photo-'.$attrs.$ext.'?' . current_time( 'timestamp' );
} else {
$sizes = um_get_option('photo_thumb_sizes');
if ( is_array( $sizes ) ) $find = um_closest_num( $sizes, $attrs );
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $find. '.jpg' ) ) {
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $find.$ext ) ) {
$uri = um_user_uploads_uri() . 'profile_photo-'.$find.'.jpg?' . current_time( 'timestamp' );
$uri = um_user_uploads_uri() . 'profile_photo-'.$find.$ext.'?' . current_time( 'timestamp' );
} else if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo.jpg' ) ) {
} else if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo'.$ext ) ) {
$uri = um_user_uploads_uri() . 'profile_photo.jpg?' . current_time( 'timestamp' );
$uri = um_user_uploads_uri() . 'profile_photo'.$ext.'?' . current_time( 'timestamp' );
}
if ( $attrs == 'original' ) {
$uri = um_user_uploads_uri() . 'profile_photo.jpg?' . current_time( 'timestamp' );
$uri = um_user_uploads_uri() . 'profile_photo'.$ext.'?' . current_time( 'timestamp' );
}
}
@@ -1429,9 +1435,16 @@ function um_fetch_user( $user_id ) {
if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
$avatar_uri = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
$avatar_uri = add_query_arg('s',400, $avatar_uri);
if( um_get_option('use_um_gravatar_default_image') ){
$avatar_uri = add_query_arg('d', um_get_default_avatar_uri(), $avatar_uri );
$gravatar_type = um_get_option('use_um_gravatar_default_builtin_image');
if( $gravatar_type == 'default' ){
if( um_get_option('use_um_gravatar_default_image') ){
$avatar_uri = add_query_arg('d', um_get_default_avatar_uri(), $avatar_uri );
}
}else{
$avatar_uri = add_query_arg('d', $gravatar_type, $avatar_uri );
}
}
return '<img src="' . $avatar_uri . '" class="func-um_user gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
+1 -1
View File
@@ -3,7 +3,7 @@
Plugin Name: Ultimate Member
Plugin URI: http://ultimatemember.com/
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
Version: 1.3.44
Version: 1.3.47
Author: Ultimate Member
Author URI: http://ultimatemember.com/
*/
+32 -1
View File
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
Requires at least: 4.1
Tested up to: 4.4
Stable Tag: 1.3.44
Stable Tag: 1.3.46
License: GNU Version 2 or Any Later Version
@@ -149,6 +149,37 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
== Changelog ==
= 1.3.47: April 6, 2016 =
* Fixed: Fatal errors with language filter file
= 1.3.46: April 6, 2016 =
* Fixed: Search widget fatal error
* Fixed: image jpeg upload sizes
= 1.3.45: April 6, 2016 =
* New: support for wordfence and limit login
* New: search widget
* New: secondary email address
* Added: hook to password reset form fields
* Added: privacy options for profile menu tabs
* Added: option to allow primary email editable in profile view
* Added: member directory sort randomly
* Fixed: user page redirection
* Fixed: admin script error
* Fixed: invalid image path
* Fixed: upload image png with transparency
* Fixed: permalink basename fallback
* Fixed: casting variable and add new filter
* Fixed: remove notices
* Fixed: search users by tag
* Fixed: force UT8 encoding option
* Fixed: email content type
* Fixed: WPML compatibility
* Fixed: permalink base name format and redirect loop in profile page
* Fixed: form labels textdomain
* Fixed: edit profile redirect
* Tweak: accept period in profile url
= 1.3.44: March 11, 2016 =
* New: an option to force Strings to use UTF-8 encoding
* New: an option to change Gravatar default image
+21 -1
View File
@@ -181,6 +181,26 @@ $this->sections[] = array(
'off' => __('No','ultimatemember'),
),
array(
'id' => 'use_um_gravatar_default_builtin_image',
'type' => 'select',
'title' => __( 'Use Gravatar builtin image','ultimatemember' ),
'desc' => __( 'Gravatar has a number of built in options which you can also use as defaults','ultimatemember' ),
'default' => 'default',
'options' => array(
'default' => __('Default','ultimatemember'),
'404' => __('404 ( File Not Found response )','ultimatemember'),
'mm' => __('Mystery Man','ultimatemember'),
'identicon' => __('Identicon','ultimatemember'),
'monsterid' => __('Monsterid','ultimatemember'),
'wavatar' => __('Wavatar','ultimatemember'),
'retro' => __('Retro','ultimatemember'),
'blank' => __('Blank ( a transparent PNG image )','ultimatemember'),
),
'required' => array( 'use_gravatars', '=', 1 ),
'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ),
),
array(
'id' => 'use_um_gravatar_default_image',
'type' => 'switch',
@@ -189,7 +209,7 @@ $this->sections[] = array(
'desc' => __('Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)','ultimatemember'),
'on' => __('Yes','ultimatemember'),
'off' => __('No','ultimatemember'),
'required' => array( 'use_gravatars', '=', 1 ),
'required' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
),
array(