Need some help modifying code snip-it

I need this snip changed to where "EACH" user can only publish one "PAGE" and be able to edit that page.

Don't want others to be able to edit it, only the user, and admin/network admin.

If it has to be done by post and not page, then so be it!

I have tried many plugin for this,to no evial.

Just want to put it in a theme and have a cheesy grin on my face when it works.

Got some point for a working snip-it

How you been @maxaud, :slight_smile:

<?php
/**
* New Post Administration Panel.
*
* @package WordPress
* @subpackage Administration
*/

/** Load WordPress Administration Bootstrap */
require_once('admin.php');
$title = __('Add New Post');
$parent_file = 'edit.php';
$editing = true;
wp_enqueue_script('autosave');
wp_enqueue_script('post');
if ( user_can_richedit() )
wp_enqueue_script('editor');
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

if ( ! current_user_can('edit_posts') ) {
require_once ('./admin-header.php'); ?>
<div class="wrap">
<p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to add the edit_posts capability to your user, in order to be authorized to post.
You can also e-mail the admin to ask for a promotion.
When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_option('admin_email')); ?>
</p>
</div>
<?php
include('admin-footer.php');
exit();
}
//limit the quantity to N posts
$N = 20; max 20 posts por usuario
$count_posts = count(get_posts(array('author'=>$user_ID)));// returns the quantity of written posts by current user to $user_ID
if ($count_posts >= N){
Header("Location: index.php");//redirects to dashboard, where it should point the user that he cannot create a new post
}
//end of modification

// Show post form.
$post = get_default_post_to_edit();
include('edit-form-advanced.php');

include('admin-footer.php');
?>

Thank You!