We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit cafc9bb3 authored by tobyink's avatar tobyink

Allow group ownership to be reassigned.

parent 1fcab083
......@@ -101,6 +101,23 @@ if ($_POST['submit'])
if (!isset($errors[0]))
if ($_POST['owner'] != $group->owner->username)
$new_owner = new User($_POST['owner']);
if (! $group->memberCheck($new_owner))
$smarty->assign('error', 'Error!');
$smarty->assign('details', 'Cannot assign group ownership to someone who is not a member!');
$group->owner = $new_owner;
$group->fullname = $_POST['fullname'];
$group->homepage = $_POST['homepage'];
$group->bio = $_POST['bio'];
......@@ -134,12 +151,15 @@ if(isset($group->name))
$smarty->assign('fullname', ($group->fullname));
$smarty->assign('bio', ($group->bio));
$smarty->assign('homepage', ($group->homepage));
$smarty->assign('avatar_uri', ($group->avatar_uri));
$smarty->assign('fullname', $group->fullname);
$smarty->assign('bio', $group->bio);
$smarty->assign('homepage', $group->homepage);
$smarty->assign('avatar_uri', $group->avatar_uri);
$smarty->assign('members', $group->getUsers());
$smarty->assign('owner', $group->owner);
# And display the page.
$smarty->assign('errors', $errors);
$smarty->assign('newform', false);
......@@ -26,7 +26,7 @@ in the best possible terms.</p>
<h2 property="dc:title">{t}Edit your group{/t}</h2>
<p><strong>{t}The form below is still very experimental. Using this may wreck your account!{/t}</strong></p>
<p><strong>{t}The form below is still very experimental. Using this may wreck your group!{/t}</strong></p>
<form action="{$base_url}/edit_group.php" method="post" class="notcrazy">
......@@ -50,6 +50,21 @@ in the best possible terms.</p>
<td><textarea name="bio" id="bio" rows="6" cols="30" style="width:100%;min-width:20em">{$bio|escape:'html':'UTF-8'}</textarea></td>
<th align="right" valign="top"><label for="owner">Leader:</label></th>
<select name="owner" id="owner">
{foreach from=$members item=me}
<option {if $me->name==$owner->name}selected="selected"{/if}
>{$me->fullname|escape:'html':'UTF-8'} ({$me->name|escape:'html':'UTF-8'})</option>
<td><a href="#dfn_owner" rel="glossary">What's this?</a> <strong>Important!</strong></td>
<td colspan="3" align="center">
<input type="submit" value="Change" />
......@@ -65,6 +80,11 @@ in the best possible terms.</p>
<dt id="dfn_avatar_uri">Logo URL</dt>
<dd>{t}The web address for a picture to represent your group on libre.fm. It should
not be more than 80x80 pixels. (64x64 is best.){/t}</dd>
<dt id="dfn_owner">Leader</dt>
<dd>{t}The group leader 'owns' the group and is able to make changes to the group.
A group can only have one leader, so if you make someone else the leader, you will
no longer be able to edit this group. You will not be able to undo this change!{/t}</dd>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment