Admin - When deleting a user, separately list apps that cannot handle it through hook

This commit is contained in:
nathangray 2019-07-22 11:49:57 -06:00
parent 5b420c7d0d
commit f160c697e4
3 changed files with 25 additions and 3 deletions

View File

@ -292,6 +292,7 @@ class admin_account
} }
$sel_options = array(); $sel_options = array();
$readonlys = array();
$preserve = $content; $preserve = $content;
// Get a count of entries owned by the user // Get a count of entries owned by the user
@ -303,7 +304,7 @@ class admin_account
{ {
$entry = lang('Entries'); $entry = lang('Entries');
} }
if($counts['total']) if($counts['total'] && Api\Hooks::exists('deleteaccount', $app))
{ {
$content['delete_apps'][] = $app; $content['delete_apps'][] = $app;
$sel_options['delete_apps'][] = array( $sel_options['delete_apps'][] = array(
@ -311,6 +312,14 @@ class admin_account
'label' => lang($app) . ': ' . $counts['total'] . ' '.$entry 'label' => lang($app) . ': ' . $counts['total'] . ' '.$entry
); );
} }
else if ($counts['total'])
{
// These ones don't support the needed hook
$content['counts'][] = array(
'app' => $app,
'count' => $counts['total'] . ' '.$entry
);
}
} }
$tpl = new Etemplate('admin.account.delete'); $tpl = new Etemplate('admin.account.delete');
$tpl->exec('admin_account::delete', $content, $sel_options, array(), $preserve, 2); $tpl->exec('admin_account::delete', $content, $sel_options, array(), $preserve, 2);

View File

@ -209,7 +209,7 @@ class admin_ui
$actions['delete'] = array( $actions['delete'] = array(
'caption' => 'Delete', 'caption' => 'Delete',
'group' => ++$group, 'group' => ++$group,
'popup' => '450x400', 'popup' => '615x590',
'url' => 'menuaction=admin.admin_account.delete&account_id=$id', 'url' => 'menuaction=admin.admin_account.delete&account_id=$id',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
); );

View File

@ -6,8 +6,21 @@
<vbox class="admin_account_delete"> <vbox class="admin_account_delete">
<description value="Who would you like to transfer records owned by the deleted user to?" class="dialogHeader2"/> <description value="Who would you like to transfer records owned by the deleted user to?" class="dialogHeader2"/>
<select-account id="new_owner" empty_label="Delete all records" class="dialogHeader3"/> <select-account id="new_owner" empty_label="Delete all records" class="dialogHeader3"/>
<description value="Transfer entries owned by the user:"/> <description value="Automatically transfer entries owned by the user:"/>
<select id="delete_apps" rows="8" multiple="true" span="2"/> <select id="delete_apps" rows="8" multiple="true" span="2"/>
<description value="Please manually deal with entries owned by the user:"/>
<grid id="counts">
<columns>
<column width="150"/>
<column/>
</columns>
<rows>
<row>
<select-app id="${row}[app]" readonly="true"/>
<description id="${row}[count]"/>
</row>
</rows>
</grid>
<grid> <grid>
<columns> <columns>
<column width="150"/> <column width="150"/>