Upload Directories Per User (reference)

function per_user_upload_dir( $original ){ $modified = $original; if( ( isset( $_REQUEST[‘action’] ) && ( “um_resize_image” == $_REQUEST[‘action’] || “um_imageupload” == $_REQUEST[‘action’] ) ) || isset( $_REQUEST[‘um_action’] ) ){ return $original; } elseif ( is_user_logged_in() && !current_user_can( ‘manage_options’ ) ) {…Continue reading

Per User ACF Upload Directory (reference)

add_filter(‘acf/upload_prefilter/name=gallery_post_featured_image’, ‘per_user_upload_prefilter’); function per_user_upload_prefilter($errors) { // in this filter we add a WP filter that alters the upload path add_filter(‘upload_dir’, ‘per_user_upload_dir’); return $errors; } // second filter function per_user_upload_dir($uploads) { // here is where we alter the path $current_user =…Continue reading

Delete User with Disapprove

add_action(“um_after_user_status_is_changed”,”um_011822_delete_account_on_rejection”, 10, 2); function um_011822_delete_account_on_rejection( $status, $user_id ) { if( “rejected” == $status ) { // Disable delete notification on rejection and deletion UM()->user()->send_mail_on_delete = false; if ( is_multisite() ) { if ( ! function_exists( ‘wpmu_delete_user’ ) ) { require_once(…Continue reading

Automatically Delete Woocommerce Images After Deleting a Product

// Automatically Delete Woocommerce Images After Deleting a Product add_action( ‘before_delete_post’, ‘delete_product_images’, 10, 1 ); function delete_product_images( $post_id ) { $product = wc_get_product( $post_id ); if ( !$product ) { return; } $featured_image_id = $product->get_image_id(); $image_galleries_id = $product->get_gallery_image_ids(); if( !empty(…Continue reading

User preferences

echo ‘The current logged in user ID is: ‘.get_current_user_id(); echo ; $all_meta_for_user = get_user_meta( get_current_user_id() ); print_r( $all_meta_for_user ); echo ; $last_name = $all_meta_for_user[‘last_name’][0]; echo ; echo ‘Last name:’.$last_name;Continue reading