Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeroen Sormani

    (@sormano)

    Hi Gatera,

    By default this is possible by toggling the ‘visibility’ icon to ‘me’ so only you view that note. I think that is not what you’re looking for though (since its a user needed action).

    Therefore I’ve just created this custom code, this should only display the notes created by the user, for everyone…

    global $wp_dashboard_notes;
    remove_action( 'wp_dashboard_setup', array( $wp_dashboard_notes, 'wpdn_init_dashboard_widget' ) );
    add_action( 'wp_dashboard_setup', 'custom_wpdn_init_dashboard_widget' );
    function custom_wpdn_init_dashboard_widget() {
    
    	global $wp_dashboard_notes;
    	$notes = $wp_dashboard_notes->wpdn_get_notes();
    
    	foreach ( $notes as $note ) :
    
    		$note_meta 	= $wp_dashboard_notes->wpdn_get_note_meta( $note->ID );
    		$user 		= wp_get_current_user();
    
    		// Skip if private
    		if ( $user->ID != $note->post_author ) :
    			continue;
    		endif;
    
    		// Add widget
    		wp_add_dashboard_widget(
    			'note_' . $note->ID,
    			'<span contenteditable="true" class="wpdn-title">' . $note->post_title . '</span><div class="wpdn-edit-title dashicons dashicons-edit"></div><span class="status"></span>',
    			array( $wp_dashboard_notes, 'wpdn_render_dashboard_widget' ),
    			'',
    			$note
    		);
    
    	endforeach;
    
    }

    Copy paste this to your themes functions.php

    Its tested, but not that extensive.

    Let me know if that works out for you.

    Thanks,
    Jeroen

    Thread Starter Gatera

    (@gatera)

    Hi Jeroen,

    Thank you for the quick reply and the custom code! It works great!

    Regards,

    Vital

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

The topic ‘View own notes only’ is closed to new replies.