Fix for PHP notice spew in group creation via API: set default 'mainpage' in User_group::register() rather than forcing all callers to do it manually.

This commit is contained in:
Brion Vibber 2011-01-06 13:22:08 -08:00
parent 4b29d0ebb6
commit 281076d5f6
2 changed files with 4 additions and 3 deletions

View File

@ -200,8 +200,6 @@ class NewgroupAction extends Action
}
}
$mainpage = common_local_url('showgroup', array('nickname' => $nickname));
$cur = common_current_user();
// Checked in prepare() above
@ -215,7 +213,6 @@ class NewgroupAction extends Action
'location' => $location,
'aliases' => $aliases,
'userid' => $cur->id,
'mainpage' => $mainpage,
'local' => true));
common_redirect($group->homeUrl(), 303);

View File

@ -487,6 +487,7 @@ class User_group extends Memcached_DataObject
}
// MAGICALLY put fields into current scope
// @fixme kill extract(); it makes debugging absurdly hard
extract($fields);
@ -498,6 +499,9 @@ class User_group extends Memcached_DataObject
// fill in later...
$uri = null;
}
if (empty($mainpage)) {
$mainpage = common_local_url('showgroup', array('nickname' => $nickname));
}
$group->nickname = $nickname;
$group->fullname = $fullname;