Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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