User_group.php

Summary
User_group.php
User_groupTable Definition for user_group
User_groupTable definition for user_group
getObjectTypeReturns the ActivityObject type this class is a representation of
schemaDefReturns the table schema definition
getProfileReturns the profile of the group
getNicknameReturns the nickname of the group
getFullnameReturns the full name of the group
defaultLogoUsed when there is no other avatar for the group, this function returns the default avatar.
homeUrlReturns the specified homepage URL of the group
getUriReturns the URI of the usergroup, and fires related events.
permalinkReturns a URL with a permalink to the group, and fires related events.
getNoticesGet $limit notices posted to this group, starting at $offset.
getMembersReturns $limit members of the group, starting at $offset.
getMemberIDsReturns an array of user IDs for members of the usergroup, starting at $offset and up to $limit many.
getRequestsGet pending members, who have not yet been approved.
getAdminReturns the number of admins a group has
getMemberCountReturns the number of members a group has
getBlockedCountReturns the number of users blocked by this group
getQueueCountReturns the number of queued membership approvals for the group
getAdminsReturns the users that are admins of this group.
getBlockedReturns the users that are blocked by this group.
setOriginalA confusingly-named function that sets an avatar for a group.
getBestName
getFancyNameGets the full name (if filled) with nickname as a parenthetical, or the nickname alone if no fullname is provided.
getAliasesReturns an array with the aliases of a group.
setAliasesSet the aliases for a group.
getForNicknameGet a usergroup by a nickname.
getUserMembersGet the local members of a group (remotes will just have profiles, not user records.)
maxDescriptionReturns the maximum amount of characters for a group description
descriptionTooLongReturns true/false whether the group description exceeds the maximum amount of characters.
asAtomEntryReturn an ATOM feed describing a group.
asAtomAuthorReturns the tags neccesary to identify the group as the author of an ATOM feed.
asActivityNounReturns an XML string fragment with group information as an Activity Streams noun object with the given element type.
getAvatarReturns the avatar for a group.
registerRegister a new group and throw related events.
deleteHandle cascading deletion, on the model of notice and profile.
updateUpdate the database record for a group.
isPrivateReturns true/false whether a group is private or not.
isLocalReturns true/false whether a group is instance-local or not.
groupsFromTextReturns an array of all !groups references in a given body of text.
idsFromTextAs groupsFromText, but returns an array of group IDs instead

User_group

Table Definition for user_group

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

Table Definition for user_group

PHP version

Tested with PHP 7

File Authors

Web

User_group

Table definition for user_group

Constants

  • JOIN_POLICY_OPEN = 0
  • JOIN_POLICY_MODERATE = 1
  • CACHE_WINDOW = 201

Variables

  • __table = ‘user_group’ - table name
  • id - int(4) primary_key not_null
  • profile_id - int(4) primary_key not_null
  • nickname - varchar(64)
  • fullname - varchar(191) not 255 because utf8mb4 takes more space
  • homepage - varchar(191) not 255 because utf8mb4 takes more space
  • description - text
  • location - varchar(191) not 255 because utf8mb4 takes more space
  • original_logo - varchar(191) not 255 because utf8mb4 takes more space
  • homepage_logo - varchar(191) not 255 because utf8mb4 takes more space
  • stream_logo - varchar(191) not 255 because utf8mb4 takes more space
  • mini_logo - varchar(191) not 255 because utf8mb4 takes more space
  • created - datetime not_null default_0000-00-00%2000%3A00%3A00
  • modified - timestamp not_null default_CURRENT_TIMESTAMP
  • uri - varchar(191) unique_key not 255 because utf8mb4 takes more space
  • mainpage - varchar(191) not 255 because utf8mb4 takes more space
  • join_policy - tinyint
  • force_scope - tinyint
