-
Hi,
The Theme which I am using now is builded with profil edit page, so, the users can edit theirs profile as well as upload images. (To wp-content/upload) default WP. The code is;
PHP12345678910111213141516171819202122232425262728293031323334353637383940<?php get_header();/*Template Name: User - Profile*/if ( !empty( $_POST['submit'] ) ) {$allowed_file_types = array( "image/gif", "image/jpeg", "image/jpg", "image/png" );$upload_errors = '';// User Image Uploadif ( !empty( $_FILES['user_image']['name'] ) ) {// check to make sure its a successful uploadif ( $_FILES['user_image']['error'] !== UPLOAD_ERR_OK ) __return_false();if ( !in_array( $_FILES['user_image']['type'], $allowed_file_types ) ) {$upload_errors .= '<p class="alert alert-danger" role="alert" >' . __( 'Invalid file type:', 'tt' ) . ' "' . $_FILES['user_image']['type'] . '". ' . __( 'Supported file types: gif, jpg, jpeg, png.', 'tt' ) . '</p>';}// Max. File Size 5 MBif ( $_FILES['user_image']['size'] > 5000000 ) {$upload_errors .= '<p class="alert alert-danger" role="alert" >' . __( 'File is too large. Max. upload file size is 5 MB.', 'tt' ) . '</p>';}if ( !$upload_errors ) {require_once( ABSPATH . 'wp-admin/includes/image.php' );require_once( ABSPATH . 'wp-admin/includes/file.php' );require_once( ABSPATH . 'wp-admin/includes/media.php' );$attachment_id = media_handle_upload( 'user_image', 0 );$attachment_url = wp_get_attachment_url( $attachment_id );// Upload Profile Pictureupdate_user_meta( get_current_user_id(), 'user_image', $attachment_url );}}if ( !$upload_errors ) {I wanna use UserPro for different register form and memberlists, The profile fields are same (default WP) however, If a user upload a profile image on UserPro it doent appear on above edit page as well as Theme’s profile page, UserPro has own upload folder right?
My question is how can I set-up the above folder (Profile Image/Avatar section) that If a user upload whether on UserPro or Profile edit page on my Theme, in same folder uploaded and bouth profile edit pages call same image for each user profile.
Best Regards
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.