Changeset 232361
- Timestamp:
- 04/23/2010 02:40:50 PM (16 years ago)
- Location:
- limit-blogs-per-user
- Files:
-
- 3 added
- 2 edited
-
tags/1.3 (added)
-
tags/1.3/limit-bogs-per-user.php (added)
-
tags/1.3/readme.txt (added)
-
trunk/limit-bogs-per-user.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
limit-blogs-per-user/trunk/limit-bogs-per-user.php
r211626 r232361 5 5 Plugin URI:http://buddydev.com/buddypress/limit-blogs-per-user-plugin-for-wpmu 6 6 Author URI:http://buddydev.com/members/sbrajesh 7 Version:1. 28 Last Updated: 2 8th feb20107 Version:1.3 8 Last Updated: 23rd April 2010 9 9 License: GPL 10 10 */ … … 36 36 } 37 37 /** 38 * @desc Find the non subscriber/non author/non editor blogs for the user38 * @desc Find the blogs of which user is admin 39 39 * It return the total number of blogs for which the user is admin 40 40 * @param <array> $blogs … … 49 49 $count=0; 50 50 foreach($blogs as $blog){ 51 $user_level=get_usermeta($user_id, "wp_".$blog->userblog_id."_user_level"); 52 if($user_level>=9) 53 $count++; 51 if(bpdev_is_user_blog_admin($user_id,$blog->userblog_id)) 52 $count++; 54 53 55 54 } … … 95 94 96 95 } 96 //check if the user is blog admin 97 function bpdev_is_user_blog_admin($user_id,$blog_id){ 98 global $wpdb; 99 $meta_key="wp_".$blog_id."_capabilities";//.."_user_level"; 100 $role_sql="select user_id,meta_value from {$wpdb->usermeta} where meta_key='". $meta_key."'"; 101 $role=$wpdb->get_results($wpdb->prepare($role_sql),ARRAY_A); 102 //clean the role 103 $all_user=array_map("bpdev_serialize_roles",$role);//we are unserializing the role to make that as an array 104 105 foreach($all_user as $key=>$user_info) 106 if($user_info['meta_value']['administrator']==1&&$user_info['user_id']==$user_id)//if the role is admin 107 return true; 108 return false; 109 } 110 111 function bpdev_serialize_roles($roles){ 112 $roles['meta_value']=maybe_unserialize($roles['meta_value']); 113 return $roles; 114 } 97 115 ?> -
limit-blogs-per-user/trunk/readme.txt
r211653 r232361 3 3 Tags: buddypress,wpmu, options,limit blogs,user,limit 4 4 Requires at least: 2.5+ 5 Tested up to: 2.9. 1.16 Stable tag: 1. 25 Tested up to: 2.9.2 6 Stable tag: 1.3 7 7 8 8 This plugin is for wpmu(wordpress Mu) and/or wpmu+buddypress based social network.It limits the number of blogs a user can create. … … 42 42 43 43 == Changelog == 44 = Version 1.3 = 45 *Fixed a bug with Buddypress 1.2.3 compatibility 44 46 = Version 1.2 = 45 *Siteadmin restriction fixed,now site admin sees only the site policy47 *Siteadmin restriction fixed,now site admin sees only the site policy 46 48 *Subscribers can creates new blog,the blog of which they are subscriber/contributor/author/editor is not counted. 47 49 * Only the blogs for which a user is admin is counted in user blogs
Note: See TracChangeset
for help on using the changeset viewer.