Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UR-821 Dev - Compatibility for enabling/disabling taking picture from the webcam. #592

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions includes/abstracts/abstract-ur-form-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ public function frontend_includes( $form_id, $field_type, $field_key, $data = ar
$form_data['enable_crop_picture'] = $data['advance_setting']->enable_crop_picture;
}

if ( isset( $data['advance_setting']->enable_take_picture ) ) {
$form_data['enable_take_picture'] = $data['advance_setting']->enable_take_picture;
}

$form_data['input_class'] = array( 'ur-frontend-field ' );

if ( isset( $data['advance_setting']->custom_class ) ) {
Expand Down
6 changes: 3 additions & 3 deletions templates/myaccount/form-edit-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@
$max_size = wp_max_upload_size();
$max_upload_size = $max_size;
$crop_picture = false;

$profile_pic_args = array();
$edit_profile_valid_file_type = 'image/jpeg,image/gif,image/png';

foreach ( $form_data_array as $data ) {
foreach ( $data as $grid_key => $grid_data ) {
foreach ( $grid_data as $grid_data_key => $single_item ) {

if ( isset( $single_item->field_key ) && 'profile_picture' === $single_item->field_key ) {
$profile_pic_args = (array) $single_item->advance_setting;
$edit_profile_valid_file_type = isset( $single_item->advance_setting->valid_file_type ) && '' !== $single_item->advance_setting->valid_file_type ? implode( ', ', $single_item->advance_setting->valid_file_type ) : $edit_profile_valid_file_type;
$max_upload_size = isset( $single_item->advance_setting->max_upload_size ) && '' !== $single_item->advance_setting->max_upload_size ? $single_item->advance_setting->max_upload_size : $max_size;
$crop_picture = isset( $single_item->advance_setting->enable_crop_picture ) ? ur_string_to_bool( $single_item->advance_setting->enable_crop_picture ) : false;
Expand All @@ -65,7 +66,6 @@
}
}


?>
<img class="profile-preview" alt="profile-picture" src="<?php echo esc_url( $image ); ?>" style='max-width:96px; max-height:96px;' >

Expand All @@ -84,7 +84,7 @@
<input type="file" id="ur-profile-pic" name="profile-pic" class="profile-pic-upload" size="<?php echo esc_attr( $max_upload_size ); ?>" accept="<?php echo esc_attr( $edit_profile_valid_file_type ); ?>" style="<?php echo esc_attr( ( $gravatar_image !== $image ) ? 'display:none;' : '' ); ?>" data-crop-picture="<?php echo esc_attr( $crop_picture ); ?>"/>
<?php echo '<input type="text" class="uraf-profile-picture-input input-text ur-frontend-field" name="profile_pic_url" id="profile_pic_url" value="' . get_user_meta( get_current_user_id(), 'user_registration_profile_pic_url', true ) . '" />'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</span>
<?php do_action( 'uraf_profile_picture_buttons' ); ?>
<?php do_action( 'uraf_profile_picture_buttons', $profile_pic_args ); ?>
</p>
<div style="clear:both; margin-bottom: 20px"></div>
</div>
Expand Down
Loading