Summary
getObjectTypeReturns the ActivityObject type this class is a representation of
schemaDefReturns the table schema definition
getProfileReturns the profile of the group
getNicknameReturns the nickname of the group
getFullnameReturns the full name of the group
defaultLogoUsed when there is no other avatar for the group, this function returns the default avatar.
homeUrlReturns the specified homepage URL of the group
getUriReturns the URI of the usergroup, and fires related events.
permalinkReturns a URL with a permalink to the group, and fires related events.
getNoticesGet $limit notices posted to this group, starting at $offset.
getMembersReturns $limit members of the group, starting at $offset.
getMemberIDsReturns an array of user IDs for members of the usergroup, starting at $offset and up to $limit many.
getRequestsGet pending members, who have not yet been approved.
getAdminReturns the number of admins a group has
getMemberCountReturns the number of members a group has
getBlockedCountReturns the number of users blocked by this group
getQueueCountReturns the number of queued membership approvals for the group
getAdminsReturns the users that are admins of this group.
getBlockedReturns the users that are blocked by this group.
setOriginalA confusingly-named function that sets an avatar for a group.
getBestName
getFancyNameGets the full name (if filled) with nickname as a parenthetical, or the nickname alone if no fullname is provided.
getAliasesReturns an array with the aliases of a group.
setAliasesSet the aliases for a group.
getForNicknameGet a usergroup by a nickname.
getUserMembersGet the local members of a group (remotes will just have profiles, not user records.)
maxDescriptionReturns the maximum amount of characters for a group description
descriptionTooLongReturns true/false whether the group description exceeds the maximum amount of characters.
asAtomEntryReturn an ATOM feed describing a group.
asAtomAuthorReturns the tags neccesary to identify the group as the author of an ATOM feed.
asActivityNounReturns an XML string fragment with group information as an Activity Streams noun object with the given element type.
getAvatarReturns the avatar for a group.
registerRegister a new group and throw related events.
deleteHandle cascading deletion, on the model of notice and profile.
updateUpdate the database record for a group.
isPrivateReturns true/false whether a group is private or not.
isLocalReturns true/false whether a group is instance-local or not.
groupsFromTextReturns an array of all !groups references in a given body of text.
idsFromTextAs groupsFromText, but returns an array of group IDs instead

getObjectType

public function getObjectType()

Returns the ActivityObject type this class is a representation of

Returns

  • ActivityObject object

schemaDef

public static function schemaDef()

Returns the table schema definition

Returns

  • array schemaDef - description of table schema

getProfile

public function getProfile()

Returns the profile of the group

Returns

  • Profile

Error states

  • throws GroupNoProfileException if user has no profile

getNickname

public function getNickname()

Returns the nickname of the group

getFullname

public function getFullname()

Returns the full name of the group

defaultLogo

public static function defaultLogo($size)

Used when there is no other avatar for the group, this function returns the default avatar.

homeUrl

function homeUrl()

Returns the specified homepage URL of the group

getUri

function getUri()

Returns the URI of the usergroup, and fires related events.

permalink

function permalink()

Returns a URL with a permalink to the group, and fires related events.

getNotices

function getNotices($offset,  
$limit,  
$since_id = null,
$max_id = null)

Get $limit notices posted to this group, starting at $offset.

getMembers

function getMembers($offset = 0,
$limit = null)

Returns $limit members of the group, starting at $offset.

getMemberIDs

function getMemberIDs($offset = 0,
$limit = null)

Returns an array of user IDs for members of the usergroup, starting at $offset and up to $limit many.

getRequests

function getRequests($offset = 0,
$limit = null)

Get pending members, who have not yet been approved.

Parameters

  • int $offset
  • int $limit

Returns

  • Profile

getAdmin

public function getAdminCount()

Returns the number of admins a group has

getMemberCount

public function getMemberCount()

Returns the number of members a group has

getBlockedCount

function getBlockedCount()

Returns the number of users blocked by this group

getQueueCount

function getQueueCount()

Returns the number of queued membership approvals for the group

getAdmins

function getAdmins($offset = null,
$limit = null)

Returns the users that are admins of this group.

Offset is default null because DataObject wants it, 0 would mean no results.

getBlocked

function getBlocked($offset = null,
$limit = null)

Returns the users that are blocked by this group.

Offset is defaultnull because DataObject wants it, 0 would mean no results

setOriginal

function setOriginal($filename)

A confusingly-named function that sets an avatar for a group.

getBestName

function getBestName()
Returns either the fullname or nickname of the groupin that order.

getFancyName

function getFancyName()

Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone if no fullname is provided.

Returns

  • string

getAliases

function getAliases()

Returns an array with the aliases of a group.

setAliases

function setAliases($newaliases)

Set the aliases for a group.

getForNickname

static function getForNickname( $nickname,  
Profile $profile = null)

Get a usergroup by a nickname.

Returns

  • usergroup id

getUserMembers

function getUserMembers()

Get the local members of a group (remotes will just have profiles, not user records.)

Returns

  • array of userids

maxDescription

static function maxDescription()

Returns the maximum amount of characters for a group description

descriptionTooLong

static function descriptionTooLong($desc)

Returns true/false whether the group description exceeds the maximum amount of characters.

asAtomEntry

function asAtomEntry($namespace = false,
$source = false)

