-
-
Save champsupertramp/6b73195db24eb6650a23b4440b4287c3 to your computer and use it in GitHub Desktop.
/** | |
* Ultimate Member - Customization | |
* Description: Allow everyone to upload profile and cover photos on front-end pages. | |
*/ | |
add_filter("um_user_pre_updating_files_array","um_custom_user_pre_updating_files_array", 10, 1); | |
function um_custom_user_pre_updating_files_array( $arr_files ){ | |
if( is_array( $arr_files ) ){ | |
foreach( $arr_files as $key => $details ){ | |
if( $key == "userphoto" ){ | |
unset( $arr_files[ $key ] ); | |
$arr_files[ "profile_photo" ] = $details; | |
} | |
} | |
} | |
return $arr_files; | |
} | |
add_filter("um_allow_frontend_image_uploads","um_custom_allow_frontend_image_uploads",10, 3); | |
function um_custom_allow_frontend_image_uploads( $allowed, $user_id, $key ){ | |
if( $key == "profile_photo" ){ | |
return true; | |
} | |
return $allowed; // false | |
} |
Hey thanks for this code! I am having trouble getting the image to show as the profile image on the general account page. Also, is there a way to add an option on the general account page once you are logged in to change/update the profile image? Thanks!!
Hi Everyone,
I'll be sharing some Ultimate Member customizations & tutorials on my website: www.champ.ninja
Subscribe to my newsletter to get the latest tutorials.
Regards,
Can any one send me the code to add cover photo
Hi,
- Copy the above code in your theme's function.php file. Should be in public_html/wp-content/themes/your-themes-name/function.php
- In ultimate member add 'upload image' field in registration form.
- Enter meta key as 'userphoto' (i.e same as in the code above)
- Profit.
Hi,
This is working fine.
But when updating the ultimate member plugin, user profile picture removed. Please help me.
During upload it’s showing "the image is too large" but actually not a large image at all. I tried many sizes,resulations,formates.
Please help me to fix it.
Thanks in advance
Hello @everyone - Here's the latest version of custom Upload Profile Photo for Ultimate Member 2.0:
https://gist.github.com/champsupertramp/a7ce812c702865cb973445c9fe7a9544
By the way, i will be accepting custom code requests on my website www.champ.ninja
Thank you,