Skip to content

Instantly share code, notes, and snippets.

@scarstens
Created August 2, 2012 17:40
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 scarstens/3238999 to your computer and use it in GitHub Desktop.
Save scarstens/3238999 to your computer and use it in GitHub Desktop.
Download Monitor Plugin Extension - Inline Edit Button
//name: dlmEdit
//description: adds edit link for downloads
//format: [dlmEdit id=""]
//required parameters: id
add_shortcode('dlm_edit_link', 'dlm_edit_link');
function dlm_edit_link($atts, $content = null) {
extract(shortcode_atts(array(
"id" => '',
), $atts));
if ( current_user_can('user_can_edit_downloads') )
$output = '<a href="http://'.$_SERVER['HTTP_HOST'].'/wp-admin/admin.php?page=download-monitor/wp-download_monitor.php&action=edit&id='.$id.'&sort=title&p=1" class="dlmEdit">[edit]</a>';
else
$output = '';
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment