Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter mufc0123

    (@mufc0123)

    Just a follow up to see if you received my email as it may have reached your spam folder.

    Thanks

    Thread Starter mufc0123

    (@mufc0123)

    It’s also our relaunch and the developers went quiet months ago where we had to fix a lot of the problems (there were many), but this issue has us hitting at a blank wall.

    Thread Starter mufc0123

    (@mufc0123)

    Hi,

    Am I able to send you a direct link privately as I’m not able to post it publicly.

    I have the latest version of your plugin installed and updated and it’s been working fine until users started telling us the problem was only found to be linked to IOS.

    Thread Starter mufc0123

    (@mufc0123)

    Apologies for the long code, I wasn’t able to attach a file, below is the final part of the submission form.

    <?php

    if ( ! defined( ‘ABSPATH’ ) ) {
    exit; // Exit if accessed directly
    }
    if ( ! session_id() ) {
    @session_start();
    }

    /**
    * @class OpalEstate_Submission
    *
    * @version 1.0
    */
    class OpalEstate_Submission {

    /**
    *
    *
    */
    public $metabox;

    /**
    *
    *
    */
    public $new_attachmenet_ids = [];

    /**
    * Constructor
    */
    public function __construct() {

    /**
    * Can not use $this->is_submission_page() || use ‘wp_enqueue_scripts’ here
    * because inside this hook global $post == null
    */
    add_action( ‘wp_head’, [ $this, ‘head_check_page’ ] );

    add_action( ‘cmb2_after_init’, [ $this, ‘process_submission’ ], 10000 );

    add_action( ‘opalestate_single_property_before’, [ $this, ‘render_button_edit’ ] );

    if ( is_admin() ) {
    add_filter( ‘opalestate_settings_tabs’, [ $this, ‘setting_content_tab’ ] );
    add_filter( ‘opalestate_registered_submission_page_settings’, [ $this, ‘setting_content_fields’ ] );
    }

    add_action( ‘opalestate_user_content_submission_list_page’, [ $this, ‘submission_list’ ] );
    add_action( ‘opalestate_user_content_submission_page’, [ $this, ‘submission’ ] );
    add_action( ‘wp_enqueue_scripts’, [ $this, ‘scripts_styles’ ], 99 );

    $this->register_shortcodes();
    }

    /**
    * Save post.
    */
    public function scripts_styles() {

    wp_register_style( ‘opalesate-submission’, OPALESTATE_PLUGIN_URL . ‘assets/submission.css’ );
    wp_register_style( ‘opalesate-cmb2-front’, OPALESTATE_PLUGIN_URL . ‘assets/cmb2-front.css’ );
    wp_register_script(
    ‘opalestate-submission’,
    OPALESTATE_PLUGIN_URL . ‘assets/js/frontend/submission.js’,
    [
    ‘jquery’,
    ],
    ‘1.0’,
    true
    );
    }

    /*
    * Is submission page. ‘submission_page’ option in General Setting
    */
    public function register_shortcodes() {
    $shortcodes = [
    ‘submission’ => [
    ‘code’ => ‘submission’,
    ‘label’ => esc_html__( ‘Submission Form’, ‘opalestate-pro’ ),
    ],
    ‘submission_list’ => [
    ‘code’ => ‘submission_list’,
    ‘label’ => esc_html__( ‘My Properties’, ‘opalestate-pro’ ),
    ],
    ];

    foreach ( $shortcodes as $shortcode ) {
    add_shortcode( ‘opalestate_’ . $shortcode[‘code’], [ $this, $shortcode[‘code’] ] );
    }
    }

    /*
    * Is submission page. ‘submission_page’ option in General Setting
    */
    public function setting_content_tab( $tabs ) {
    $tabs[‘submission_page’] = esc_html__( ‘Submission’, ‘opalestate-pro’ );

    return $tabs;
    }

    /*
    * Is submission page. ‘submission_page’ option in General Setting
    */
    public function setting_content_fields( $fields = [] ) {
    $fields = [
    ‘id’ => ‘submission_page’,
    ‘title’ => esc_html__( ‘Email Settings’, ‘opalestate-pro’ ),
    ‘show_on’ => [ ‘key’ => ‘options-page’, ‘value’ => [ ‘opalestate_settings’ ], ],
    ‘fields’ => apply_filters( ‘opalestate_settings_submission’, [
    [
    ‘name’ => esc_html__( ‘Submission Page Settings’, ‘opalestate-pro’ ),
    ‘id’ => ‘opalestate_title_submission_page_settings’,
    ‘type’ => ‘title’,
    ‘after_row’ => ‘<hr>’,
    ],
    [
    ‘name’ => esc_html__( ‘Property Submission Page’, ‘opalestate-pro’ ),
    ‘desc’ => __( ‘This is the submission page. The [opalestate_submission] shortcode should be on this page.’, ‘opalestate-pro’ ),
    ‘id’ => ‘submission_page’,
    ‘type’ => ‘select’,
    ‘options’ => opalestate_cmb2_get_post_options( [
    ‘post_type’ => ‘page’,
    ‘numberposts’ => -1,
    ] ),
    ],
    [
    ‘name’ => esc_html__( ‘Show Content when User Not Login’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Show Login/Register form and submission form if the user is not logged in.’, ‘opalestate-pro’ ),
    ‘id’ => ‘submission_show_content’,
    ‘type’ => ‘select’,
    ‘default’ => ”,
    ‘options’ => [
    ” => esc_html__( ‘Show Login Form’, ‘opalestate-pro’ ),
    ‘login_submission’ => esc_html__( ‘Show Login Form and Submission Form’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Admin Approve’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Admin must review and approve before properties are published.’, ‘opalestate-pro’ ),
    ‘id’ => ‘admin_approve’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ‘default’ => ‘on’,
    ],
    [
    ‘name’ => esc_html__( ‘Submission Tab Settings’, ‘opalestate-pro’ ),
    ‘id’ => ‘opalestate_title_submission_tab_settings’,
    ‘type’ => ‘title’,
    ‘before_row’ => ‘<hr>’,
    ‘after_row’ => ‘<hr>’,
    ],
    [
    ‘name’ => esc_html__( ‘Enable Media tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Media tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_media’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Location tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Location tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_location’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Information tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Information tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_information’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Amenities tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Amenities tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_amenities’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Facilities tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Facilities tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_facilities’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Apartments tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Apartments tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_apartments’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Enable Floor plans tab’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable Floor plans tab’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_tab_floor_plans’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Submission Settings’, ‘opalestate-pro’ ),
    ‘id’ => ‘opalestate_title_submission_settings’,
    ‘type’ => ‘title’,
    ‘before_row’ => ‘<hr>’,
    ‘after_row’ => ‘<hr>’,
    ],
    [
    ‘name’ => esc_html__( ‘Generate property SKU’, ‘opalestate-pro’ ),
    ‘desc’ => esc_html__( ‘Enable automatic generate property SKU.’, ‘opalestate-pro’ ),
    ‘id’ => ‘enable_submission_generate_sku’,
    ‘type’ => ‘switch’,
    ‘options’ => [
    ‘on’ => esc_html__( ‘Enable’, ‘opalestate-pro’ ),
    ‘off’ => esc_html__( ‘Disable’, ‘opalestate-pro’ ),
    ],
    ],
    [
    ‘name’ => esc_html__( ‘Property SKU format’, ‘opalestate-pro’ ),
    ‘desc’ => __( ‘Use {property_id} to generate the property ID.’, ‘opalestate-pro’ ),
    ‘id’ => ‘submission_sku_format’,
    ‘type’ => ‘text’,
    ‘default’ => ‘SKU-{property_id}’,
    ],
    ]
    ),
    ];

    return $fields;
    }

    /*
    * Is submission page. ‘submission_page’ option in General Setting
    */
    public function head_check_page() {

    }

    /*
    * Is submission page. ‘submission_page’ option in General Setting
    */
    public function render_button_edit() {
    global $post, $current_user;

    wp_get_current_user();

    if ( $current_user->ID == $post->post_author ) {
    echo ‘<div class=”property-button-edit”>
    ID ) . ‘”>’ . esc_html__( ‘Edit My Property’, ‘opalestate-pro’ ) . ‘
    </div>’;
    }
    }

    /*
    * Is submission page. ‘submission_page’ option in General Setting
    */
    public function is_submission_page() {
    global $post;
    if ( ! $post || ! isset( $post->ID ) || ! $post->ID ) {
    return false;
    }

    return opalestate_get_option( ‘submission_page’ ) == $post->ID;
    }

    /**
    * Register metabox.
    *
    * @return \Opalestate_Property_MetaBox_Submission
    */
    public function register_metabox() {
    $metabox = new Opalestate_Property_MetaBox_Submission();

    add_filter( ‘cmb2_meta_boxes’, [ $metabox, ‘register_form’ ], 9999 );

    return $metabox;
    }

    /**
    * FrontEnd Submission
    */
    public function submission() {
    global $current_user;

    if ( ! is_user_logged_in() ) {
    echo opalestate_load_template_path( ‘submission/require-login’ );
    if ( empty( opalestate_get_option( “submission_show_content” ) ) ) {
    return “”;
    }
    }

    if ( isset( $_GET[‘do’] ) && $_GET[‘do’] == ‘completed’ ) {
    OpalEstate()->session->set( ‘submission’, ‘addnew’ );

    echo opalestate_load_template_path( ‘submission/completed’ );

    return;
    }

    // remove all dirty images before edit/create new a property
    $this->cleanup();

    wp_enqueue_script( ‘opalestate-submission’ );
    wp_enqueue_style( ‘opalesate-submission’ );
    wp_enqueue_style( ‘opalesate-cmb2-front’ );

    $metabox = $this->register_metabox();
    $metaboxes = apply_filters( ‘cmb2_meta_boxes’, [] );

    if ( ! isset( $metaboxes[ OPALESTATE_PROPERTY_PREFIX . ‘front’ ] ) ) {
    return esc_html__( ‘A metabox with the specified \’metabox_id\’ doesn\’t exist.’, ‘opalestate-pro’ );
    }
    $post_id = 0;

    if ( is_user_logged_in() ) {
    // CMB2 is getting fields values from current post what means it will fetch data from submission page
    // We need to remove all data before.
    $post_id = ! empty( $_GET[‘id’] ) ? absint( $_GET[‘id’] ) : false;
    if ( ! $post_id ) {
    unset( $_POST );
    foreach ( $metaboxes[ OPALESTATE_PROPERTY_PREFIX . ‘front’ ][‘fields’] as $field_name => $field_value ) {
    delete_post_meta( get_the_ID(), $field_value[‘id’] );
    }
    }

    if ( ! empty( $post_id ) && ! empty( $_POST[‘object_id’] ) ) {
    $post_id = absint( $_POST[‘object_id’] );

    }

    if ( $post_id && ! opalestate_is_own_property( $post_id, $current_user->ID ) ) {
    echo opalestate_load_template_path( ‘parts/has-warning’ );

    return;
    }
    }

    return opalestate_load_template_path( ‘submission/submission-form’,
    [
    ‘post_id’ => $post_id,
    ‘metaboxes’ => $metaboxes,
    ‘navigation’ => $metabox->get_fields_groups(),
    ] );
    }

    /**
    *
    *
    */
    public function cmb2_get_metabox() {
    $object_id = ‘fake-oject-id’;

    return cmb2_get_metabox( OPALESTATE_PROPERTY_PREFIX . ‘front’, $object_id );
    }

    /**
    * FrontEnd Submission
    */
    public function process_submission() {

    if ( isset( $_POST[‘submission_action’] ) && ! empty( $_POST[‘submission_action’] ) ) {

    if ( wp_verify_nonce( $_POST[‘submission_action’], ‘submitted-property’ ) ) {

    $user_id = get_current_user_id();
    $edit = false;
    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $blocked = OpalEstate_User::is_blocked();

    // Setup and sanitize data
    if ( isset( $_POST[ $prefix . ‘title’ ] ) && ! $blocked && $user_id ) {
    $metabox = $this->register_metabox();
    $metaboxes = apply_filters( ‘cmb2_meta_boxes’, [] );

    $post_id = ! empty( $_POST[‘post_id’] ) ? absint( $_POST[‘post_id’] ) : false;

    if ( $post_id ) {
    do_action( ‘opalestate_process_edit_submission_before’ );
    } else {
    do_action( ‘opalestate_process_submission_before’ );
    }

    $post_status = ‘pending’;

    if ( ‘on’ != opalestate_get_option( ‘admin_approve’, ‘on’ ) ) {
    $post_status = ‘publish’;
    }

    // If we are updating the post get old one. We need old post to set proper
    // post_date value because just modified post will at the top in archive pages.
    if ( ! empty( $post_id ) ) {
    $old_post = get_post( $post_id );
    $post_date = $old_post->post_date;
    } else {
    $post_date = ”;
    }

    $post_content = isset( $_POST[ $prefix . ‘text’ ] ) ? wp_kses( $_POST[ $prefix . ‘text’ ],
    ‘<b><i><h1><h2><h3><h4><h5><h6>

    <span><p>' ) : '';
    
    					$data = [
    						'post_title'   => sanitize_text_field( $_POST[ $prefix . 'title' ] ),
    						'post_author'  => $user_id,
    						'post_status'  => $post_status,
    						'post_type'    => 'opalestate_property',
    						'post_date'    => $post_date,
    						'post_content' => $post_content,
    					];
    
    					$unset_fields = [
    						'text',
    						'title',
    						'post_type',
    					];
    
    					unset( $_POST['post_type'] );
    
    					foreach ( $unset_fields as $field ) {
    						unset( $_POST[ $prefix . $field ] );
    					}
    
    					if ( ! empty( $post_id ) ) {
    						$edit       = true;
    						$data['ID'] = $post_id;
    
    						do_action( 'opalestate_process_edit_submission_before' );
    					} else {
    						do_action( 'opalestate_process_add_submission_before' );
    					}
    
    					if ( empty( $data['post_title'] ) || empty( $data['post_author'] ) ) {
    						return opalestate_output_msg_json( false,
    							__( 'Please enter data for all require fields before submitting', 'opalestate-pro' ),
    							[
    								'heading' => esc_html__( 'Submission Information', 'opalestate-pro' ),
    							] );
    					}
    
    					$post_id = wp_insert_post( $data, true );
    
    					if ( ! empty( $post_id ) && ! empty( $_POST['object_id'] ) ) {
    						$_POST['object_id'] = (int) $post_id;
    
    						$metaboxes = apply_filters( 'cmb2_meta_boxes', [] );
    
    						/*
    						 * Processing upload files
    						 */
    						$this->process_upload_files( $post_id, $_POST );
    
    						/**
    						 * Fetch sanitized values
    						 */
    						cmb2_get_metabox_form( $metaboxes[ $prefix . 'front' ], $post_id );
    						$cmb              = $this->cmb2_get_metabox();
    						$sanitized_values = $cmb->get_sanitized_values( $_POST );
    						$cmb->save_fields( $post_id, 'post', $sanitized_values );
    
    						// Create featured image
    						$featured_image = get_post_meta( $post_id, $prefix . 'featured_image', true );
    
    						if ( ! empty( $_POST[ $prefix . 'featured_image' ] ) && isset( $_POST[ $prefix . 'featured_image' ] ) ) {
    							if ( $_POST[ $prefix . 'featured_image' ] && is_array( $_POST[ $prefix . 'featured_image' ] ) ) {
    								foreach ( $_POST[ $prefix . 'featured_image' ] as $key => $value ) {
    									set_post_thumbnail( $post_id, $key );
    								}
    							}
    							unset( $_POST[ $prefix . 'featured_image' ] );
    						} else {
    							delete_post_thumbnail( $post_id );
    						}
    
    						// Remove meta field.
    						update_post_meta( $post_id, $prefix . 'featured_image', null );
    
    						// Update SKU.
    						if ( 'on' == opalestate_get_option( 'enable_submission_generate_sku', 'off' ) ) {
    							$_sku          = str_replace( '{property_id}', $post_id, opalestate_options( 'submission_sku_format', 'SKU-{property_id}' ) );
    							$sku_generated = apply_filters( 'opalestate_submission_sku_generated', sanitize_text_field( $_sku ) );
    							update_post_meta( $post_id, $prefix . 'sku', $sku_generated );
    						}
    
    						//redirect
    						$_SESSION['messages'][] = [ 'success', esc_html__( 'Property has been successfully updated.', 'opalestate-pro' ) ];
    
    						do_action( "opalestate_process_submission_after", $user_id, $post_id, $edit );
    
    						if ( $edit ) {
    							$type    = OpalEstate()->session->set( 'submission', 'edit' );
    							$message = esc_html__( 'The property has updated completed with new information', 'opalestate-pro' );
    							do_action( "opalestate_processed_edit_submission", $user_id, $post_id );
    						} else {
    							$type    = OpalEstate()->session->get( 'submission', 'addnew' );
    							$message = esc_html__( 'You have submitted the property successful', 'opalestate-pro' );
    							do_action( "opalestate_processed_new_submission", $user_id, $post_id );
    						}
    
    						// set ready of attachment for use.
    						if ( $this->new_attachmenet_ids ) {
    							foreach ( $this->new_attachmenet_ids as $_id ) {
    								delete_post_meta( $_id, '_pending_to_use_', 1 );
    							}
    						}
    
    						return opalestate_output_msg_json( true,
    							$message,
    							[
    								'heading'  => esc_html__( 'Submission Information', 'opalestate-pro' ),
    								'redirect' => opalestate_submssion_page( $post_id, [ 'do' => 'completed' ] ),
    							] );
    					}
    				} else {
    					return opalestate_output_msg_json( false,
    						__( 'Currently, your account was blocked, please keep contact admin to resolve this!.', 'opalestate-pro' ),
    						[ 'heading' => esc_html__( 'Submission Information', 'opalestate-pro' ) ]
    					);
    				}
    			}
    
    			return opalestate_output_msg_json( false,
    				__( 'Sorry! Your submitted datcould not save a at this time', 'opalestate-pro' ),
    				[ 'heading' => esc_html__( 'Submission Information', 'opalestate-pro' ) ]
    			);
    		}
    	}
    
    	/**
    	 *
    	 *
    	 */
    	private function get_field_name( $field ) {
    		return OPALESTATE_PROPERTY_PREFIX . $field;
    	}
    
    	/**
    	 * Process upload files.
    	 *
    	 * @param int $post_id Post ID.
    	 */
    	private function process_upload_files( $post_id ) {
    
    		//upload images for featured and gallery images
    		if ( isset( $_FILES ) && ! empty( $_FILES ) ) {
    
    			/// 
    			$fields = [
    				$this->get_field_name( 'gallery' ),
    				$this->get_field_name( 'featured_image' ),
    			];
    
    			foreach ( $_FILES as $key => $value ) {
    				// allow processing in fixed collection
    				if ( in_array( $key, $fields ) ) {
    					$ufile = $_FILES[ $key ];
    
    					/// /////
    					if ( isset( $ufile['name'] ) && is_array( $ufile['name'] ) ) {
    						$output = [];
    
    						foreach ( $ufile['name'] as $f_key => $f_value ) {
    							$loop_file = [
    								'name'     => $ufile['name'][ $f_key ],
    								'type'     => $ufile['type'][ $f_key ],
    								'tmp_name' => $ufile['tmp_name'][ $f_key ],
    								'error'    => $ufile['error'][ $f_key ],
    								'size'     => $ufile['size'][ $f_key ],
    							];
    							$new_atm   = $this->upload_image( $loop_file, $post_id );
    							if ( $new_atm ) {
    								$_POST[ $key ]                                          = isset( $_POST[ $key ] ) ? $_POST[ $key ] : [];
    								$_POST[ $key ][ $new_atm['attachment_id'] ]             = $new_atm['url'];
    								$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
    							}
    						}
    
    					} ///
    					elseif ( isset( $ufile['name'] ) ) {
    						$new_atm = $this->upload_image( $ufile, $post_id );
    						if ( $new_atm ) {
    							$_POST[ $key ][ $new_atm['attachment_id'] ]             = $new_atm['url'];
    							$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
    						}
    					}
    					//// / // 
    				}
    			}
    
    			// for group files 
    			$fields = [
    				$this->get_field_name( 'public_floor_group' ),
    			];
    
    			foreach ( $_FILES as $key => $value ) {
    				if ( in_array( $key, $fields ) ) {
    					$ufile = $_FILES[ $key ];
    
    					if ( isset( $ufile['name'] ) && is_array( $ufile['name'] ) ) {
    						$output = [];
    						foreach ( $ufile['name'] as $f_key => $f_value ) {
    
    							foreach ( $f_value as $u_key => $u_v ) {
    								$loop_file = [
    									'name'     => $ufile['name'][ $f_key ][ $u_key ],
    									'type'     => $ufile['type'][ $f_key ][ $u_key ],
    									'tmp_name' => $ufile['tmp_name'][ $f_key ][ $u_key ],
    									'error'    => $ufile['error'][ $f_key ][ $u_key ],
    									'size'     => $ufile['size'][ $f_key ][ $u_key ],
    								];
    
    								$new_atm = $this->upload_image( $loop_file, $post_id );
    								if ( $new_atm ) {
    
    									$_POST[ $key ][ $f_key ][ $u_key ]                      = $new_atm['attachment_id'];
    									$this->new_attachmenet_ids[ $new_atm['attachment_id'] ] = $new_atm['attachment_id'];
    								}
    							}
    						}
    					}
    				}
    			}
    		}
    	}
    
    	/**
    	 * Process upload images for properties
    	 */
    	public function upload_image( $submitted_file, $parent_id = 0 ) {
    		return opalesate_upload_image( $submitted_file, $parent_id );
    	}
    
    	/**
    	 * FrontEnd Submission
    	 */
    	private function cleanup() {
    		$user_id = get_current_user_id();
    		opalestate_clean_attachments( $user_id );
    	}
    
    	/**
    	 * FrontEnd Submission
    	 */
    	public function submission_list() {
    		if ( ! is_user_logged_in() ) {
    			echo opalestate_load_template_path( 'parts/not-allowed' );
    
    			return;
    		}
    
    		if ( isset( $_GET['id'] ) && isset( $_GET['remove'] ) ) {
    			$is_allowed = Opalestate_Property::is_allowed_remove( get_current_user_id(), intval( $_GET['id'] ) );
    			if ( ! $is_allowed ) {
    				echo opalestate_load_template_path( 'parts/not-allowed' );
    
    				return;
    			}
    
    			if ( wp_delete_post( intval( $_GET['id'] ) ) ) {
    				$_SESSION['messages'][] = [ 'success', esc_html__( 'Property has been successfully removed.', 'opalestate-pro' ) ];
    			} else {
    				$_SESSION['messages'][] = [ 'danger', esc_html__( 'An error occured when removing an item.', 'opalestate-pro' ) ];
    			}
    
    			wp_redirect( opalestate_submssion_list_page() );
    		}
    
    
    		$args = [];
    
    		if ( isset( $_GET['status'] ) && ! empty( $_GET['status'] ) ) {
    			$args['post_status'] = sanitize_text_field( $_GET['status'] );
    		}
    
    		$loop = Opalestate_Query::get_properties_by_user( $args, get_current_user_id() );
    
    		return opalestate_load_template_path( 'user/my-properties', [ 'loop' => $loop ] );
    	}
    }
    
    new OpalEstate_Submission();
    

    Thread Starter mufc0123

    (@mufc0123)

    Hi,

    Please see the form process below and can I share a test login with you privately as it’s a live website?

    The idea of this form process is so users can save/edit re-save these fields.

    <?php
    if ( ! defined( ‘ABSPATH’ ) ) {
    exit; // Exit if accessed directly
    }

    class Opalestate_Property_MetaBox_Submission {

    /**
    * Defines custom front end fields
    *
    * @access public
    * @param array $metaboxes
    * @return array
    */
    public function register_form( array $metaboxes ) {

    $prefix = OPALESTATE_PROPERTY_PREFIX;

    $fields = array_merge(
    $this->metaboxes_general_fields_front(),

    $this->is_enabled_tab( ‘media’ ) ? $this->metaboxes_media_fields() : [],
    $this->is_enabled_tab( ‘location’ ) ? $this->metaboxes_location_fields() : [],
    $this->is_enabled_tab( ‘information’ ) ? $this->metaboxes_info_fields() : [],
    $this->is_enabled_tab( ‘amenities’ ) ? $this->metaboxes_amenities_fields() : [],
    $this->is_enabled_tab( ‘facilities’ ) ? $this->metaboxes_public_facilities_fields() : [],
    $this->is_enabled_tab( ‘apartments’ ) ? $this->metaboxes_public_apartments_fields() : [],
    $this->is_enabled_tab( ‘floor_plans’ ) ? $this->metaboxes_public_floor_plans_fields() : []
    );

    $metaboxes[ $prefix . ‘front’ ] = [
    ‘id’ => $prefix . ‘front’,
    ‘title’ => esc_html__( ‘Name and Description’, ‘opalestate-pro’ ),
    ‘object_types’ => [ ‘opalestate_property’ ],
    ‘context’ => ‘normal’,
    ‘priority’ => ‘high’,
    ‘save_fields’ => false,
    ‘show_names’ => true,
    ‘fields’ => $fields,
    ‘cmb_styles’ => false,

    ];

    return $metaboxes;
    }

    public function get_fields_groups() {
    return [
    ‘general’ => [ ‘status’ => true, ‘title’ => esc_html__( ‘General’, ‘opalestate-pro’ ) ],
    ‘media’ => [ ‘status’ => $this->is_enabled_tab( ‘media’ ), ‘title’ => esc_html__( ‘Media’, ‘opalestate-pro’ ) ],
    ‘location’ => [ ‘status’ => $this->is_enabled_tab( ‘location’ ), ‘title’ => esc_html__( ‘Location’, ‘opalestate-pro’ ) ],
    ‘information’ => [ ‘status’ => $this->is_enabled_tab( ‘information’ ), ‘title’ => esc_html__( ‘Information’, ‘opalestate-pro’ ) ],
    ‘amenities’ => [ ‘status’ => $this->is_enabled_tab( ‘amenities’ ), ‘title’ => esc_html__( ‘Amenities’, ‘opalestate-pro’ ) ],
    ‘facilities’ => [ ‘status’ => $this->is_enabled_tab( ‘facilities’ ), ‘title’ => esc_html__( ‘Facilities’, ‘opalestate-pro’ ) ],
    ‘apartments’ => [ ‘status’ => $this->is_enabled_tab( ‘apartments’ ), ‘title’ => esc_html__( ‘Apartments’, ‘opalestate-pro’ ) ],
    ‘floor_plans’ => [ ‘status’ => $this->is_enabled_tab( ‘floor_plans’ ), ‘title’ => esc_html__( ‘Floor plans’, ‘opalestate-pro’ ) ],
    ];
    }

    public function metaboxes_general_fields_front() {
    $prefix = OPALESTATE_PROPERTY_PREFIX;

    $post_id = ”;
    if ( ! empty( $_GET[‘id’] ) ) {
    $post = get_post( intval( $_GET[‘id’] ) );
    $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( absint( $_GET[‘id’] ) ) );
    $post_id = $post->ID;
    }

    $currency = opalestate_currency_symbol() ? ‘ (‘ . opalestate_currency_symbol() . ‘)’ : ‘ ($)’;

    $fields = [
    [
    ‘id’ => ‘post_type’,
    ‘type’ => ‘hidden’,
    ‘default’ => ‘opalestate_property’,

    ],
    [
    ‘id’ => ‘post_id’,
    ‘type’ => ‘hidden’,
    ‘default’ => $post_id,

    ],

    [

    ‘id’ => $prefix . ‘title’,
    ‘type’ => ‘text’,

    ‘default’ => ! empty( $post ) ? $post->post_title : ‘Under Review’,
    ‘before_row’ => ‘<div id=”opalestate-submission-general” class=”opalestate-tab-content”>’,

    ],
    [
    ‘name’ => esc_html__( ‘Status’, ‘opalestate-pro’ ) . ‘<span class=”required”> *</span>’,

    ‘id’ => $prefix . ‘status’,

    ‘type’ => ‘taxonomy_select’,
    ‘taxonomy’ => ‘opalestate_status’,
    ‘class’ => ‘form-control’,
    ‘attributes’ => [
    ‘required’ => ‘required’,
    ],

    ],
    [
    ‘name’ => esc_html__( ‘Type’, ‘opalestate-pro’ ) . ‘<span class=”required”> *</span>’,

    ‘id’ => $prefix . ‘type’,
    ‘type’ => ‘taxonomy_select’,
    ‘taxonomy’ => ‘opalestate_types’,
    ‘class’ => ‘form-control’,
    ‘attributes’ => [
    ‘required’ => ‘required’,
    ],

    ],
    [
    ‘name’ => esc_html__( ‘Bedrooms’, ‘opalestate-pro’ ) . ‘<span class=”required”> *</span>’,
    ‘id’ => $prefix . ‘bedrooms’,
    ‘before_row’ => ‘<hr><div class=”field-row-2″>’,
    ‘type’ => ‘taxonomy_select’,
    ‘attributes’ => [ ‘required’ => ‘required’ ],
    ‘before_row’ => ‘<hr>’,
    ‘taxonomy’ => ‘opalestate_bedrooms’,
    ‘class’ => ‘form-control’,

    ],
    [
    ‘id’ => $prefix . ‘price’,
    ‘name’ => esc_html__( ‘Monthly Rent (£)’, ‘opalestate-pro’ ) . ‘<span class=”required”> *</span>’,

    ‘type’ => ‘text’,
    ‘description’ => esc_html__( ‘Enter amount without currency’, ‘opalestate-pro’ ),
    ‘attributes’ => [ ‘required’ => ‘required’ ],
    ‘after_row’ => ‘<hr><div class=”field-row-2″>’,
    ],

    [
    ‘id’ => $prefix . ‘pricelabel’,
    ‘name’ => esc_html__( ‘After Price Label (optional)’, ‘opalestate-pro’ ),
    ‘type’ => ‘hidden’,
    ‘default’ => ! empty( $post ) ? $post->post_title : ‘pcm’,
    ‘description’ => esc_html__( ‘After Price Label (e.g. “per month”)’, ‘opalestate-pro’ ),
    ‘before_row’ => ‘</div><hr><div class=”field-row-2″>’, // callback
    ],

    [
    ‘name’ => esc_html__( ‘Description’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘text’,
    ‘type’ => ‘wysiwyg’,
    ‘default’ => ! empty( $post ) ? $post->post_content : ”,
    ‘options’ => [
    ‘media_buttons’ => false,
    ‘dfw’ => false,
    ‘tinymce’ => false,
    ‘quicktags’ => false,
    ],

    ‘after_row’ => ‘</div><hr><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next’, ‘opalestate-pro’ ) . ‘</button></div>’, // callback
    ],

    ];

    return apply_filters( ‘opalestate_postype_property_metaboxes_fields_general’, $fields );
    }

    public function metaboxes_media_fields() {
    $id = 0;

    if ( isset( $_GET[‘id’] ) ) {
    $post_id = intval( $_GET[‘id’] );
    $id = get_post_thumbnail_id( $post_id );
    }

    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $fields = [

    [
    ‘id’ => $prefix . ‘featured_image’,
    ‘name’ => esc_html__( ‘Cover Image’, ‘opalestate-pro’ ),
    ‘type’ => ‘uploader’,
    ‘single’ => true,
    ‘attributes’ => [ ‘required’ => ‘required’ ],
    ‘value’ => $id,
    ‘description’ => esc_html__( ‘Select one or more images to show as a gallery’, ‘opalestate-pro’ ),
    ‘before_row’ => ‘<div id=”opalestate-submission-media” class=”opalestate-tab-content”>’,

    ],

    [
    ‘id’ => $prefix . ‘gallery’,
    ‘name’ => esc_html__( ‘Image Gallery’, ‘opalestate-pro’ ),
    ‘type’ => ‘uploader’,
    ‘description’ => esc_html__( ‘Select one or more images to show as gallery’, ‘opalestate-pro’ ),

    ],

    [
    ‘id’ => $prefix . ‘video’,
    ‘name’ => esc_html__( ‘Video URL’, ‘opalestate-pro’ ),
    ‘type’ => ‘text_url’,
    ‘before_row’ => ‘<hr>’,
    ‘description’ => esc_html__( ‘Input for videos, audios from Youtube, Vimeo and all supported sites.’, ‘opalestate-pro’ ),
    ],

    [
    ‘id’ => $prefix . ‘attachments’,
    ‘name’ => esc_html__( ‘Attachments’, ‘opalestate-pro’ ),
    ‘type’ => ‘uploader’,
    ‘before_row’ => ‘<hr>’,
    ‘attributes’ => [
    ‘required’ => ‘required’,
    ],
    ‘show_icon’ => true,
    ‘accept’ => ‘application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document’,
    ‘options’ => [
    ‘url’ => true, // Hide the text input for the url
    ],
    ‘description’ => esc_html__( ‘Select one or more files to allow download’, ‘opalestate-pro’ ),
    ‘after_row’ => ‘<hr><button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Back’,

    ‘opalestate-pro’ ) . ‘</button><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next’, ‘opalestate-pro’ ) . ‘</button></div>’,
    ],
    ];

    return apply_filters( ‘opalestate_postype_property_metaboxes_fields_price’, $fields );
    }

    public function metaboxes_info_fields() {
    $prefix = OPALESTATE_PROPERTY_PREFIX;

    $fields = [
    [
    ‘name’ => esc_html__( ‘Built year’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘builtyear’,
    ‘type’ => ‘text’,
    ‘description’ => esc_html__( ‘Enter built year’, ‘opalestate-pro’ ),

    ‘before_row’ => ‘<div id=”opalestate-submission-information” class=”opalestate-tab-content”><div class=”field-row-2″>’,
    ],
    [
    ‘name’ => esc_html__( ‘Parking’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘parking’,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter number of Parking’, ‘opalestate-pro’ ),
    ],
    [
    ‘name’ => esc_html__( ‘Bedrooms’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘bedrooms’,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter number of bedrooms’, ‘opalestate-pro’ ),
    ],
    [
    ‘name’ => esc_html__( ‘Bathrooms’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘bathrooms’,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter number of bathrooms’, ‘opalestate-pro’ ),
    ],
    [
    ‘name’ => esc_html__( ‘Plot Size’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘plotsize’,
    ‘type’ => ‘text’,
    ‘description’ => esc_html__( ‘Enter size of Plot as 20×30, 20x30x40, 20x30x40x50’, ‘opalestate-pro’ ),
    ],
    [
    ‘name’ => esc_html__( ‘Area Size’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘areasize’,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter size of area in sqft’, ‘opalestate-pro’ ),
    ],
    [
    ‘name’ => esc_html__( ‘Orientation’, ‘opalestate-pro’ ),
    ‘id’ => “{$prefix}orientation”,
    ‘type’ => ‘text’,
    ‘description’ => esc_html__( ‘Enter Orientation of property’, ‘opalestate-pro’ ),
    ],
    [
    ‘name’ => esc_html__( ‘Living Rooms’, ‘opalestate-pro’ ),
    ‘id’ => “{$prefix}livingrooms”,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter Number of Living Rooms’, ‘opalestate-pro’ ),
    ],

    [
    ‘name’ => esc_html__( ‘Kitchens’, ‘opalestate-pro’ ),
    ‘id’ => “{$prefix}kitchens”,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter Number of Kitchens’, ‘opalestate-pro’ ),
    ],

    [
    ‘name’ => esc_html__( ‘Rooms’, ‘opalestate-pro’ ),
    ‘id’ => “{$prefix}amountrooms”,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘type’ => ‘number’,
    ‘pattern’ => ‘\d*’,
    ],
    ‘sanitization_cb’ => ‘absint’,
    ‘escape_cb’ => ‘absint’,
    ‘description’ => esc_html__( ‘Enter Number of Amount Rooms’, ‘opalestate-pro’ ),
    ‘after_row’ => ‘</div><hr><button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Previous Step’,
    ‘opalestate-pro’ ) . ‘</button><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next Step’, ‘opalestate-pro’ ) . ‘</button></div>’,

    ],
    ];

    return apply_filters( ‘opalestate_metaboxes_public_info_fields’, $fields );
    }

    public function metaboxes_location_fields() {
    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $management = [

    [
    ‘name’ => esc_html__( ‘Property Address’, ‘opalestate-pro’ ) . ‘<span class=”required”> *</span>’,
    ‘id’ => $prefix . ‘address’,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘required’ => ‘required’,
    ],
    ‘after_row’ => ‘</div><hr>’,
    ‘before_row’ => ‘<div id=”opalestate-submission-location” class=”opalestate-tab-content”><div class=”field-row-2″>’,
    ],

    [
    ‘name’ => esc_html__( ‘Post Code/Zip’, ‘opalestate-pro’ ) . ‘<span class=”required”> *</span>’,
    ‘id’ => $prefix . ‘zipcode’,
    ‘type’ => ‘text’,
    ‘attributes’ => [
    ‘required’ => ‘required’,
    ],

    ‘after_row’ => ‘<button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Back’,
    ‘opalestate-pro’ ) . ‘</button><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next’, ‘opalestate-pro’ ) . ‘</button></div>’,
    ],
    ];

    return $management;
    }

    public function metaboxes_amenities_fields() {
    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $fields = [
    [
    ‘name’ => esc_html__( ‘Property Features’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘amenity’,
    ‘type’ => ‘taxonomy_multicheck’,
    ‘before_row’ => ‘<div id=”opalestate-submission-amenities” class=”opalestate-tab-content”>’,
    ‘after_row’ => ‘<button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Back’,
    ‘opalestate-pro’ ) . ‘</button><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next’, ‘opalestate-pro’ ) . ‘</button></div>’,
    ‘taxonomy’ => ‘opalestate_amenities’,
    ‘render_row_cb’ => [ $this, ‘amenities_html_callback’ ],
    ],
    ];

    return apply_filters( ‘opalestate_metaboxes_amenities_fields’, $fields );
    }

    public function metaboxes_public_facilities_fields() {

    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $fields = [
    [
    ‘id’ => $prefix . ‘public_facilities_group’,

    ‘type’ => ‘group’,
    ‘before_group’ => ‘<div id=”opalestate-submission-facilities” class=”opalestate-tab-content”>’,
    ‘after_group’ => ‘<button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Back’,
    ‘opalestate-pro’ ) . ‘</button><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next’, ‘opalestate-pro’ ) . ‘</button></div>’,
    ‘fields’ => [
    [
    ‘id’ => $prefix . ‘public_facilities_key’,
    ‘name’ => esc_html__( ‘Label’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ],
    [
    ‘id’ => $prefix . ‘public_facilities_value’,
    ‘name’ => esc_html__( ‘Content’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ],
    ],
    ‘options’ => [
    ‘group_title’ => esc_html__( ‘Facility {#}’, ‘opalestate-pro’ ),
    ‘add_button’ => esc_html__( ‘Add more’, ‘opalestate-pro’ ),
    ‘remove_button’ => esc_html__( ‘Remove’, ‘opalestate-pro’ ),
    ‘sortable’ => true,
    ‘closed’ => true,
    ],
    ],
    ];

    return apply_filters( ‘opalestate_metaboxes_public_facilities_fields’, $fields );
    }

    public function metaboxes_public_apartments_fields() {
    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $fields = [
    [
    ‘name’ => esc_html__( ‘Apartments’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘enable_apartments’,
    ‘type’ => ‘heading’,
    ‘options’ => [
    0 => esc_html__( ‘No’, ‘opalestate-pro’ ),
    1 => esc_html__( ‘Yes’, ‘opalestate-pro’ ),
    ],
    ‘before_row’ => ‘<div id=”opalestate-submission-apartments” class=”opalestate-tab-content”>’,
    ],
    [
    ‘id’ => $prefix . ‘apartments’,
    ‘type’ => ‘group’,
    ‘after_group’ => ‘<button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Previous Step’,
    ‘opalestate-pro’ ) . ‘</button><button type=”button” class=”submission-next-btn btn btn-primary”>’ . esc_html__( ‘Next Step’, ‘opalestate-pro’ ) . ‘</button></div>’,
    ‘fields’ => [
    [
    ‘id’ => $prefix . ‘apartment_plot’,
    ‘name’ => esc_html__( ‘Plot’, ‘opalestate-pro’ ),
    ‘before_row’ => ‘<div class=”field-row-2″>’,
    ‘type’ => ‘text’,

    ],

    [
    ‘id’ => $prefix . ‘apartment_beds’,
    ‘name’ => esc_html__( ‘Beds’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ],
    [
    ‘id’ => $prefix . ‘apartment_price_from’,
    ‘name’ => esc_html__( ‘Price from’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ],
    [
    ‘id’ => $prefix . ‘apartment_floor’,
    ‘name’ => esc_html__( ‘Floor’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ‘after_row’ => ‘</div>’,
    ],
    [
    ‘id’ => $prefix . ‘apartment_building_address’,
    ‘name’ => esc_html__( ‘Building / Address’, ‘opalestate-pro’ ),
    ‘type’ => ‘textarea_small’,
    ],
    [
    ‘id’ => $prefix . ‘apartment_status’,
    ‘name’ => esc_html__( ‘Status’, ‘opalestate-pro’ ),
    ‘type’ => ‘select’,
    ‘options’ => apply_filters( ‘opalestate_property_apartment_statuses’, [
    ‘available’ => esc_html__( ‘Available’, ‘opalestate-pro’ ),
    ‘unavailable’ => esc_html__( ‘Unavailable’, ‘opalestate-pro’ ),
    ] ),
    ‘before_row’ => ‘<div class=”field-row-2″>’,
    ],
    [
    ‘id’ => $prefix . ‘apartment_link’,
    ‘name’ => esc_html__( ‘Link’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ‘default’ => ‘#’,
    ‘after_row’ => ‘</div>’,
    ],
    ],
    ‘options’ => [
    ‘group_title’ => esc_html__( ‘Apartment {#}’, ‘opalestate-pro’ ),
    ‘add_button’ => esc_html__( ‘Add more’, ‘opalestate-pro’ ),
    ‘remove_button’ => esc_html__( ‘Remove’, ‘opalestate-pro’ ),
    ‘sortable’ => true,
    ‘closed’ => true,
    ],
    ],
    ];

    return apply_filters( ‘opalestate_metaboxes_public_apartments_fields’, $fields );
    }

    public function metaboxes_public_floor_plans_fields() {
    $prefix = OPALESTATE_PROPERTY_PREFIX;
    $fields = [

    [
    ‘name’ => esc_html__( ‘Floor Plans’, ‘opalestate-pro’ ),
    ‘id’ => $prefix . ‘enable_floor’,
    ‘type’ => ‘heading’,
    ‘before_row’ => ‘<div id=”opalestate-submission-floor_plans” class=”opalestate-tab-content”>’,
    ],
    [
    ‘id’ => $prefix . ‘public_floor_group’,
    ‘type’ => ‘group’,
    ‘after_group’ => ‘<button type=”button” class=”submission-back-btn btn btn-primary”>’ . esc_html__( ‘Previous Step’, ‘opalestate-pro’ ) . ‘</button></div>’,
    ‘fields’ => [
    [
    ‘id’ => $prefix . ‘floor_name’,
    ‘name’ => esc_html__( ‘Name’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,

    ],
    [
    ‘id’ => $prefix . ‘floor_price’,
    ‘name’ => esc_html__( ‘Price’, ‘opalestate-pro’ ),
    ‘before_row’ => ‘<div class=”field-row-2″>’,
    ‘type’ => ‘text’,
    ],
    [
    ‘id’ => $prefix . ‘floor_size’,
    ‘name’ => esc_html__( ‘Size’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ],
    [
    ‘id’ => $prefix . ‘floor_room’,
    ‘name’ => esc_html__( ‘Rooms’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ],
    [
    ‘id’ => $prefix . ‘floor_bath’,
    ‘name’ => esc_html__( ‘Baths’, ‘opalestate-pro’ ),
    ‘type’ => ‘text’,
    ‘after_row’ => ‘</div>’,
    ],
    [
    ‘id’ => $prefix . ‘floor_content’,
    ‘name’ => esc_html__( ‘Content’, ‘opalestate-pro’ ),
    ‘type’ => ‘textarea_small’,
    ],
    [
    ‘id’ => “{$prefix}floor_image_id”,
    ‘name’ => esc_html__( ‘Image Preview’, ‘opalestate-pro’ ),
    ‘type’ => ‘uploader’,
    ‘single’ => 1,

    ‘query_args’ => [
    ‘type’ => [
    ‘image/gif’,
    ‘image/jpeg’,
    ‘image/png’,
    ],
    ],
    ‘description’ => esc_html__( ‘Input iframe to show 360° Virtual Tour.’, ‘opalestate-pro’ ),
    ],
    ],
    ‘options’ => [
    ‘group_title’ => esc_html__( ‘Floor {#}’, ‘opalestate-pro’ ),
    ‘add_button’ => esc_html__( ‘Add more’, ‘opalestate-pro’ ),
    ‘remove_button’ => esc_html__( ‘Remove’, ‘opalestate-pro’ ),
    ‘sortable’ => true,
    ‘closed’ => false,
    ],
    ],
    ];

    return apply_filters( ‘opalestate_metaboxes_public_floor_plans_fields’, $fields );
    }

    protected function is_enabled_tab( $tab ) {
    return ( ‘on’ === opalestate_get_option( ‘enable_submission_tab_’ . $tab, true ) );
    }

    /**
    * Manually render a field column display.
    *
    * @param array $field_args Array of field arguments.
    * @param CMB2_Field $field The field object
    */
    public function amenities_html_callback( $field_args, $field ) {
    $id = $field->args( ‘id’ );
    $label = $field->args( ‘name’ );
    $name = $field->args( ‘_name’ );
    $value = $field->escaped_value();
    $description = $field->args( ‘description’ );

    $amenites = get_terms( [
    ‘taxonomy’ => ‘opalestate_amenities’,
    ‘orderby’ => ‘name’,
    ‘order’ => ‘ASC’,
    ‘hide_empty’ => false,
    ] );

    if ( ! $amenites ) {
    return;
    }
    ?>
    <div id=”opalestate-submission-amenities” class=”opalestate-tab-content”>
    <div class=”cmb-row cmb-type-taxonomy-multicheck cmb2-id-opalestate-ppt-amenity” data-fieldtype=”taxonomy_multicheck”>
    <div class=”cmb-th”>
    <label for=”<?php echo esc_attr( $name ); ?>”><?php echo esc_html( $label ); ?></label>
    </div>

    <div class=”cmb-td”>
    <ul class=”cmb2-checkbox-list list-inline cmb2-list”>
    <?php foreach ( $amenites as $key => $amenity ) : ?>

    • <input type=”checkbox” class=”cmb2-option” name=”<?php echo esc_attr( $name ); ?>[]” id=”opalestate_ppt_amenity<?php echo esc_attr( $key + 1 ); ?>”
      value=”<?php echo esc_attr( $amenity->slug ); ?>”>
      <label for=”opalestate_ppt_amenity<?php echo esc_attr( $key + 1 ); ?>”>
      <?php
      if ( $image_id = get_term_meta( $amenity->term_id, ‘opalestate_amt_image_id’, true ) ) {
      echo opalestate_get_image_by_id( $image_id );
      }
      ?>
      <?php echo esc_html( $amenity->name ); ?>
      </label>
    • <?php endforeach; ?>

      </div>
      </div>
      <button type=”button” class=”submission-back-btn btn btn-primary”><?php esc_html_e( ‘Back’, ‘opalestate-pro’ ); ?></button>
      <button type=”button” class=”submission-next-btn btn btn-primary”><?php esc_html_e( ‘Next’, ‘opalestate-pro’ ); ?></button>

      <?php
      }
      }

    Thread Starter mufc0123

    (@mufc0123)

    Having checked other parts of the form it seems to be only affecting the ‘uploader’ type and all other fields process. However, I’ve also noticed the other fields randomly process which is strange.

    Thread Starter mufc0123

    (@mufc0123)

    ..Also, happy to pay you for your time. ??

    Thread Starter mufc0123

    (@mufc0123)

    Hi Michael,

    Thanks for getting back to me so quick. There are no console errors showing on Google Chrome and I don’t have access to a MAC to be able to dig deeper.

    I have done testing on multiple devices with help from friends in different countries and all browsers are working, except Safari on Android and Safari on IOS.

    I have the form process or I can share the web address as it’s a live website if this helps? The original code was from a purchased theme but the developers have disappeared.

Viewing 8 replies - 1 through 8 (of 8 total)