Invalid Number of Days";
else{
update_option('webous_modify_days',$_POST['modify_days']);
$msg[] = "Number of Days Updated";
}
}
?>
roles, get_settings("webous_allowed_users") ) ) == 0 )
die("Sorry, you are not allowed to delete posts.");
return;
}
//-------------------------------------------------------------------------------
function prevent_authors_edit()
{
if ( ($_REQUEST['action'] != "edit") && ($_REQUEST['action'] != "editpost") )
return; //we are interested only in edit/editpost interfaces
global $current_user;
if ( count (array_intersect ( $current_user->roles, get_settings("webous_allowed_users") ) ) > 0 )
return; //user is allowed to edit his posts anytime
$post = get_post_to_edit(intval($_GET['post']));
if (!$post->ID)
$post = get_post_to_edit(intval($_POST['post_ID'])); //posted
if (!$post->ID)
return; //wrong post ID
if (strtotime($post->post_date) + 86400 * get_settings("webous_modify_days") > time())
return; //post is not that old
die("");
}
//-------------------------------------------------------------------------------
//we'll add default options
add_option ('webous_allowed_users',array('administrator'));
add_option ('webous_modify_days',"7");
//load wp_roles
global $wp_roles;
if ( ! isset($wp_roles) )
$wp_roles = new WP_Roles();
add_action('admin_menu', 'prevent_authors_add_pages');
add_action('delete_post', "prevent_authors_delete");
add_action('admin_menu', "prevent_authors_edit"); //web-interface check
?>