goradagency
Forum Replies Created
-
Thank you so much for your help.
after reviewing all the files in the link you sent, I think this is the code I should add right ?
<?php /* Plugin Name: Ultimate Member - Enable Profile Photo in Register form Plugin URI: https://ultimatemember.com/ Description: Enable users to upload their profile photo in Register form Version: 1.0.0 Author: UM Devs Author URI: https://ultimatemember.com */ if ( ! defined( 'ABSPATH' ) ) exit; /** * Add new predefined field "Profile Photo" in UM Form Builder. */ add_filter("um_predefined_fields_hook","um_predefined_fields_hook_profile_photo", 99999, 1 ); function um_predefined_fields_hook_profile_photo( $arr ){ $arr['profile_photo'] = array( 'title' => __('Profile Photo','ultimate-member'), 'metakey' => 'profile_photo', 'type' => 'image', 'label' => __('Change your profile photo','ultimate-member'), 'upload_text' => __('Upload your photo here','ultimate-member'), 'icon' => 'um-faicon-camera', 'crop' => 1, 'max_size' => ( UM()->options()->get('profile_photo_max_size') ) ? UM()->options()->get('profile_photo_max_size') : 999999999, 'min_width' => str_replace('px','',UM()->options()->get('profile_photosize')), 'min_height' => str_replace('px','',UM()->options()->get('profile_photosize')), ); return $arr; } /** * Multiply Profile Photo with different sizes */ add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_photo', 999999, 1 ); function um_registration_set_profile_photo( $user_id ){ $user_basedir = UM()->uploader()->get_upload_user_base_dir( $user_id, true ); $profile_photo = array_slice(scandir($user_basedir), 2); if( empty( $profile_photo ) ) return; foreach( $profile_photo as $i => $p ){ if (strpos($p, 'profile_') !== false && strpos($p, '_photo') !== false ) { $profile_p = $p; } } if( empty( $profile_p ) ) return; $image_path = $user_basedir . DIRECTORY_SEPARATOR . $profile_p; $image = wp_get_image_editor( $image_path ); $file_info = wp_check_filetype_and_ext( $image_path, $profile_p ); $ext = $file_info['ext']; $new_image_name = str_replace( $profile_p, "profile_photo.".$ext, $image_path ); $sizes = UM()->options()->get( 'photo_thumb_sizes' ); $quality = UM()->options()->get( 'image_compression' ); if ( ! is_wp_error( $image ) ) { $image->save( $new_image_name ); $image->set_quality( $quality ); $sizes_array = array(); foreach( $sizes as $size ){ $sizes_array[ ] = array ('width' => $size ); } $image->multi_resize( $sizes_array ); delete_user_meta( $user_id, 'synced_profile_photo' ); update_user_meta( $user_id, 'profile_photo', "profile_photo.{$ext}" ); @unlink( $image_path ); } // var_dump([ // 'user_id' => $user_id, // 'image_path' => $image_path, // 'profile_photo' => $profile_photo, // 'raw' => $_REQUEST // ]); // wp_die('test'); } add_filter("um_image_upload_handler_overrides__profile_photo", "um_register_profile_change_filename", 9999 ); function um_register_profile_change_filename($upload_overrides){ //if( ! is_user_logged_in() ){ $hashed = hash('ripemd160', time() . mt_rand( 10, 1000 ) ); $upload_overrides['unique_filename_callback'] = str_replace( "_temp", "_{$hashed}temp", $upload_overrides['unique_filename_callback'] ); // } return $upload_overrides; }
@missveronicatv thank you, I’m not familiar with these files. should I upload all of them to my site?
also, I used this code, do you think it’s enough?
/** * Add new predefined field "Profile Photo" in UM Form Builder. */ add_filter("um_predefined_fields_hook","um_predefined_fields_hook_profile_photo", 99999, 1 ); function um_predefined_fields_hook_profile_photo( $arr ){ $arr['profile_photo'] = array( 'title' => __('Profile Photo','ultimate-member'), 'metakey' => 'profile_photo', 'type' => 'image', 'label' => __('Change your profile photo','ultimate-member'), 'upload_text' => __('Upload your photo here','ultimate-member'), 'icon' => 'um-faicon-camera', 'crop' => 1, 'max_size' => ( UM()->options()->get('profile_photo_max_size') ) ? UM()->options()->get('profile_photo_max_size') : 999999999, 'min_width' => str_replace('px','',UM()->options()->get('profile_photosize')), 'min_height' => str_replace('px','',UM()->options()->get('profile_photosize')), ); return $arr; } /** * Multiply Profile Photo with different sizes */ add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_photo', 9999, 2 ); function um_registration_set_profile_photo( $user_id, $args ){ if ( empty( $args['custom_fields'] ) ) return; if( ! isset( $args['form_id'] ) ) return; if( ! isset( $args['profile_photo'] ) || empty( $args['profile_photo'] ) ) return; // apply this to specific form //if( $args['form_id'] != 12345 ) return; $files = array(); $fields = unserialize( $args['custom_fields'] ); $user_basedir = UM()->uploader()->get_upload_user_base_dir( $user_id, true ); $profile_photo = get_user_meta( $user_id, 'profile_photo', true ); $image_path = $user_basedir . DIRECTORY_SEPARATOR . $profile_photo; $image = wp_get_image_editor( $image_path ); $file_info = wp_check_filetype_and_ext( $image_path, $profile_photo ); $ext = $file_info['ext']; $new_image_name = str_replace( $profile_photo, "profile_photo.".$ext, $image_path ); $sizes = UM()->options()->get( 'photo_thumb_sizes' ); $quality = UM()->options()->get( 'image_compression' ); if ( ! is_wp_error( $image ) ) { $max_w = UM()->options()->get('image_max_width'); if ( $src_w > $max_w ) { $image->resize( $max_w, $src_h ); } $image->save( $new_image_name ); $image->set_quality( $quality ); $sizes_array = array(); foreach( $sizes as $size ){ $sizes_array[ ] = array ('width' => $size ); } $image->multi_resize( $sizes_array ); delete_user_meta( $user_id, 'synced_profile_photo' ); update_user_meta( $user_id, 'profile_photo', "profile_photo.{$ext}" ); @unlink( $image_path ); } }
hi, yes I did actually cuz I have no much time for it I have to send it to my client ..
I will submit a ticket for my other site so you try to see what’s wrong with it..
Thank You for your support and great plugin.no still the same problem in both sites
Any update about the issue?
sure,
this is for (talents):
https://blueartworld.com/%d8%aa%d8%b3%d8%ac%d9%8a%d9%84-%d8%a7%d9%84%d9%85%d9%88%d9%87%d9%88%d8%a8%d9%8a%d9%86/this is for (company):
https://blueartworld.com/%d8%aa%d8%b3%d8%ac%d9%8a%d9%84-%d8%a7%d9%84%d8%b4%d8%b1%d9%83%d8%a7%d8%aa/thank you so much .. so the problem was with my way of building the heading and the way with element design in mobile .. i made a new test header with only the element that i use your plugin with , and it worked just fine ?? thank you for your help ??
I updated the plugin but still the same problem.. i deactivated the plugin and the buttons click in both desktop and mobile but i need to use the plugin for the user role visibility control
could you check my site for that ?Forum: Plugins
In reply to: [WooCommerce] shop manager user role problemit was a conflict with one of my security plugins. it’s working now ??
Thank You it’s working
I also read this (https://github.com/chitezh/woocommerce_states_places/wiki/Using-the-filter-hooks#disabling-specific-states-or-places) but could not fix it
hi, so let’s say I’m using the pro and applied some pro features on my site .. after one year if I did not purchase a new license the pro customization will disappear from my site?
Forum: Plugins
In reply to: [States, Cities, and Places for WooCommerce] edit the plugin files and updategood by adding these filter hooks it will be deleted when I made an update to the theme or this plugin
?