Exemplo n.º 1
0
/**
 * Get the link for editing this Post
 * @param type $id
 * @param type $label
 * @return type 
 */
function buddyblog_get_edit_link($id = 0, $label = 'Edit')
{
    if (!buddyblog_get_option('allow_edit')) {
        return '';
    }
    $url = buddyblog_get_edit_url($id);
    if (!$url) {
        return '';
    }
    return "<a href='{$url}'>{$label}</a>";
}
Exemplo n.º 2
0
function buddyblog_fix_edit_post_link($edit_url, $post_id, $context)
{
    $post = get_post($post_id);
    if ($post->post_type != buddyblog_get_posttype() || is_super_admin()) {
        return $edit_url;
    }
    if ($post->post_author == get_current_user_id() && !current_user_can(buddyblog_get_option('dashboard_edit_cap'))) {
        return buddyblog_get_edit_url($post_id);
    }
    return $edit_url;
}