Support

Account

Forum Replies Created

  • Thank you, this is what I needed:

    
    add_filter('tiny_mce_before_init', 'wpse3882_tiny_mce_before_init');
    function wpse3882_tiny_mce_before_init($settings) {
        $settings['theme_advanced_blockformats'] = 'p,h1,h2';
        return $settings;
    }
    
  • I belive the attached images explains it

  • formatselect is the pull down list in the editor with h1,h2,h3 ..

  • In my add on, date and time picker field, date and time is stored as a timestamp.

    When a user open a post to edit the date and time field, I use format_value() to convert the timestamp to the format the user set when he created the field.

    What should I use to convert the timestamp to the correct format in revisions ?

    edit: @elliot ?

  • @elliot, @tomasjindrich. I’ve removed “value” from defaults in the latest release (2.0.10)

  • @flahertydaf Thank you!! This has been giving me a headache and you found the fix 🙂

    @eliot, you should remove “// Note: This function can be removed if not used” from {{field_name}}-v4.php

  • Updated to 4.1.8.1, but can’t see any difference

  • save_post() works fine in 4.1.8, and doesn’t create any errors. Here’s XDebug Context for ACF 4.1.8 , breakpoint at $f = apply_filters('acf/load_field', false, $k ); in acf.php:save_post( $post_id )

    Inside the loop, 1st iteration (single date and time picker field):

    
    $f = array[18]
    	$f['name'] = (string) dato
    	$f['class'] = (string) date_time_picker
    	$f['time_format'] = (string) H:mm
    	$f['field_group'] = (int) 6583
    	$f['conditional_logic'] = array[3]
    		$f['conditional_logic']['allorany'] = (string) all
    		$f['conditional_logic']['rules'] = array[1]
    			$f['conditional_logic']['rules'][0] = array[2]
    				$f['conditional_logic']['rules'][0]['operator'] = (string) ==
    				$f['conditional_logic']['rules'][0]['field'] = (string) null
    		$f['conditional_logic']['status'] = (int) 0
    	$f['show_week_number'] = (string) false
    	$f['value'] = <string>
    	$f['required'] = (int) 0
    	$f['type'] = (string) date_time_picker
    	$f['id'] = (string) acf-field-dato
    	$f['key'] = (string) field_51d520b7091da
    	$f['label'] = (string) dato
    	$f['picker'] = (string) slider
    	$f['show_date'] = (string) true
    	$f['order_no'] = (int) 0
    	$f['instructions'] = <string>
    	$f['save_as_timestamp'] = (string) true
    	$f['date_format'] = (string) m/d/y
    $v = (string) 7/11/13 7:00
    $post_id = (int) 6640
    $k = (string) field_51d520b7091da
    $this = Acf[1]
    	$this->settings = array[5]
    		$this->settings['path'] = (string) /Users/per/Sites/dev.local/wp-content/plugins/advanced-custom-fields/
    		$this->settings['dir'] = (string) http://dev.local/wp-content/plugins/advanced-custom-fields/
    		$this->settings['upgrade_version'] = (string) 3.4.1
    		$this->settings['hook'] = (string) advanced-custom-fields/acf.php
    		$this->settings['version'] = (string) 4.1.8
    

    Second iteration, date and timepicker field inside a repeater field

    
    $f = array[16]
    	$f['name'] = (string) repeat
    	$f['class'] = (string) repeater
    	$f['field_group'] = (int) 6583
    	$f['conditional_logic'] = array[3]
    		$f['conditional_logic']['allorany'] = (string) all
    		$f['conditional_logic']['rules'] = array[1]
    			$f['conditional_logic']['rules'][0] = array[3]
    				$f['conditional_logic']['rules'][0]['operator'] = (string) ==
    				$f['conditional_logic']['rules'][0]['field'] = (string) null
    				$f['conditional_logic']['rules'][0]['value'] = <string>
    		$f['conditional_logic']['status'] = (int) 0
    	$f['layout'] = (string) table
    	$f['row_min'] = (int) 0
    	$f['button_label'] = (string) Add Row
    	$f['sub_fields'] = array[1]
    		$f['sub_fields'][0] = array[18]
    			$f['sub_fields'][0]['label'] = (string) dato2
    			$f['sub_fields'][0]['name'] = (string) dato2
    			$f['sub_fields'][0]['value'] = <string>
    			$f['sub_fields'][0]['key'] = (string) field_51da7b24dbf9a
    			$f['sub_fields'][0]['instructions'] = <string>
    			$f['sub_fields'][0]['save_as_timestamp'] = (string) true
    			$f['sub_fields'][0]['column_width'] = <string>
    			$f['sub_fields'][0]['order_no'] = (int) 0
    			$f['sub_fields'][0]['id'] = (string) acf-field-dato2
    			$f['sub_fields'][0]['picker'] = (string) slider
    			$f['sub_fields'][0]['class'] = (string) date_time_picker
    			$f['sub_fields'][0]['time_format'] = (string) h:mm tt
    			$f['sub_fields'][0]['type'] = (string) date_time_picker
    			$f['sub_fields'][0]['show_week_number'] = (string) false
    			$f['sub_fields'][0]['show_date'] = (string) true
    			$f['sub_fields'][0]['required'] = (int) 0
    			$f['sub_fields'][0]['date_format'] = (string) m/d/y
    			$f['sub_fields'][0]['conditional_logic'] = array[3]
    				$f['sub_fields'][0]['conditional_logic']['status'] = (int) 0
    				$f['sub_fields'][0]['conditional_logic']['rules'] = (int) 0
    				$f['sub_fields'][0]['conditional_logic']['allorany'] = (string) all
    	$f['required'] = (int) 0
    	$f['type'] = (string) repeater
    	$f['id'] = (string) acf-field-repeat
    	$f['key'] = (string) field_51da7b12dbf99
    	$f['label'] = (string) repeat
    	$f['order_no'] = (int) 1
    	$f['instructions'] = <string>
    	$f['row_limit'] = <string>
    $v = array[2]
    	$v['acfcloneindex'] = array[1]
    		$v['acfcloneindex']['field_51da7b24dbf9a'] = <string>
    	$v[1373458984969] = array[1]
    		$v[1373458984969]['field_51da7b24dbf9a'] = (string) 7/12/13 12:00 am
    $post_id = (int) 6640
    $k = (string) field_51da7b12dbf99
    $this = Acf[1]
    	$this->settings = array[5]
    		$this->settings['path'] = (string) /Users/per/Sites/dev.local/wp-content/plugins/advanced-custom-fields/
    		$this->settings['dir'] = (string) http://dev.local/wp-content/plugins/advanced-custom-fields/
    		$this->settings['upgrade_version'] = (string) 3.4.1
    		$this->settings['hook'] = (string) advanced-custom-fields/acf.php
    		$this->settings['version'] = (string) 4.1.8
    
    

    But I guess this is not really the issue. As said previously, the content exist in post meta but it’s not displayed/populated to the custom field.

    When I open a post, where (in ACF) is data read from post meta (ie, where should I set my breakpoints)?

  • Ignore my previous question, I can confirm that Date and Time Picker field works fine in ACF v4.1.4

    Thank you dominic 🙂

  • I believe I have the latest. acf.php:save_post() looks like this:

    	function save_post( $post_id )
    	{
    
    		// load from post
    		if( !isset($_POST['fields']) )
    		{
    			return false;
    		}
    		
    
    		// loop through and save
    		if( !empty($_POST['fields']) )
    		{
    			// loop through and save $_POST data
    			foreach( $_POST['fields'] as $k => $v )
    			{
    				// get field
    				$f = apply_filters('acf/load_field', false, $k );
    				
    				// update field
    				do_action('acf/update_value', $v, $post_id, $f );
    				
    			}
    			// foreach($fields as $key => $value)
    		}
    		// if($fields)
    		
    		
    		return true;
    	}
    
  • Updated to 4.1.8, but still no luck (debug is on and doesn’t report any errors)

    I installed Debug Objects, and for ‘Post Type & Meta’, when I’m opening a post in edit mode, it shows:

    
    Post ID: 6632
    Meta Keys: 8
    Key				Value
    _edit_last
    1 value	
    				array (
    				  0 => '1',
    				)
    _edit_lock
    1 value	
    				array (
    				  0 => '1373360374:1',
    				)
    dato
    1 value	
    				array (
    				  0 => '1373500800',
    				)
    _dato
    1 value	
    				array (
    				  0 => 'field_51d520b7091da',
    				)
    repeat
    1 value	
    				array (
    				  0 => '1',
    				)
    _repeat
    1 value	
    				array (
    				  0 => 'field_51da7b12dbf99',
    				)
    repeat_0_dato2
    1 value	
    				array (
    				  0 => '1373414400',
    				)
    _repeat_0_dato2
    1 value	
    				array (
    				  0 => 'field_51da7b24dbf9a',
    				)
    

    value for ‘dato’ isn’t displayed in the custom field, but value for ‘repeat_0_dato2’ is displayed

  • Been xdebugging, and maybe this helps. core/fields/_functions.php:load_field( $field, $field_key, $post_id = false ) returns:

    $f = array[18]
    	$f['name'] = (string) dato
    	$f['class'] = (string) date_time_picker
    	$f['time_format'] = (string) H:mm
    	$f['field_group'] = (int) 6583
    	$f['conditional_logic'] = array[3]
    		$f['conditional_logic']['allorany'] = (string) all
    		$f['conditional_logic']['rules'] = array[1]
    			$f['conditional_logic']['rules'][0] = array[2]
    				$f['conditional_logic']['rules'][0]['operator'] = (string) ==
    				$f['conditional_logic']['rules'][0]['field'] = (string) null
    		$f['conditional_logic']['status'] = (int) 0
    	$f['show_week_number'] = (string) false
    	$f['value'] = <string>
    	$f['required'] = (int) 0
    	$f['type'] = (string) date_time_picker
    	$f['id'] = (string) acf-field-dato
    	$f['key'] = (string) field_51d520b7091da
    	$f['label'] = (string) dato
    	$f['picker'] = (string) slider
    	$f['show_date'] = (string) true
    	$f['order_no'] = (int) 0
    	$f['instructions'] = <string>
    	$f['save_as_timestamp'] = (string) true
    	$f['date_format'] = (string) m/d/y

    As you can see, the $f[‘value’] is empty

  • I believe this is the same problem as the one I reported in the old support forum.

    As i mentioned, when I publish the post

    A) update_value() receives the value,

    B) data is stored in “prefix”_postmeta table:

    select * from dev_postmeta where meta_key = 'dato' ORDER BY meta_id DESC LIMIT 1;

    returns the correct value in meta_value (‘dato’ is the field name)

    select * from dev_postmeta where meta_key = '_dato' ORDER BY meta_id DESC LIMIT 1;

    returns the correct field_”number” in meta_value

    C) create_field() creates an empty field on reload after the publish post

Viewing 15 posts - 1 through 15 (of 15 total)