Changeset 347478
- Timestamp:
- 02/18/2011 07:58:28 PM (15 years ago)
- Location:
- wp-post-limiter
- Files:
-
- 4 added
- 2 edited
-
tags/1.0 (added)
-
tags/1.0/readme.txt (added)
-
tags/1.0/screenshot-1.png (added)
-
tags/1.0/wp-post-limiter.php (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wp-post-limiter.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-post-limiter/trunk/readme.txt
r225257 r347478 3 3 Donate link: http://saquery.com/wordpress 4 4 Tags: Limit Posts, Maximum Posts, Restrict Posts 5 Requires at least: 2.0.26 Tested up to: 2.7.17 Stable tag: 0.25 Requires at least: 3.0.5 6 Tested up to: 3.0.5 7 Stable tag: 1.0 8 8 9 9 Restrict the number of possible posts for a Wordpress user. -
wp-post-limiter/trunk/wp-post-limiter.php
r225257 r347478 4 4 Plugin URI: http://saquery.com/wordpress 5 5 Description: WP Post Limiter 6 Version: 0.26 Version: 1.0 7 7 Author: Stephan Ahlf 8 8 Author URI: http://saquery.com … … 10 10 11 11 /* 12 Copyright 2009 Stephan Ahlf12 Copyright 2009-2011 Stephan Ahlf 13 13 14 14 This program is free software; you can redistribute it and/or modify … … 39 39 function saqPostLimitOptions(){ 40 40 global $saq_postlimit_options; 41 if( $_POST['saq_save']){41 if(isset($_POST['saq_save'])){ 42 42 $default_limit = (int)$_POST['default_limit']; 43 43 $saq_postlimit_options["default_limit"] = $default_limit; … … 60 60 function saqGetPostCountInfo(){ 61 61 global $wpdb; 62 return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_ author = ".wp_get_current_user()->ID);62 return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status='publish' and post_author = ".wp_get_current_user()->ID); 63 63 } 64 64 65 65 function saqPostLimiter_admin_menu(){ 66 66 global $menu, $submenu,$saq_postlimit_options; 67 68 add_submenu_page('options-general.php', 'Post Limiter', 'Post Limiter', 8, __FILE__, 'saqPostLimitOptions');67 68 add_submenu_page('options-general.php', 'Post Limiter', 'Post Limiter', 'administrator', __FILE__, 'saqPostLimitOptions' ); 69 69 if (wp_get_current_user()->ID!=1) { 70 70 $numposts = saqGetPostCountInfo(); 71 71 foreach ($menu as $index => $item) { 72 72 if ($item[2] == 'index.php' ){ 73 unset($menu[$index]);73 //unset($menu[$index]); 74 74 if (saqPostLimiter_isPage('index')) { 75 75 wp_redirect(get_option('siteurl') . '/wp-admin/profile.php'); … … 99 99 $curr = strtolower($_SERVER["REQUEST_URI"]); 100 100 if ($curr == '/wp-admin/') $curr.="index.php"; 101 return $curr=='/wp-admin/'.$p.'.php';101 return basename($curr)==$p.'.php'; 102 102 } 103 103 … … 106 106 if (wp_get_current_user()->ID!=1) { 107 107 if (saqPostLimiter_isPage('post-new')) { 108 108 109 $postCount=saqGetPostCountInfo(); 109 110 if ($postCount>=$saq_postlimit_options["default_limit"]){ 110 print '<p>Permission denied. Your account is limited to '.$saq_postlimit_options["default_limit"].' posts. Your personal Postcount: '.$postCount.'. <a href=" /wp-admin/profile.php">Back...</a></p>';111 print '<p>Permission denied. Your account is limited to '.$saq_postlimit_options["default_limit"].' posts. Your personal Postcount: '.$postCount.'. <a href="javascript_void(0);" onclick="history.back()">Back...</a></p>'; 111 112 exit; 112 113 }
Note: See TracChangeset
for help on using the changeset viewer.