Beispiel #1
0
function snippet_adminmenu()
{
    if (function_exists('current_user_can')) {
        if (current_user_can('manage_options')) {
            $snippet_is_admin = true;
        }
    } else {
        global $user_ID;
        if (user_can_edit_user($user_ID, 0)) {
            $snippet_is_admin = true;
        }
    }
    if (function_exists('add_options_page') && $snippet_is_admin) {
        add_options_page(__("SEO Rich Snippets", 'the_seo_rich_snippets'), __("SEO Rich Snippets", 'the_seo_rich_snippets'), 9, 'snippets_options', 'snippets_options');
    }
}
Beispiel #2
0
function bb2_admin_pages()
{
    if (function_exists('current_user_can')) {
        // The new 2.x way
        if (current_user_can('manage_options')) {
            $bb2_is_admin = true;
        }
    } else {
        // The old 1.x way
        global $user_ID;
        if (user_can_edit_user($user_ID, 0)) {
            $bb2_is_admin = true;
        }
    }
    if ($bb2_is_admin) {
        add_options_page(__("Bad Behavior"), __("Bad Behavior"), 8, 'bb2_options', 'bb2_options');
    }
}
	case 'control_view':
		?>
		<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
		<?php
		break;

	case 'control_edit':
		?>
		<td><?php if ( user_can_edit_user($user_ID,$authordata->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
		<?php
		break;

	case 'control_delete':
		?>
		<td><?php if ( user_can_edit_user($user_ID,$authordata->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "')\">" . __('Delete') . "</a>"; } ?></td>
		<?php
		break;

	default:
		?>
		<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
		<?php
		break;
	}
}
?>
	</tr> 
<?php
}
} else {
 $content = apply_filters('content_save_pre', $_POST['content']);
 $excerpt = apply_filters('excerpt_save_pre', $_POST['excerpt']);
 $post_title = $_POST['post_title'];
 $prev_status = $_POST['prev_status'];
 $post_status = $_POST['post_status'];
 $menu_order = (int) $_POST['menu_order'];
 if (!empty($_POST['post_author_override'])) {
     $post_author = (int) $_POST['post_author_override'];
 } else {
     if (!empty($_POST['post_author'])) {
         $post_author = (int) $_POST['post_author'];
     } else {
         $post_author = (int) $_POST['user_ID'];
     }
 }
 if (!user_can_edit_user($user_ID, $post_author)) {
     die(__('You cannot post as this user.'));
 }
 $comment_status = $_POST['comment_status'];
 if (empty($comment_status)) {
     $comment_status = 'closed';
 }
 //if (!$_POST['comment_status']) $comment_status = get_settings('default_comment_status');
 $ping_status = $_POST['ping_status'];
 if (empty($ping_status)) {
     $ping_status = 'closed';
 }
 //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status');
 $post_password = $_POST['post_password'];
 $post_name = $_POST['post_name'];
 $post_parent = 0;