Return an ATOM feed describing a group.

asAtomAuthor

function asAtomAuthor()

Returns the tags neccesary to identify the group as the author of an ATOM feed.

asActivityNoun

function asActivityNoun($element)

Returns an XML string fragment with group information as an Activity Streams noun object with the given element type.

(OStatus 0.5 format)

Assumes that ‘activity’, ‘georss’, and ‘poco’ namespace has been previously defined.

Parameters

  • string $element one of ‘actor’, ‘subject’, ‘object’, ‘target’

Returns

  • string

getAvatar

function getAvatar()

Returns the avatar for a group.

register

static function register($fields)

Register a new group and throw related events.

Parameters

  • array fields - contains the fields to fill out for the group

Required field

  • userid - ID of user creating group

Optional fields

  • nickname
  • fullname
  • homepage
  • description
  • location
  • mainpage
  • aliases

delete

function delete($useWhere = false)

Handle cascading deletion, on the model of notice and profile.

This should handle freeing up cached entries for the group’s id, nickname, URI, and aliases.  There may be other areas that are not de-cached in the UI, including the sidebar lists on GroupsAction

update

public function update($dataObject = false)

Update the database record for a group.

isPrivate

function isPrivate()

Returns true/false whether a group is private or not.

isLocal

public function isLocal()

Returns true/false whether a group is instance-local or not.

groupsFromText

static function groupsFromText( $text,
Profile $profile)

Returns an array of all !groups references in a given body of text.

Returns

  • array of Group objects

idsFromText

static function idsFromText( $text,
Profile $profile)

As groupsFromText, but returns an array of group IDs instead

public function getObjectType()
Returns the ActivityObject type this class is a representation of
public static function schemaDef()
Returns the table schema definition
public function getProfile()
Returns the profile of the group
public function getNickname()
Returns the nickname of the group
public function getFullname()
Returns the full name of the group
public static function defaultLogo($size)
Used when there is no other avatar for the group, this function returns the default avatar.
function homeUrl()
Returns the specified homepage URL of the group
function getUri()
Returns the URI of the usergroup, and fires related events.
function permalink()
Returns a URL with a permalink to the group, and fires related events.
function getNotices($offset,  
$limit,  
$since_id = null,
$max_id = null)
Get $limit notices posted to this group, starting at $offset.
function getMembers($offset = 0,
$limit = null)
Returns $limit members of the group, starting at $offset.
function getMemberIDs($offset = 0,
$limit = null)
Returns an array of user IDs for members of the usergroup, starting at $offset and up to $limit many.
function getRequests($offset = 0,
$limit = null)
Get pending members, who have not yet been approved.
public function getAdminCount()
Returns the number of admins a group has
public function getMemberCount()
Returns the number of members a group has
function getBlockedCount()
Returns the number of users blocked by this group
function getQueueCount()
Returns the number of queued membership approvals for the group
function getAdmins($offset = null,
$limit = null)
Returns the users that are admins of this group.
function getBlocked($offset = null,
$limit = null)
Returns the users that are blocked by this group.
function setOriginal($filename)
A confusingly-named function that sets an avatar for a group.
function getBestName()
function getFancyName()
Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone if no fullname is provided.
function getAliases()
Returns an array with the aliases of a group.
function setAliases($newaliases)
Set the aliases for a group.
static function getForNickname( $nickname,  
Profile $profile = null)
Get a usergroup by a nickname.
function getUserMembers()
Get the local members of a group (remotes will just have profiles, not user records.)
static function maxDescription()
Returns the maximum amount of characters for a group description
static function descriptionTooLong($desc)
Returns true/false whether the group description exceeds the maximum amount of characters.
function asAtomEntry($namespace = false,
$source = false)
Return an ATOM feed describing a group.
function asAtomAuthor()
Returns the tags neccesary to identify the group as the author of an ATOM feed.
function asActivityNoun($element)
Returns an XML string fragment with group information as an Activity Streams noun object with the given element type.
function getAvatar()
Returns the avatar for a group.
static function register($fields)
Register a new group and throw related events.
function delete($useWhere = false)
Handle cascading deletion, on the model of notice and profile.
public function update($dataObject = false)
Update the database record for a group.
function isPrivate()
Returns true/false whether a group is private or not.
public function isLocal()
Returns true/false whether a group is instance-local or not.
static function groupsFromText( $text,
Profile $profile)
Returns an array of all !groups references in a given body of text.
static function idsFromText( $text,
Profile $profile)
As groupsFromText, but returns an array of group IDs instead