/**
 * Get allowed space for the given component( In MB) 
 * @param type $component
 * @param type $component_id
 * @return numeric : no. of MBs
 */
function mpp_get_allowed_space($component, $component_id = null)
{
    if (!empty($component_id)) {
        if ($component == 'members') {
            $space_allowed = mpp_get_user_meta($component_id, 'mpp_upload_space', true);
        } elseif ($component == 'groups' && function_exists('groups_get_groupmeta')) {
            $space_allowed = groups_get_groupmeta($component_id, 'mpp_upload_space', true);
        }
    }
    if (empty($component_id) || empty($space_allowed)) {
        //if owner id is empty
        //get the gallery/group space
        if ($component == 'members') {
            $space_allowed = mpp_get_option('mpp_upload_space');
        } elseif ($component == 'groups') {
            $space_allowed = mpp_get_option('mpp_upload_space_groups');
        }
    }
    //we should have some value by now
    //if( empty($space_allowed))
    ///   $space_allowed = get_option("gallery_upload_space");//currently let us deal with blog space gallery will have it's own limit later
    if (empty($space_allowed)) {
        $space_allowed = mpp_get_option('mpp_upload_space');
    }
    //if we still don't have anything
    if (empty($space_allowed) || !is_numeric($space_allowed)) {
        $space_allowed = 10;
        //by default
    }
    return apply_filters('mpp_allowed_space', $space_allowed, $component, $component_id);
    //allow to override for specific users/groups
}
function mpp_delete_members_wall_gallery_id($user_id, $type, $gallery_id)
{
    $key = "_mpp_wall_{$type}_gallery_id";
    $wall_gallery_id = (int) mpp_get_user_meta($user_id, $key, true);
    if (mpp_delete_user_meta($user_id, $key, $gallery_id)) {
        return $wall_gallery_id;
    }
    return 0;
    //invalid gallery id if unable to delete
}