From 3bcdffad13d4b77ab23056500e1104ec28cf186d Mon Sep 17 00:00:00 2001 From: saxmatt Date: Tue, 30 Dec 2003 10:48:06 +0000 Subject: [PATCH] edit_this_post() from Ryan Boren. Cleaned up function and integrated into default template. git-svn-id: http://svn.automattic.com/wordpress/trunk@665 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- index.php | 2 +- wp-includes/template-functions.php | 29 +++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index fba96f3b1..080e9552e 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ require_once('wp-blog-header.php');

-
Filed under: @
+
Filed under: @
diff --git a/wp-includes/template-functions.php b/wp-includes/template-functions.php index 30d0b8dc7..1bec9fe4e 100644 --- a/wp-includes/template-functions.php +++ b/wp-includes/template-functions.php @@ -541,6 +541,24 @@ function get_day_link($year, $month, $day) { } } +function edit_post_link($link = 'Edit This', $before = '', $after = '') { + global $user_level, $post, $siteurl; + + get_currentuserinfo(); + + if ($user_level > 0) { + $authordata = get_userdata($post->post_author); + if ($user_level < $authordata->user_level) { + return; + } + } else { + return; + } + + $location = "$siteurl/wp-admin/post.php?action=edit&post=$post->ID"; + echo "$before $link $after"; +} + /***** Date/Time tags *****/ function the_date_xml() { @@ -550,10 +568,9 @@ function the_date_xml() { } function the_date($d='', $before='', $after='', $echo = true) { - global $id, $post, $dateday, $previousday, $dateformat, $newday; + global $id, $post, $day, $previousday, $dateformat, $newday; $the_date = ''; - $dateday = mysql2date('Yd', $post->post_date); - if ($dateday != $previousday) { + if ($day != $previousday) { $the_date .= $before; if ($d=='') { $the_date .= mysql2date($dateformat, $post->post_date); @@ -561,7 +578,7 @@ function the_date($d='', $before='', $after='', $echo = true) { $the_date .= mysql2date($d, $post->post_date); } $the_date .= $after; - $previousday = $dateday; + $previousday = $day; } $the_date = apply_filters('the_date', $the_date); if ($echo) { @@ -1688,10 +1705,10 @@ function comment_text() { $comment_text = convert_chars($comment_text); $comment_text = convert_bbcode($comment_text); $comment_text = convert_gmcode($comment_text); + $comment_text = convert_smilies($comment_text); $comment_text = make_clickable($comment_text); $comment_text = balanceTags($comment_text,1); $comment_text = apply_filters('comment_text', $comment_text); - $comment_text = convert_smilies($comment_text); echo $comment_text; } @@ -1837,4 +1854,4 @@ function permalink_single_rss($file = '') { /***** // Permalink tags *****/ -?> \ No newline at end of file +?>