add_action( 'gform_after_submission_21', 'add_gf_upload_to_media_library', 10, 2 ); /** * Imports a file uploaded via Gravity Forms into the WordPress Media Library. * * IMPORTANT: Replace '1' with your Form ID and '5' with your File Upload Field ID. */ function add_gf_upload_to_media_library( $entry, $form ) { // --- Configuration --- $form_id = 1; // Replace with your Form ID $field_id = 5; // Replace with the ID of your File Upload field // --- End Configuration --- // Check if the current form ID matches the configuration if ( $form['id'] != $form_id ) { return; } // 1. Get the file URL uploaded by Gravity Forms $file_url = rgar( $entry, $field_id ); if ( empty( $file_url ) ) { return; } // 2. Include the necessary WordPress admin files require_once( ABSPATH . 'wp-admin/includes/image.php' ); require_once( ABSPATH . 'wp-admin/includes/file.php' ); require_once( ABSPATH . 'wp-admin/includes/media.php' ); // 3. Get the file's server path and prepare for sideloading $upload_dir = wp_upload_dir(); // This removes the base URL part to get the relative path $relative_path = str_replace( $upload_dir['baseurl'] . '/', '', $file_url ); // This creates the full path on the server $file_path = $upload_dir['basedir'] . '/' . $relative_path; // Check if the file exists at the path if ( ! file_exists( $file_path ) ) { return; } // 4. Create the file array needed by media_handle_sideload $file_array = array( 'name' => basename( $file_path ), 'tmp_name' => $file_path, 'error' => 0, 'size' => filesize( $file_path ), ); // 5. Use the media_handle_sideload function // This copies the file to the standard uploads folder, registers it in the DB, // and generates thumbnails/metadata. $attach_id = media_handle_sideload( $file_array, 0 ); // Check for errors (optional logging) if ( is_wp_error( $attach_id ) ) { // You could add error logging here if needed } }
Loading Events

« All Events

Evening Minyan

March 22, 2026 @ 5:45 pm - 6:45 pm

|Recurring Event (See all)

An event every week that begins at 5:45 pm on Sunday, Monday, Tuesday, Wednesday, Thursday and Saturday, repeating indefinitely

Join our daily evening virtual minyan at Beth El! This service gathers in person each morning and is also accessible via our CyberShul.

Details

Date:
March 22, 2026
Time:
5:45 pm - 6:45 pm