prefix . "authordiscuss";
$msg_limit = get_option( 'author_discussion_dashboard_limit' );
$messages = "SELECT * FROM $table_name ORDER BY id DESC LIMIT $msg_limit";
$messages = $wpdb->get_results($messages);
foreach($messages as $row){
//get author info here
$auth_name = get_userdata($row->userid);
$auth_name = $auth_name->display_name;
$id = $row->id . '_cont';
$time = strtotime($row->time);
$time = date('M j, Y g:i A', $time);
$message = stripslashes($row->text);
$message = apply_filters('the_content', $message);
echo '
' .
'
' . $auth_name . ' (' . $time . ') ' .
'#
' .
$message .
'
';
}
}
// Create Dashboard Widget Using Hook
function auth_discuss_add_dashboard_widgets() {
auth_discuss_query(1);
$authdiscuss_cap = get_option('author_discussion_capability');
if(current_user_can ( $authdiscuss_cap ) ){
wp_add_dashboard_widget(
'auth_discuss_dashboard_widget', // Widget slug.
'Author Discussion', // Title.
'auth_discuss_dashboard_widget_function' // Display function.
);
}
}
add_action( 'wp_dashboard_setup', 'auth_discuss_add_dashboard_widgets' );
// Build Quick Message Form
function auth_discuss_quick_form() {
echo '';
echo '
';
}
// Create Dashboard Widget Content
function auth_discuss_dashboard_widget_function() {
// Display latest messages
echo '';
auth_discuss_widget_posts();
echo '';
echo '
ShowQuick Message
';
auth_discuss_quick_form();
echo '
';
}