Support

Account

Forum Replies Created

  • aargh!! my bad 🙁

    these message fields are stored in an group field…

    sorry for claiming your time, John.

  • i digged some more into it: the $gk_messages array from my code example above contains this at the time of editing the custom post type

    [05-May-2019 11:32:59 UTC] write_log debug - context: test
    [05-May-2019 11:32:59 UTC] Array
    (
        [post] => Array
            (
                [0] => 
                [1] => Beitrag aktualisiert. <a href="https://dev.TLD.de/ww/test/">Anschauen</a>
                [2] => Benutzerdefiniertes Feld aktualisiert.
                [3] => Benutzerdefiniertes Feld gelöscht.
                [4] => Beitrag aktualisiert.
                [5] => 
                [6] => Post published. <a href="https://dev.TLD.de/ww/test/">View post</a>
                [7] => Beitrag gespeichert.
                [8] => Post submitted. <a target="_blank" href="https://dev.TLD.de/ww/test/?preview=true">Preview post</a>
                [9] => Post scheduled for: <strong>Apr 29, 2019 @ 14:18</strong>. <a target="_blank" href="https://dev.TLD.de/ww/test/">Preview post</a>
                [10] => Post draft updated. <a target="_blank" href="https://dev.TLD.de/ww/test/?preview=true">Preview post</a>
            )
    
        [ww] => Array
            (
                [0] => 
                [1] => 
                [2] => 
                [3] => 
                [4] => 
                [5] => 
                [6] => 
                [7] => 
                [8] => 
                [9] =>  <strong>Apr 29, 2019 @ 14:18</strong>.
                [10] => 
            )
    ...

    it looks like that get_field values are empty and so the array values are empty, too.

  • hi John, thanks for you support!

    these are the option page setting I use:

    if( function_exists('acf_add_options_page') ) {
    	acf_add_options_page(array(
    		'page_title' 	=> 'MySettings',
    		'menu_title'	=> 'MySettings',
    		'menu_slug' 	=> 'my-settings'
    	));
    }
  • addendum: this code is placed in a plugin.

  • I used stuff like this:

    add_filter( 'post_updated_messages', 'gk_post_update_messages', 10, 1 );
    function gk_post_update_messages( $messages ) {
    	if( !current_user_can( 'manage_options' ) ) {
    		$gk_messages = array();
    		...
    		$gk_messages['ww'] = array (
    		     0 => '', // Unused. Messages start at index 1.
    			 1 => sanitize_text_field( get_field('pref_note_ww_1', 'option') ),
    		     2 => sanitize_text_field( get_field('pref_note_ww_2', 'option') ),
    		     3 => sanitize_text_field( get_field('pref_note_ww_3', 'option') ),
    		     4 => sanitize_text_field( get_field('pref_note_ww_4', 'option') ),
    		     5 => isset($_GET['revision']) ? sprintf( sanitize_text_field( get_field('pref_note_ww_5', 'option') ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    		     6 => sanitize_text_field( get_field('pref_note_ww_6', 'option') ),
    		     7 => sanitize_text_field( get_field('pref_note_ww_7', 'option') ),
    		     8 => sanitize_text_field( get_field('pref_note_ww_8', 'option') ),
    		     9 => sprintf( __( sanitize_text_field( get_field('pref_note_ww_9', 'option') ) . ' <strong>%1$s</strong>.'),
    		        date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
    		     10 => sanitize_text_field( get_field('pref_note_ww_10', 'option') )
    		);
    		...
    	} else {
    		return $messages;
    	}
    }
Viewing 5 posts - 1 through 5 (of 5 total)