Add 'mainpage' to User_group

Add the mainpage attribute to user_group objects.
This commit is contained in:
Evan Prodromou 2010-02-25 09:24:29 -05:00
parent e6858d7203
commit 8f42d37593
3 changed files with 10 additions and 2 deletions

View File

@ -23,6 +23,7 @@ class User_group extends Memcached_DataObject
public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00 public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
public $modified; // timestamp not_null default_CURRENT_TIMESTAMP public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
public $uri; // varchar(255) unique_key public $uri; // varchar(255) unique_key
public $mainpage; // varchar(255)
/* Static get */ /* Static get */
function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User_group',$k,$v); } function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('User_group',$k,$v); }
@ -42,8 +43,13 @@ class User_group extends Memcached_DataObject
{ {
$url = null; $url = null;
if (Event::handle('StartUserGroupHomeUrl', array($this, &$url))) { if (Event::handle('StartUserGroupHomeUrl', array($this, &$url))) {
$url = common_local_url('showgroup', // normally stored in mainpage, but older ones may be null
array('nickname' => $this->nickname)); if (!empty($this->mainpage)) {
$url = $this->mainpage;
} else {
$url = common_local_url('showgroup',
array('nickname' => $this->nickname));
}
} }
Event::handle('EndUserGroupHomeUrl', array($this, &$url)); Event::handle('EndUserGroupHomeUrl', array($this, &$url));
return $url; return $url;

View File

@ -601,6 +601,7 @@ design_id = 1
created = 142 created = 142
modified = 384 modified = 384
uri = 2 uri = 2
mainpage = 2
[user_group__keys] [user_group__keys]
id = N id = N

View File

@ -422,6 +422,7 @@ create table user_group (
modified timestamp comment 'date this record was modified', modified timestamp comment 'date this record was modified',
uri varchar(255) unique key comment 'universal identifier', uri varchar(255) unique key comment 'universal identifier',
mainpage varchar(255) comment 'page for group info to link to',
index user_group_nickname_idx (nickname) index user_group_nickname_idx (nickname)