mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 21:23:39 +09:00
Mobile work and profile settings
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -16,4 +16,69 @@
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/***
|
||||
*** @remove profile photo silently
|
||||
***/
|
||||
add_action('wp_ajax_nopriv_ultimatemember_delete_profile_photo', 'ultimatemember_delete_profile_photo');
|
||||
add_action('wp_ajax_ultimatemember_delete_profile_photo', 'ultimatemember_delete_profile_photo');
|
||||
function ultimatemember_delete_profile_photo(){
|
||||
global $ultimatemember;
|
||||
extract($_REQUEST);
|
||||
|
||||
if ( !um_can_edit_profile( $user_id ) ) die( __('You can not edit this user') );
|
||||
|
||||
$ultimatemember->files->delete_core_user_photo( $user_id, 'profile_photo' );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @remove cover photo silently
|
||||
***/
|
||||
add_action('wp_ajax_nopriv_ultimatemember_delete_cover_photo', 'ultimatemember_delete_cover_photo');
|
||||
add_action('wp_ajax_ultimatemember_delete_cover_photo', 'ultimatemember_delete_cover_photo');
|
||||
function ultimatemember_delete_cover_photo(){
|
||||
global $ultimatemember;
|
||||
extract($_REQUEST);
|
||||
|
||||
if ( !um_can_edit_profile( $user_id ) ) die( __('You can not edit this user') );
|
||||
|
||||
$ultimatemember->files->delete_core_user_photo( $user_id, 'cover_photo' );
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @resampling/crop images
|
||||
***/
|
||||
add_action('wp_ajax_nopriv_ultimatemember_resize_image', 'ultimatemember_resize_image');
|
||||
add_action('wp_ajax_ultimatemember_resize_image', 'ultimatemember_resize_image');
|
||||
function ultimatemember_resize_image(){
|
||||
global $ultimatemember;
|
||||
$output = 0;
|
||||
|
||||
extract($_REQUEST);
|
||||
|
||||
if ( !isset($src) || !isset($coord) ) die( __('Invalid parameters') );
|
||||
|
||||
$coord_n = substr_count($coord, ",");
|
||||
if ( $coord_n != 3 ) die( __('Invalid coordinates') );
|
||||
|
||||
$um_is_temp_image = um_is_temp_image( $src );
|
||||
if ( !$um_is_temp_image ) die( __('Invalid Image file') );
|
||||
|
||||
$crop = explode(',', $coord );
|
||||
$crop = array_map('intval', $crop);
|
||||
|
||||
$uri = $ultimatemember->files->resize_image( $um_is_temp_image, $crop );
|
||||
|
||||
// If you're updating a user
|
||||
if ( isset( $user_id ) && $user_id > 0 ) {
|
||||
$uri = $ultimatemember->files->new_user_upload( $user_id, $um_is_temp_image, $key );
|
||||
}
|
||||
|
||||
$output = $uri;
|
||||
|
||||
if(is_array($output)){ print_r($output); }else{ echo $output; } die;
|
||||
|
||||
}
|
||||
@@ -191,6 +191,8 @@
|
||||
|
||||
if ( um_members('users_per_page') ) {
|
||||
|
||||
$default_size = str_replace( 'px', '', um_get_option('profile_photosize') );
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-members">
|
||||
@@ -202,13 +204,13 @@
|
||||
<div class="um-member <?php if ($cover_photos) { echo 'with-cover'; } ?>">
|
||||
|
||||
<?php if ($cover_photos) { ?>
|
||||
<div class="um-member-cover">
|
||||
<div class="um-member-cover-e"><?php echo um_user('cover_photo'); ?></div>
|
||||
<div class="um-member-cover" data-ratio="<?php echo um_get_option('profile_cover_ratio'); ?>">
|
||||
<div class="um-member-cover-e"><?php echo um_user('cover_photo', 300); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($profile_photo) { ?>
|
||||
<div class="um-member-photo"><a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user('profile_photo', 90); ?></a></div>
|
||||
<div class="um-member-photo"><a href="<?php echo um_user_profile_url(); ?>"><?php echo um_user('profile_photo', $default_size ); ?></a></div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="um-member-card <?php if (!$profile_photo) { echo 'no-photo'; } ?>">
|
||||
|
||||
+99
-18
@@ -46,21 +46,62 @@
|
||||
add_action('um_profile_header_cover_area', 'um_profile_header_cover_area' );
|
||||
function um_profile_header_cover_area( $args ) {
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( $args['cover_enabled'] == 1 ) {
|
||||
|
||||
$overlay = '<span class="um-cover-overlay">
|
||||
<span class="um-cover-overlay-s">
|
||||
<ins>
|
||||
<i class="um-icon-photo-2"></i>
|
||||
<span class="um-cover-overlay-t">'.__('Change your cover photo').'</span>
|
||||
</ins>
|
||||
</span>
|
||||
</span>';
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-cover">
|
||||
|
||||
<div class="um-cover <?php if ( um_profile('cover_photo') ) echo 'has-cover'; ?>" data-user_id="<?php echo um_profile_id(); ?>" data-ratio="<?php echo $args['cover_ratio']; ?>">
|
||||
|
||||
<?php
|
||||
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-cover', 'click', array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width">'.__('Change cover photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-reset-cover-photo" data-user_id="'.um_profile_id().'">'.__('Remove','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
), 'can_edit_user' );
|
||||
|
||||
?>
|
||||
|
||||
<?php $ultimatemember->fields->add_hidden_field( 'cover_photo' ); ?>
|
||||
|
||||
<?php echo $overlay; ?>
|
||||
|
||||
<div class="um-cover-e">
|
||||
<?php if ( um_user('cover_photo') ) { echo um_user('cover_photo'); } else { ?>
|
||||
<a href="#" class="um-cover-add"><span class="um-cover-add-i"><i class="um-icon-plus-add um-tip-n" title="Upload a cover photo"></i></span></a>
|
||||
|
||||
<?php if ( um_profile('cover_photo') ) { ?>
|
||||
|
||||
<?php
|
||||
|
||||
if( $ultimatemember->mobile->isMobile() ){
|
||||
echo um_user('cover_photo', 300);
|
||||
} else {
|
||||
echo um_user('cover_photo', 1000);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus-add um-tip-n" title="<?php _e('Upload a cover photo','ultimatemember'); ?>"></i></span></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -78,14 +119,54 @@
|
||||
$classes .= ' no-cover';
|
||||
}
|
||||
|
||||
$default_size = str_replace( 'px', '', $args['photosize'] );
|
||||
|
||||
$overlay = '<span class="um-profile-photo-overlay">
|
||||
<span class="um-profile-photo-overlay-s">
|
||||
<ins>
|
||||
<i class="um-icon-camera-5"></i>
|
||||
<span class="um-profile-photo-overlay-t">'.__('Change your profile photo').'</span>
|
||||
</ins>
|
||||
</span>
|
||||
</span>';
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-header<?php echo $classes; ?>">
|
||||
|
||||
<?php do_action('um_pre_header_editprofile', $args); ?>
|
||||
|
||||
<div class="um-profile-photo">
|
||||
<a href="<?php echo um_user_profile_url(); ?>" class="um-profile-photo-img"><?php echo um_user('profile_photo'); ?></a>
|
||||
<div class="um-profile-photo" data-user_id="<?php echo um_profile_id(); ?>">
|
||||
|
||||
<a href="<?php echo um_user_profile_url(); ?>" class="um-profile-photo-img"><?php echo $overlay . um_user('profile_photo', $default_size ); ?></a>
|
||||
|
||||
<?php
|
||||
|
||||
if ( um_can_edit_profile( um_profile_id() ) ) {
|
||||
|
||||
$ultimatemember->fields->add_hidden_field( 'profile_photo' );
|
||||
|
||||
if ( !um_profile('profile_photo') ) { // has profile photo
|
||||
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-profile-photo', 'click', array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">'.__('Upload photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
), 'can_edit_user' );
|
||||
|
||||
} else if ( $ultimatemember->fields->editing == true ) {
|
||||
|
||||
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-profile-photo', 'click', array(
|
||||
'<a href="#" class="um-manual-trigger" data-parent=".um-profile-photo" data-child=".um-btn-auto-width">'.__('Change photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-reset-profile-photo" data-user_id="'.um_profile_id().'" data-default_src="'.um_get_default_avatar_uri().'">'.__('Remove photo','ultimatemember').'</a>',
|
||||
'<a href="#" class="um-dropdown-hide">'.__('Cancel','ultimatemember').'</a>',
|
||||
), 'can_edit_user' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="um-profile-meta">
|
||||
@@ -95,15 +176,15 @@
|
||||
<div class="um-clear"></div>
|
||||
</div>
|
||||
|
||||
<?php if ( isset( $args['metafields'] ) && !empty( $args['metafields'] ) ) { ?>
|
||||
<div class="um-meta">
|
||||
<span>Chief Executive Officer of Ultimate Member</span>
|
||||
<span class="b">•</span>
|
||||
<span>28 Years Old</span>
|
||||
<span class="b">•</span>
|
||||
<span>United Kingdom</span>
|
||||
|
||||
<?php echo $ultimatemember->profile->show_meta( $args['metafields'] ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ( um_user('description') ) { ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( um_user('description') && $args['show_bio'] ) { ?>
|
||||
<div class="um-meta-text"><?php echo um_user('description'); ?></div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -161,9 +242,9 @@
|
||||
if ( isset( $ultimatemember->user->cannot_edit ) && $ultimatemember->user->cannot_edit == 1 ) return;
|
||||
|
||||
if ( $ultimatemember->fields->editing == true ) {
|
||||
$output .= '<div class="um-profile-edit um-profile-headericon"><a href="#" title="Save Profile" class="um-profile-save um-tip-n"><i class="um-icon-check"></i></a></div>';
|
||||
$output .= '<div class="um-profile-edit um-profile-headericon"><a href="#" title="Save Profile" class="um-profile-save um-tip-e"><i class="um-icon-check"></i></a></div>';
|
||||
} else {
|
||||
$output .= '<div class="um-profile-edit um-profile-headericon"><a href="'.um_edit_my_profile_uri().'" title="Edit Profile" class="um-tip-n"><i class="um-icon-cog-2"></i></a></div>';
|
||||
$output .= '<div class="um-profile-edit um-profile-headericon"><a href="'.um_edit_my_profile_uri().'" title="Edit Profile" class="um-tip-e"><i class="um-icon-cog-2"></i></a></div>';
|
||||
}
|
||||
|
||||
echo $output;
|
||||
|
||||
@@ -520,6 +520,31 @@ class UM_Builtin {
|
||||
'placeholder' => 'Enter a bit about yourself...',
|
||||
),
|
||||
|
||||
'profile_photo' => array(
|
||||
'title' => 'Profile Photo',
|
||||
'metakey' => 'profile_photo',
|
||||
'type' => 'image',
|
||||
'label' => 'Change your profile photo',
|
||||
'upload_text' => 'Upload your photo here',
|
||||
'icon' => 'um-icon-camera-5',
|
||||
'crop' => 1,
|
||||
'min_width' => str_replace('px','',um_get_option('profile_photosize')),
|
||||
'min_height' => str_replace('px','',um_get_option('profile_photosize')),
|
||||
),
|
||||
|
||||
'cover_photo' => array(
|
||||
'title' => 'Cover Photo',
|
||||
'metakey' => 'cover_photo',
|
||||
'type' => 'image',
|
||||
'label' => 'Change your cover photo',
|
||||
'upload_text' => 'Upload profile cover here',
|
||||
'icon' => 'um-icon-photo-2',
|
||||
'crop' => 2,
|
||||
'modal_size' => 'large',
|
||||
'ratio' => str_replace(':1','',um_get_option('profile_cover_ratio')),
|
||||
'min_width' => 1000,
|
||||
),
|
||||
|
||||
'birth_date' => array(
|
||||
'title' => 'Birth Date',
|
||||
'metakey' => 'birth_date',
|
||||
|
||||
+131
-35
@@ -11,6 +11,27 @@ class UM_Fields {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @hidden fields inside shortcode
|
||||
***/
|
||||
function add_hidden_field( $field ) {
|
||||
global $ultimatemember;
|
||||
echo '<div style="display: none !important;">';
|
||||
|
||||
$fields = $ultimatemember->builtin->get_specific_fields( $field );
|
||||
|
||||
$output = null;
|
||||
|
||||
foreach( $fields as $key => $data ) {
|
||||
$output .= $ultimatemember->fields->edit_field( $key, $data );
|
||||
}
|
||||
|
||||
echo $output;
|
||||
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @detect if we're editing profile in shortcode
|
||||
***/
|
||||
@@ -221,13 +242,23 @@ class UM_Fields {
|
||||
$output = null;
|
||||
$output .= '<div class="um-field-label">';
|
||||
|
||||
if ( isset($data['icon']) && $data['icon'] != '' && ( $this->field_icons == 'label' || $this->viewing == true ) ) {
|
||||
if ( isset($data['icon']) && $data['icon'] != '' && isset( $this->field_icons ) && ( $this->field_icons == 'label' || $this->viewing == true ) ) {
|
||||
$output .= '<div class="um-field-label-icon"><i class="'.$data['icon'].'"></i></div>';
|
||||
}
|
||||
|
||||
$output .= '<label for="'.$key.$ultimatemember->form->form_suffix.'">'.$label.'</label>';
|
||||
|
||||
if ( isset( $data['help'] ) && $this->viewing == false ) {$output .= '<span class="um-tip um-tip-s" title="'.$data['help'].'"><i class="um-icon-help-circled"></i></span>';}
|
||||
if ( isset( $data['help'] ) && !empty( $data['help'] ) && $this->viewing == false ) {
|
||||
|
||||
if ( !$ultimatemember->mobile->isMobile() ) {
|
||||
$output .= '<span class="um-tip um-tip-w" title="'.$data['help'].'"><i class="um-icon-help-circled"></i></span>';
|
||||
}
|
||||
|
||||
if ( $ultimatemember->mobile->isMobile() ) {
|
||||
$output .= '<span class="um-tip-text">'. $data['help'] . '</span>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$output .= '<div class="um-clear"></div></div>';
|
||||
|
||||
@@ -260,7 +291,7 @@ class UM_Fields {
|
||||
$classes .= 'um-timepicker ';
|
||||
}
|
||||
|
||||
if ( isset($data['icon']) && $this->field_icons == 'field' ) {
|
||||
if ( isset($data['icon']) && $data['icon'] && $this->field_icons == 'field' ) {
|
||||
$classes .= 'um-iconed';
|
||||
}
|
||||
|
||||
@@ -594,7 +625,29 @@ class UM_Fields {
|
||||
case 'image':
|
||||
|
||||
if ( !isset( $array['crop'] ) ) $array['crop'] = 0;
|
||||
|
||||
|
||||
if ( $array['crop'] == 0 ) {
|
||||
$array['crop_data'] = 0;
|
||||
} else if ( $array['crop'] == 1 ) {
|
||||
$array['crop_data'] = 'square';
|
||||
} else if ( $array['crop'] == 2 ) {
|
||||
$array['crop_data'] = 'cover';
|
||||
} else {
|
||||
$array['crop_data'] = 'user';
|
||||
}
|
||||
|
||||
if ( !isset( $array['modal_size'] ) ) $array['modal_size'] = 'normal';
|
||||
|
||||
if ( $array['crop'] > 0 ) {
|
||||
$array['crop_class'] = 'crop';
|
||||
} else {
|
||||
$array['crop_class'] = '';
|
||||
}
|
||||
|
||||
if ( !isset( $array['ratio'] ) ) $array['ratio'] = 1.0;
|
||||
if ( !isset( $array['min_width'] ) ) $array['min_width'] = '';
|
||||
if ( !isset( $array['min_height'] ) ) $array['min_height'] = '';
|
||||
|
||||
if (!isset($array['invalid_image'])) $array['invalid_image'] = "Please upload a valid image!";
|
||||
if (!isset($array['allowed_types'])) {
|
||||
$array['allowed_types'] = "gif,jpg,jpeg,png";
|
||||
@@ -615,6 +668,8 @@ class UM_Fields {
|
||||
|
||||
case 'file':
|
||||
|
||||
if ( !isset( $array['modal_size'] ) ) $array['modal_size'] = 'normal';
|
||||
|
||||
if (!isset($array['allowed_types'])) {
|
||||
$array['allowed_types'] = "pdf,txt";
|
||||
} else {
|
||||
@@ -685,7 +740,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -719,7 +774,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -748,7 +803,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -782,7 +837,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -809,7 +864,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -842,7 +897,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -870,7 +925,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -898,7 +953,7 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
|
||||
if ( isset($icon) && $this->field_icons == 'field' ) {
|
||||
if ( isset($icon) && $icon && $this->field_icons == 'field' ) {
|
||||
|
||||
$output .= '<div class="um-field-icon"><i class="'.$icon.'"></i></div>';
|
||||
|
||||
@@ -977,19 +1032,13 @@ class UM_Fields {
|
||||
$output .= $this->field_label($label, $key, $data);
|
||||
}
|
||||
|
||||
if ( $crop ) {
|
||||
$crop_class = 'crop';
|
||||
} else {
|
||||
$crop_class = '';
|
||||
}
|
||||
|
||||
$modal_label = ( isset( $data['label'] ) ) ? $data['label'] : __('Upload Photo','ultimatemember');
|
||||
|
||||
$output .= '<div class="um-field-area" style="text-align: center">
|
||||
|
||||
<div class="um-single-image-preview '. $crop_class .'" data-key="'.$key.'"><a href="#" class="cancel"><i class="um-icon-remove"></i></a><img src="" alt="" /></div>
|
||||
<div class="um-single-image-preview '. $crop_class .'" data-crop="'.$crop_data.'" data-key="'.$key.'"><a href="#" class="cancel"><i class="um-icon-remove"></i></a><img src="" alt="" /></div>
|
||||
|
||||
<a href="#" data-modal="um_upload_image" data-modal-copy="1" class="um-button um-btn-auto-width">'. $button_text . '</a>
|
||||
<a href="#" data-modal="um_upload_single" data-modal-size="'.$modal_size.'" data-modal-copy="1" class="um-button um-btn-auto-width">'. $button_text . '</a>
|
||||
|
||||
</div>';
|
||||
|
||||
@@ -1000,12 +1049,20 @@ class UM_Fields {
|
||||
|
||||
$output .= '<div class="um-modal-body">';
|
||||
|
||||
$output .= '<div class="um-single-image-preview '. $crop_class .'"><a href="#" class="cancel"><i class="um-icon-remove"></i></a><img src="" alt="" /></div>';
|
||||
$output .= '<div class="um-single-image-upload" data-icon="'.$icon.'" data-set_id="'.$this->set_id.'" data-set_mode="'.$this->set_mode.'" data-type="'.$type.'" data-key="'.$key.'" data-max_size="'.$max_size.'" data-max_size_error="'.$max_size_error.'" data-min_size_error="'.$min_size_error.'" data-extension_error="'.$extension_error.'" data-allowed_types="'.$allowed_types.'" data-upload_text="'.$upload_text.'" data-max_files_error="'.$max_files_error.'" data-upload_help_text="'.$upload_help_text.'">'.$button_text.'</div>';
|
||||
if ( isset( $this->set_id ) ) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
} else {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
|
||||
$output .= '<div class="um-single-image-preview '. $crop_class .'" data-crop="'.$crop_data.'" data-ratio="'.$ratio.'" data-min_width="'.$min_width.'" data-min_height="'.$min_height.'" data-coord=""><a href="#" class="cancel"><i class="um-icon-remove"></i></a><img src="" alt="" /></div>';
|
||||
$output .= '<div class="um-single-image-upload" data-icon="'.$icon.'" data-set_id="'.$set_id.'" data-set_mode="'.$set_mode.'" data-type="'.$type.'" data-key="'.$key.'" data-max_size="'.$max_size.'" data-max_size_error="'.$max_size_error.'" data-min_size_error="'.$min_size_error.'" data-extension_error="'.$extension_error.'" data-allowed_types="'.$allowed_types.'" data-upload_text="'.$upload_text.'" data-max_files_error="'.$max_files_error.'" data-upload_help_text="'.$upload_help_text.'">'.$button_text.'</div>';
|
||||
|
||||
$output .= '<div class="um-modal-footer">
|
||||
<div class="um-modal-right">
|
||||
<a href="#" class="um-modal-btn um-finish-upload disabled" data-key="'.$key.'"> ' . __('Apply','ultimatemember') . '</a>
|
||||
<a href="#" class="um-modal-btn um-finish-upload image disabled" data-key="'.$key.'" data-change="'.__('Change photo').'" data-processing="'.__('Processing...','ultimatemember').'"> ' . __('Apply','ultimatemember') . '</a>
|
||||
<a href="#" class="um-modal-btn alt" data-action="um_remove_modal"> ' . __('Cancel','ultimatemember') . '</a>
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
@@ -1033,9 +1090,34 @@ class UM_Fields {
|
||||
$output .= $this->field_label($label, $key, $data);
|
||||
}
|
||||
|
||||
$output .= '<div class="um-field-area">';
|
||||
$modal_label = ( isset( $data['label'] ) ) ? $data['label'] : __('Upload Photo','ultimatemember');
|
||||
|
||||
$output .= '<div class="um-field-area" style="text-align: center">
|
||||
|
||||
<div class="um-single-file-preview" data-key="'.$key.'">
|
||||
|
||||
</div>
|
||||
|
||||
$output .= '<div class="um-single-file-preview">
|
||||
<a href="#" data-modal="um_upload_single" data-modal-size="'.$modal_size.'" data-modal-copy="1" class="um-button um-btn-auto-width">'. $button_text . '</a>
|
||||
|
||||
</div>';
|
||||
|
||||
/* modal hidden */
|
||||
$output .= '<div class="um-modal-hidden-content">';
|
||||
|
||||
$output .= '<div class="um-modal-header"> ' . $modal_label . '</div>';
|
||||
|
||||
$output .= '<div class="um-modal-body">';
|
||||
|
||||
if ( isset( $this->set_id ) ) {
|
||||
$set_id = $this->set_id;
|
||||
$set_mode = $this->set_mode;
|
||||
} else {
|
||||
$set_id = 0;
|
||||
$set_mode = '';
|
||||
}
|
||||
|
||||
$output .= '<div class="um-single-file-preview">
|
||||
<a href="#" class="cancel"><i class="um-icon-remove"></i></a>
|
||||
<div class="um-single-fileinfo">
|
||||
<a href="#" target="_blank">
|
||||
@@ -1043,17 +1125,29 @@ class UM_Fields {
|
||||
<span class="filename"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$output .= '<div class="um-single-file-upload" data-icon="'.$icon.'" data-set_id="'.$this->set_id.'" data-set_mode="'.$this->set_mode.'" data-type="'.$type.'" data-key="'.$key.'" data-max_size="'.$max_size.'" data-max_size_error="'.$max_size_error.'" data-min_size_error="'.$min_size_error.'" data-extension_error="'.$extension_error.'" data-allowed_types="'.$allowed_types.'" data-upload_text="'.$upload_text.'" data-max_files_error="'.$max_files_error.'" data-upload_help_text="'.$upload_help_text.'">'.$button_text.'</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
if ( $this->is_error($key) ) {
|
||||
$output .= $this->field_error( $this->show_error($key) );
|
||||
}
|
||||
</div>';
|
||||
$output .= '<div class="um-single-file-upload" data-icon="'.$icon.'" data-set_id="'.$set_id.'" data-set_mode="'.$set_mode.'" data-type="'.$type.'" data-key="'.$key.'" data-max_size="'.$max_size.'" data-max_size_error="'.$max_size_error.'" data-min_size_error="'.$min_size_error.'" data-extension_error="'.$extension_error.'" data-allowed_types="'.$allowed_types.'" data-upload_text="'.$upload_text.'" data-max_files_error="'.$max_files_error.'" data-upload_help_text="'.$upload_help_text.'">'.$button_text.'</div>';
|
||||
|
||||
$output .= '<div class="um-modal-footer">
|
||||
<div class="um-modal-right">
|
||||
<a href="#" class="um-modal-btn um-finish-upload file disabled" data-key="'.$key.'" data-change="'.__('Change file').'" data-processing="'.__('Processing...','ultimatemember').'"> ' . __('Save','ultimatemember') . '</a>
|
||||
<a href="#" class="um-modal-btn alt" data-action="um_remove_modal"> ' . __('Cancel','ultimatemember') . '</a>
|
||||
</div>
|
||||
<div class="um-clear"></div>
|
||||
</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
/* end */
|
||||
|
||||
if ( $this->is_error($key) ) {
|
||||
$output .= $this->field_error( $this->show_error($key) );
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '</div>';
|
||||
break;
|
||||
|
||||
/* Select dropdown */
|
||||
@@ -1323,7 +1417,9 @@ class UM_Fields {
|
||||
}
|
||||
|
||||
// Custom filter for field output
|
||||
if ( isset( $this->set_mode ) ) {
|
||||
$output = apply_filters("um_{$key}_form_edit_field", $output, $this->set_mode);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
+183
-28
@@ -89,29 +89,20 @@ class UM_Files {
|
||||
$this->upload_dir = wp_upload_dir();
|
||||
|
||||
$this->upload_basedir = $this->upload_dir['basedir'] . '/ultimatemember/';
|
||||
|
||||
$this->upload_baseurl = $this->upload_dir['baseurl'] . '/ultimatemember/';
|
||||
|
||||
$this->upload_temp = $this->upload_basedir . 'temp/';
|
||||
$this->upload_temp_url = $this->upload_baseurl . 'temp/';
|
||||
|
||||
// create plugin uploads directory
|
||||
if (!file_exists( $this->upload_basedir )) {
|
||||
@mkdir( $this->upload_basedir, 0777, true);
|
||||
}
|
||||
|
||||
if (!file_exists( $this->upload_temp )) {
|
||||
@mkdir( $this->upload_temp , 0777, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Return upload directory
|
||||
***/
|
||||
function upload_dir(){
|
||||
return $this->upload_basedir;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Return upload URL
|
||||
***/
|
||||
function upload_url(){
|
||||
return $this->upload_baseurl;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Generate unique temp directory
|
||||
@@ -119,34 +110,41 @@ class UM_Files {
|
||||
function unique_dir(){
|
||||
global $ultimatemember;
|
||||
$unique_number = $ultimatemember->validation->generate();
|
||||
$array['dir'] = $this->upload_basedir . 'temp/'. $unique_number . '/';
|
||||
$array['url'] = $this->upload_baseurl . 'temp/'. $unique_number . '/';
|
||||
$array['dir'] = $this->upload_temp . $unique_number . '/';
|
||||
$array['url'] = $this->upload_temp_url . $unique_number . '/';
|
||||
return $array;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Fix image orientation
|
||||
*** @get path only without file name
|
||||
***/
|
||||
function fix_image_orientation(&$image, $source){
|
||||
function path_only( $file ) {
|
||||
return trailingslashit( dirname( $file ) );
|
||||
}
|
||||
|
||||
/***
|
||||
*** @fix image orientation
|
||||
***/
|
||||
function fix_image_orientation($rotate, $source){
|
||||
$exif = @exif_read_data($source);
|
||||
|
||||
if (isset($exif['Orientation'])) {
|
||||
switch ($exif['Orientation']) {
|
||||
case 3:
|
||||
$image = imagerotate($image, 180, 0);
|
||||
$rotate = imagerotate($rotate, 180, 0);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$image = imagerotate($image, -90, 0);
|
||||
$rotate = imagerotate($rotate, -90, 0);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
$image = imagerotate($image, 90, 0);
|
||||
$rotate = imagerotate($rotate, 90, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $image;
|
||||
return $rotate;
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -154,7 +152,7 @@ class UM_Files {
|
||||
***/
|
||||
function create_and_copy_image($source, $destination, $quality = 100) {
|
||||
|
||||
$info = getimagesize($source);
|
||||
$info = @getimagesize($source);
|
||||
|
||||
if ($info['mime'] == 'image/jpeg'){
|
||||
|
||||
@@ -169,11 +167,26 @@ class UM_Files {
|
||||
$image = imagecreatefrompng($source);
|
||||
|
||||
}
|
||||
|
||||
list($w, $h) = @getimagesize( $source );
|
||||
if ( $w > um_get_option('image_max_width') ) {
|
||||
|
||||
$this->fix_image_orientation($image, $source);
|
||||
$ratio = round( $w / $h, 2 );
|
||||
$new_w = um_get_option('image_max_width');
|
||||
$new_h = round( $new_w / $ratio, 2 );
|
||||
|
||||
$image_p = imagecreatetruecolor( $new_w, $new_h );
|
||||
imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
|
||||
$image_p = $this->fix_image_orientation($image_p, $source);
|
||||
imagejpeg( $image_p, $destination, $quality);
|
||||
|
||||
imagejpeg($image, $destination, $quality);
|
||||
|
||||
} else {
|
||||
|
||||
$image = $this->fix_image_orientation($image, $source);
|
||||
imagejpeg( $image, $destination, $quality);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -292,6 +305,10 @@ class UM_Files {
|
||||
$error = $data['extension_error'];
|
||||
} elseif ( isset($data['min_size']) && ( $fileinfo['size'] < $data['min_size'] ) ) {
|
||||
$error = $data['min_size_error'];
|
||||
} elseif ( isset($data['min_width']) && ( $fileinfo['width'] < $data['min_width'] ) ) {
|
||||
$error = sprintf(__('Your photo is too small. It must be at least %spx wide.'), $data['min_width']);
|
||||
} elseif ( isset($data['min_height']) && ( $fileinfo['height'] < $data['min_height'] ) ) {
|
||||
$error = sprintf(__('Your photo is too small. It must be at least %spx wide.'), $data['min_height']);
|
||||
}
|
||||
|
||||
return $error;
|
||||
@@ -325,4 +342,142 @@ class UM_Files {
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @delete a main user photo
|
||||
***/
|
||||
function delete_core_user_photo( $user_id, $type ) {
|
||||
|
||||
delete_user_meta( $user_id, $type );
|
||||
|
||||
$dir = $this->upload_basedir . $user_id . '/';
|
||||
$prefix = $type;
|
||||
chdir($dir);
|
||||
$matches = glob($prefix.'*',GLOB_MARK);
|
||||
|
||||
if( is_array($matches) && !empty($matches)) {
|
||||
foreach($matches as $match) {
|
||||
if( is_file($dir.$match) ) unlink($dir.$match);
|
||||
}
|
||||
}
|
||||
|
||||
if ( count(glob("$dir/*")) === 0) {
|
||||
rmdir( $dir );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @resize a local image
|
||||
***/
|
||||
function resize_image( $file, $crop ) {
|
||||
|
||||
$targ_x1 = $crop[0];
|
||||
$targ_y1 = $crop[1];
|
||||
$targ_x2 = $crop[2];
|
||||
$targ_y2 = $crop[3];
|
||||
|
||||
$img_r = imagecreatefromjpeg($file);
|
||||
$dst_r = imagecreatetruecolor( $targ_x2, $targ_y2 );
|
||||
|
||||
imagecopy( $dst_r, $img_r, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
|
||||
imagejpeg( $dst_r, $this->path_only( $file ) . basename( $file ), 100);
|
||||
|
||||
$split = explode('/ultimatemember/temp/', $file);
|
||||
return $this->upload_temp_url . $split[1];
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @new user upload
|
||||
***/
|
||||
function new_user_upload( $user_id, $source, $key ) {
|
||||
|
||||
// if he does not have uploads dir yet
|
||||
if ( !file_exists( $this->upload_basedir . $user_id . '/' ) ) {
|
||||
@mkdir( $this->upload_basedir . $user_id . '/' , 0777, true);
|
||||
}
|
||||
|
||||
// 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 );
|
||||
$filename = $name . $ext;
|
||||
|
||||
// copy image
|
||||
copy( $source, $this->upload_basedir . $user_id . '/' . $filename );
|
||||
|
||||
// thumbs
|
||||
if ( $key == 'profile_photo' ) {
|
||||
|
||||
list($w, $h) = @getimagesize( $source );
|
||||
|
||||
$sizes = um_get_option('photo_thumb_sizes');
|
||||
foreach( $sizes as $size ) {
|
||||
|
||||
if ( file_exists( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext ) ) {
|
||||
unlink( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
|
||||
}
|
||||
|
||||
if ( $size < $w ) {
|
||||
|
||||
$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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $key == 'cover_photo' ) {
|
||||
|
||||
list($w, $h) = @getimagesize( $source );
|
||||
|
||||
$sizes = um_get_option('cover_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 );
|
||||
}
|
||||
|
||||
if ( $size < $w ) {
|
||||
|
||||
$thumb_s = imagecreatefromjpeg( $source );
|
||||
$thumb = imagecreatetruecolor( $size, $height );
|
||||
imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
|
||||
imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// clean up temp
|
||||
$dir = dirname( $source );
|
||||
unlink( $source );
|
||||
rmdir( $dir );
|
||||
|
||||
// update user's meta
|
||||
update_user_meta( $user_id, $key, $filename );
|
||||
|
||||
// the url of upload
|
||||
return $this->upload_baseurl . $user_id . '/' . $filename;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,16 +4,23 @@
|
||||
*** @filter for shortcode args
|
||||
***/
|
||||
add_filter('um_shortcode_args_filter', 'um_shortcode_args_filter', 99);
|
||||
function um_shortcode_args_filter( $array ) {
|
||||
function um_shortcode_args_filter( $args ) {
|
||||
global $ultimatemember;
|
||||
|
||||
// checks for message mode
|
||||
|
||||
if ($ultimatemember->shortcodes->message_mode == true) {
|
||||
$array['template'] = 'message';
|
||||
$args['template'] = 'message';
|
||||
$ultimatemember->shortcodes->custom_message = um_user( um_user('status') . '_message' );
|
||||
um_reset_user();
|
||||
}
|
||||
|
||||
return $array;
|
||||
foreach( $args as $k => $v ) {
|
||||
if ( $ultimatemember->validation->is_serialized( $args[$k] ) ) {
|
||||
if ( !empty( $args[$k] ) ) {
|
||||
$args[$k] = unserialize( $args[$k] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
|
||||
}
|
||||
@@ -11,7 +11,11 @@
|
||||
$form_id = (isset ( $ultimatemember->fields->set_id ) ) ? $ultimatemember->fields->set_id : null;
|
||||
$mode = (isset( $ultimatemember->fields->set_mode ) ) ? $ultimatemember->fields->set_mode : null;
|
||||
|
||||
if ( $form_id && $mode ) {
|
||||
$array = $ultimatemember->query->get_attr('custom_fields', $form_id );
|
||||
} else {
|
||||
$array = '';
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
||||
|
||||
@@ -1,23 +1,4 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @member directory settings/args
|
||||
***/
|
||||
add_filter('um_members_directory_arguments', 'um_members_directory_arguments' );
|
||||
function um_members_directory_arguments( $args ){
|
||||
|
||||
global $ultimatemember;
|
||||
|
||||
foreach( $args as $k => $v ) {
|
||||
if ( $ultimatemember->validation->is_serialized( $args[$k] ) ) {
|
||||
if ( !empty( $args[$k] ) ) {
|
||||
$args[$k] = unserialize( $args[$k] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @prepare the query args to show members
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class UM_Menu {
|
||||
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @new menu
|
||||
***/
|
||||
function new_ui( $position, $element, $trigger, $items, $permission ) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="um-dropdown" data-element="<?php echo $element; ?>" data-position="<?php echo $position; ?>" data-trigger="<?php echo $trigger; ?>">
|
||||
<div class="um-dropdown-b">
|
||||
<div class="um-dropdown-arr"><i class=""></i></div>
|
||||
<ul>
|
||||
<?php foreach( $items as $k => $v ) { ?>
|
||||
|
||||
<li><?php echo $v; ?></li>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class UM_Profile {
|
||||
|
||||
function __construct() {
|
||||
|
||||
}
|
||||
|
||||
function show_meta( $array ) {
|
||||
$output = '';
|
||||
|
||||
foreach( $array as $k ) {
|
||||
if ( $k ) {
|
||||
$items[] = '<span>' . um_user( $k ) . '</span>';
|
||||
$items[] = '<span class="b">•</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $items ) ) {
|
||||
array_pop($items);
|
||||
foreach( $items as $item ) {
|
||||
$output .= $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -84,6 +84,7 @@ class UM_Setup {
|
||||
'_um_secondary_btn_color' => '#eee',
|
||||
'_um_secondary_btn_hover' => '#e5e5e5',
|
||||
'_um_secondary_btn_text' => '#666',
|
||||
'_um_profile_show_bio' => 1,
|
||||
'_um_profile_role' => '0',
|
||||
'_um_profile_template' => 'profile',
|
||||
'_um_profile_max_width' => '1000px',
|
||||
|
||||
+93
-11
@@ -1,5 +1,40 @@
|
||||
<?php
|
||||
|
||||
/***
|
||||
*** @profile user ID
|
||||
***/
|
||||
function um_profile_id() {
|
||||
|
||||
if ( um_get_requested_user() ) {
|
||||
return um_get_requested_user();
|
||||
} else if ( is_user_logged_in() && get_current_user_id() ) {
|
||||
return get_current_user_id();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Check that temp image is valid
|
||||
***/
|
||||
function um_is_temp_image( $url ) {
|
||||
global $ultimatemember;
|
||||
$url = explode('/ultimatemember/temp/', $url);
|
||||
if ( isset( $url[1] ) ) {
|
||||
|
||||
$src = $ultimatemember->files->upload_temp . $url[1];
|
||||
|
||||
if ( !file_exists( $src ) )
|
||||
return false;
|
||||
|
||||
list($width, $height, $type, $attr) = @getimagesize($src);
|
||||
if ( isset( $width ) && isset( $height ) )
|
||||
return $src;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @Get core page url
|
||||
***/
|
||||
@@ -396,6 +431,56 @@
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
*** @user uploads uri
|
||||
***/
|
||||
function um_user_uploads_uri() {
|
||||
global $ultimatemember;
|
||||
$uri = $ultimatemember->files->upload_baseurl . um_user('ID') . '/';
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get cover uri
|
||||
***/
|
||||
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?' . time();
|
||||
}
|
||||
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/cover_photo-' . $attrs. '.jpg' ) ){
|
||||
$uri = um_user_uploads_uri() . 'cover_photo-'.$attrs.'.jpg?' . time();
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get avatar uri
|
||||
***/
|
||||
function um_get_avatar_uri( $image, $attrs ) {
|
||||
global $ultimatemember;
|
||||
$uri = false;
|
||||
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo.jpg' ) ) {
|
||||
$uri = um_user_uploads_uri() . 'profile_photo.jpg?' . time();
|
||||
}
|
||||
if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $attrs. '.jpg' ) ){
|
||||
$uri = um_user_uploads_uri() . 'profile_photo-'.$attrs.'.jpg?' . time();
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @default avatar
|
||||
***/
|
||||
function um_get_default_avatar_uri() {
|
||||
$uri = um_get_option('default_avatar');
|
||||
$uri = $uri['url'];
|
||||
if ( !$uri )
|
||||
$uri = um_url . 'assets/img/default_avatar.png';
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/***
|
||||
*** @get user data
|
||||
***/
|
||||
@@ -526,24 +611,21 @@
|
||||
|
||||
case 'profile_photo':
|
||||
|
||||
$default_avatar_uri = um_get_option('default_avatar');
|
||||
$default_avatar_uri = $default_avatar_uri['url'];
|
||||
|
||||
if ( !$default_avatar_uri ) {
|
||||
$default_avatar_uri = um_url . 'assets/img/default_avatar.png';
|
||||
if ( um_profile('profile_photo') ) {
|
||||
$avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
|
||||
} else {
|
||||
$avatar_uri = um_get_default_avatar_uri();
|
||||
}
|
||||
|
||||
$default_avatar_uri = um_url . 'assets/img/Dollarphotoclub_57189843.jpg';
|
||||
|
||||
return '<img src="' . $default_avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
|
||||
|
||||
return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
|
||||
|
||||
break;
|
||||
|
||||
case 'cover_photo':
|
||||
if ( um_profile('cover_photo') ) {
|
||||
return '<a href="#"><img src="'.um_profile('cover_photo').'" alt="" /></a>';
|
||||
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
|
||||
return '<a href="#"><img src="'. $cover_uri .'" alt="" /></a>';
|
||||
}
|
||||
return '<a href="#"><img src="'.um_url . 'assets/img/best-hd-wallpapers-2.jpg" alt="" /></a>';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ class UM_Uninstall {
|
||||
|
||||
foreach( wp_load_alloptions() as $k => $v ) {
|
||||
|
||||
if ( substr( $k, 0, 3 ) == 'um_' || substr( $k, 0, 3 ) == 'UM_' ) {
|
||||
if ( substr( $k, 0, 3 ) == 'um_' ) {
|
||||
|
||||
if ( $k == 'um_core_forms' || $k == 'um_core_pages' || $k == 'um_core_directories' ) {
|
||||
if ( $k == 'um_core_pages' ) {
|
||||
$v = unserialize( $v );
|
||||
foreach( $v as $post_id ) {
|
||||
wp_delete_post( $post_id, 1 );
|
||||
@@ -29,10 +29,14 @@ class UM_Uninstall {
|
||||
|
||||
}
|
||||
|
||||
$forms = get_posts( array( 'post_type' => 'um_form', 'numberposts' => -1 ) );
|
||||
foreach( $forms as $form ) {wp_delete_post( $form->ID, 1 );}
|
||||
|
||||
$directories = get_posts( array( 'post_type' => 'um_directory', 'numberposts' => -1 ) );
|
||||
foreach( $directories as $directory ) {wp_delete_post( $directory->ID, 1 );}
|
||||
|
||||
$roles = get_posts( array( 'post_type' => 'um_role', 'numberposts' => -1 ) );
|
||||
foreach( $roles as $role ) {
|
||||
wp_delete_post( $role->ID, 1 );
|
||||
}
|
||||
foreach( $roles as $role ) {wp_delete_post( $role->ID, 1 );}
|
||||
|
||||
if ( is_plugin_active( um_plugin ) ) {
|
||||
deactivate_plugins( um_plugin );
|
||||
|
||||
Reference in New Issue
Block a user