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
This commit is contained in:
saxmatt 2003-12-30 10:48:06 +00:00
parent b88f340791
commit 3bcdffad13
2 changed files with 24 additions and 7 deletions

View File

@ -38,7 +38,7 @@ require_once('wp-blog-header.php');
<div class="post">
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
<div class="meta">Filed under: <?php the_category() ?> &#8212; <?php the_author() ?> @ <?php the_time() ?></div>
<div class="meta">Filed under: <?php the_category() ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div>
<div class="storycontent">
<?php the_content(); ?>

View File

@ -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 <a href='$location'>$link</a> $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 *****/
?>
?>