[wp-hackers] Universal Edit Button

Alan J Castonguay alan at verselogic.net
Fri Jun 20 00:09:49 GMT 2008


Took longer to convince TextMate to talk to the remote network share  
that WP live on, than it did to type

<?php
/*
Plugin Name: Universal Edit Button
Plugin URI: http://universaleditbutton.org/
Description: The Universal Edit Button is currently a green pencil  
icon in the URL bar that indicates a web page is editable.
Version: 1.0
Author: Alan J Castonguay
Author URI: http://verselogic.net/
*/

function ueb_add_head_link() {
         global $post;
         switch ($post->post_type) {
                 case 'attachment':
                         return;
                 case 'page':
                         if( !current_user_can( 'edit_page', $post- 
 >ID ) ) return;
                         break;
                 case 'post':
                 default:
                         if ( !current_user_can( 'edit_post', $post- 
 >ID ) ) return;
                         break;
         }

         echo '<link rel="alternate" type="application/x-wiki"  
title="Edit this page" href="' . get_edit_post_link($post->ID) . "\" / 
 >\n";
}

add_action( 'wp_head', 'ueb_add_head_link' );
?>

Would have used edit_post_link() directly, except for the "<a"  
sitting in it's output. str_replace, or the above.


On 19-Jun-08, at 7:31 PM, Viper007Bond wrote:

> Yeah, that's about a 30 second plugin, heh.
>
> On Thu, Jun 19, 2008 at 4:22 PM, Otto <otto at ottodestruct.com> wrote:
>
>> Looks like it would be fairly easy to add as a plugin anyway.
>>
>> See http://universaleditbutton.org/Add_The_Link
>>
>>
>> On Thu, Jun 19, 2008 at 6:03 PM, Stephane Daury  
>> <wordpress at tekartist.org>
>> wrote:
>>>
>>> See http://universaleditbutton.org/Universal_Edit_Button
>>>
>>> They list a WP plugin as being "in the hopper". :)
>>>
>>>
>>> ---
>>> Stephane Daury - http://tekartist.org/
>>>
>>>
>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> -- 
> Viper007Bond | http://www.viper007bond.com/ | http:// 
> www.finalgear.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list