Plugin Directory

Changeset 232361


Ignore:
Timestamp:
04/23/2010 02:40:50 PM (16 years ago)
Author:
write2brajesh
Message:
 
Location:
limit-blogs-per-user
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • limit-blogs-per-user/trunk/limit-bogs-per-user.php

    r211626 r232361  
    55Plugin URI:http://buddydev.com/buddypress/limit-blogs-per-user-plugin-for-wpmu
    66Author URI:http://buddydev.com/members/sbrajesh
    7 Version:1.2
    8 Last Updated: 28th feb 2010
     7Version:1.3
     8Last Updated: 23rd April 2010
    99License: GPL
    1010*/
     
    3636}
    3737/**
    38  * @desc Find the non subscriber/non author/non editor blogs for the user
     38 * @desc Find the blogs of which user is admin
    3939 *  It return the total number of blogs for which the user is  admin
    4040 * @param <array> $blogs
     
    4949        $count=0;
    5050        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++;
    5453       
    5554            }
     
    9594
    9695}
     96//check if the user is blog admin
     97function bpdev_is_user_blog_admin($user_id,$blog_id){
     98global $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
     111function bpdev_serialize_roles($roles){
     112    $roles['meta_value']=maybe_unserialize($roles['meta_value']);
     113return $roles;
     114}
    97115?>
  • limit-blogs-per-user/trunk/readme.txt

    r211653 r232361  
    33Tags: buddypress,wpmu, options,limit blogs,user,limit
    44Requires at least: 2.5+
    5 Tested up to: 2.9.1.1
    6 Stable tag: 1.2
     5Tested up to: 2.9.2
     6Stable tag: 1.3
    77
    88This plugin is for wpmu(wordpress Mu) and/or wpmu+buddypress based social network.It limits the number of blogs a user can create.
     
    4242
    4343== Changelog ==
     44= Version 1.3 =
     45 *Fixed a bug with Buddypress 1.2.3 compatibility
    4446= Version 1.2 =
    45 *Siteadmin restriction fixed,now site admin sees only the site policy
     47 *Siteadmin restriction fixed,now site admin sees only the site policy
    4648 *Subscribers can creates new blog,the blog of which they are subscriber/contributor/author/editor is not counted.
    4749 * Only the blogs for which a user is admin is counted in user blogs 
Note: See TracChangeset for help on using the changeset viewer.