Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter pavanjatt8

    (@pavanjatt8)

    and generally it should have validation for file , The problem when setup recaptcha at that time . it is not validate file field and form get submit.

    Thread Starter pavanjatt8

    (@pavanjatt8)

    file upload field in contact form 7 . so would you make it as condition check if it is required then upload field has been file selected or not when submit form . it should have validation message unlike text input field has validation message if it is empty when submit empty form form cannot able to submit and asks to fill the required filled same i wanted for file upload field if it is checked required

    Thread Starter pavanjatt8

    (@pavanjatt8)

    i’m using Redirection for Contact Form 7 by Qube One , MultiLine files upload for Contact Form 7 Pro by zluck solutions , Contact Form CFDB7 by arshid . and some more plugins . and theme is enfold . let me clearly explain you when i don’t associate recaptcha with the form . if file upload is being checked required then without recaptcha it is perfectly validate like other text and email fields and says for upload file and form is not being submit without upload or file select which is perfect this i needed . but when i’m integrated recaptcha then other fields are being validate and file field was required without file select when click on submit form gets submitted this is a problem i need help ,solution.

    Thread Starter pavanjatt8

    (@pavanjatt8)

    The country flag issue is resolved with the help of this jquery code.

    $(“#country option”).each(function(i, obj) {
    $(this).val($(this).html())
    });

    and credit goes to my friend rajesh chavda.

    Thread Starter pavanjatt8

    (@pavanjatt8)

    It is now not get removed country flag from member directory and profile page. but when i update country from account page’s extra tab and field the country are not get change or update and flag is not change on member directory and profile page could you help me in this . it will very appreciate in advance !!! Here is code

    class UM_Custom_Account_Tabs
    {
    
    	private $tabs = array();
    
    	function __construct()
    	{
    
    		if (!class_exists("UM")) return;
    
    		add_filter('um_account_page_default_tabs_hook', array($this, 'account_tabs'), 999);
    		add_action('template_redirect', array(UM()->form(), "form_init"));
    	}
    
    	/**
    	 *  Add tab
    	 */
    	public function add_tab($args)
    	{
    		$this->tabs[] = $args;
    
    		add_filter("um_account_content_hook_{$args['tab_id']}",  function () use ($args) {
    
    			$content = '';
    
    			if (isset($args["before_content"])) {
    				$content .= $args["before_content"];
    			}
    
    			if (isset($args['form_id'])) {
    				$content .= $this->render_form($args['form_id']);
    			}
    
    			if (isset($args['shortcode'])) {
    				$content .=  do_shortcode($args['shortcode']);
    			}
    
    			if (isset($args["after_content"])) {
    				$content .= $args["after_content"];
    			}
    
    			return $content;
    		}, 10, 2);
    	}
    
    	/** 
    	 * Register Tabs in Account form
    	 */
    	public function account_tabs($tabs)
    	{
    
    		foreach ($this->tabs as $tab) {
    			$tabs[$tab["position"]][$tab["tab_id"]] = array(
    				'icon'          => $tab["icon"],
    				'title'         => $tab["title"],
    				'submit_title'  => $tab["button_title"],
    				'custom'        => true,
    			);
    		}
    
    		return $tabs;
    	}
    
    	/**
    	 * Fix rendering Radio options
    	 */
    	public function fix_render_options($fields)
    	{
    
    		if (is_array($fields)) {
    			foreach ($fields as $key => $field) {
    				if (in_array($fields[$key]['type'], array("radio"))) {
    					add_filter("um_radio_field_options", function ($options) {
    						$options = array_combine(array_values($options), array_values($options));
    						return $options;
    					});
    				}
    			}
    		}
    		return $fields;
    
    		  $id = um_user('ID');
    		  $names = 'country';
    		
    		  foreach( $names as $name )
    		  update_user_meta( $id, $name, $_POST[$name] );
    
    	}
    
    	/** 
    	 * Render the form/shortcode
    	 */
    	public function render_form($form_id = null)
    	{
    
    		if (!$form_id) return;
    
    		ob_start();
    		$args["form_id"] = $form_id;
    		$args["mode"] = "profile";
    		$args["custom_fields"] = $this->fix_render_options(UM()->query()->get_attr('custom_fields', $form_id));
    		$args["core"] = "profile";
    		$args["user_id"] = get_current_user_id();
    
    		extract($args);
    
    		/**
    		 * UM hook
    		 *
    		 * @type action
    		 * @title um_main_{$mode}_fields
    		 * @description Some actions before login form fields
    		 * @input_vars
    		 * [{"var":"$args","type":"array","desc":"Login form shortcode arguments"}]
    		 * @change_log
    		 * ["Since: 2.0"]
    		 * @usage add_action( 'um_before_{$mode}_fields', 'function_name', 10, 1 );
    		 * @example
    		 * <?php
    		 * add_action( 'um_before_{$mode}_fields', 'my_before_fields', 10, 1 );
    		 * function my_before_form( $args ) {
    		 *     // your code here
    		 * }
    		 * ?>
    		 */
    		do_action("um_main_{$mode}_fields", $args);
    
    		echo "<input type='hidden' name='mode' value='{$mode}'/>";
    		echo "<input type='hidden' name='user_id' value='{$user_id}'/>";
    		echo "<input type='hidden' name='form_id' value='{$form_id}'/>";
    		echo "<input type='hidden' name='is_signup' value='true'/>";
    		echo "<input type='hidden' name='profile_nonce' id='profile_nonce' value='" . esc_attr(wp_create_nonce('um-profile-nonce' . $args["user_id"])) . "' />";
    
    		$template = ob_get_contents();
    		ob_end_clean();
    
    		return $template;
    	}
    }
    
    // Initiate the Class 
    $messagetab = new UM_Custom_Account_Tabs();
    
    // Then use the method <code>add_tab</code> to register your tab with your details
    $messagetab->add_tab(array(
    	"tab_id" => "myaccounttab",
    	"title" => "Account",
    	"button_title" => "Save",
    	"icon" => "um-faicon-user",
    	"position" => 100, // first tab in the Account form
    	"form_id" => 587,
    	"before_content" => "",
    	"after_content" => "",
    	"shortcode" => "",
    
    ));
Viewing 5 replies - 1 through 5 (of 5 total)