Skip to content

Instantly share code, notes, and snippets.

@pingram3541
Created April 4, 2016 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingram3541/f32f221413a4969e64ff19eef03f5f7e to your computer and use it in GitHub Desktop.
Save pingram3541/f32f221413a4969e64ff19eef03f5f7e to your computer and use it in GitHub Desktop.
wp dashboard notes - all admin access, not just by user id (lines 211-243, modified lines 15 and 18)
/**
* Initialize dashboard notes.
*
* Get all notes and initialize dashboard widgets.
*
* @since 1.0.0
*/
public function wpdn_init_dashboard_widget() {
$notes = $this->wpdn_get_notes();
foreach ( $notes as $note ) :
$note_meta = $this->wpdn_get_note_meta( $note->ID );
//$user = wp_get_current_user();
// Skip if private
if ( 'private' == $note_meta['visibility'] && current_user_can( 'manage_options' ) == 0 ) :
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( $this, 'wpdn_render_dashboard_widget' ),
'',
$note
);
endforeach;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment