Skip to content

Commit

Permalink
1.2 Beta 3 - multi deletion delay
Browse files Browse the repository at this point in the history
  • Loading branch information
formerandroider committed Sep 2, 2019
1 parent a77c184 commit edba283
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 2 deletions.
12 changes: 12 additions & 0 deletions XF/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ public function canDeleteSelf(&$error = null)
return false;
}

if (\XF::options()->liamw_accountdelete_repeat_delay)
{
$recentDeletionInitiation = $this->getRelationFinder('AccountDeletionLogs')
->order('initiation_date', 'desc')->pluckFrom('initiation_date')->fetch(1)->first();

if ($recentDeletionInitiation && $recentDeletionInitiation > \XF::$time - (\XF::options()->liamw_accountdelete_repeat_delay * 24 * 60 * 60))
{
$error = \XF::phraseDeferred('liamw_accountdelete_you_cannot_delete_your_account_as_you_have_recently_cancelled_pending');
return false;
}
}

$criteria = $this->app()->criteria('XF:User', \XF::options()->liamw_accountdelete_user_criteria);
$criteria->setMatchOnEmpty(true);

Expand Down
3 changes: 3 additions & 0 deletions _output/options/_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"liamw_accountdelete_reminder_threshold.json": {
"hash": "cab36375e3b6bad5aa8721e1c8fc34c8"
},
"liamw_accountdelete_repeat_delay.json": {
"hash": "656604c485098ec9f3fa45d8a2e349ac"
},
"liamw_accountdelete_user_criteria.json": {
"hash": "87a141ae393dbf3dbc918e34829fc68b"
}
Expand Down
12 changes: 12 additions & 0 deletions _output/options/liamw_accountdelete_repeat_delay.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"edit_format": "spinbox",
"edit_format_params": "min=0\nunits={{ phrase('units_days') }}",
"data_type": "unsigned_integer",
"sub_options": [],
"validation_class": "",
"validation_method": "",
"default_value": "14",
"relations": {
"liamw_memberselfdelete": 25
}
}
18 changes: 18 additions & 0 deletions _output/phrases/_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@
"version_string": "1.2.0 Beta 1",
"hash": "534e329f4b7df5b35a84099f2c395b84"
},
"liamw_accountdelete_you_cannot_delete_your_account_as_you_have_recently_cancelled_pending.txt": {
"global_cache": false,
"version_id": 1020033,
"version_string": "1.2.0 Beta 3",
"hash": "71ea1fb7dd48261a96f52585335216b1"
},
"liamw_accountdelete_you_cannot_delete_your_account_using_this_system_as_you_member_of.txt": {
"global_cache": false,
"version_id": 1010010,
Expand Down Expand Up @@ -299,6 +305,12 @@
"version_string": "1.1.0 Alpha",
"hash": "0eea4a4aa6ba6334e710a586c48fa0e2"
},
"option.liamw_accountdelete_repeat_delay.txt": {
"global_cache": false,
"version_id": 1020033,
"version_string": "1.2.0 Beta 3",
"hash": "1b1c9fcf0acab14cd086d38a92696e50"
},
"option.liamw_accountdelete_user_criteria.txt": {
"global_cache": false,
"version_id": 1010035,
Expand Down Expand Up @@ -329,6 +341,12 @@
"version_string": "1.1.0 Alpha",
"hash": "aea2ed409170c4706c95e317591816ea"
},
"option_explain.liamw_accountdelete_repeat_delay.txt": {
"global_cache": false,
"version_id": 1020033,
"version_string": "1.2.0 Beta 3",
"hash": "4e248eb2e7103696390d0b26ba3c37ab"
},
"option_explain.liamw_accountdelete_user_criteria.txt": {
"global_cache": false,
"version_id": 1010035,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You cannot delete your account as you have recently cancelled a pending deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Repeated delation delay
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
If set to a non-zero value, users will be unable to access to account deletion page for this many days after last requesting their account be deleted.
4 changes: 2 additions & 2 deletions addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"legacy_addon_id": "",
"title": "Member Self Delete",
"description": "Gives board members the ability to delete or disable their accounts.",
"version_id": 1020032,
"version_string": "1.2.0 Beta 2",
"version_id": 1020033,
"version_string": "1.2.0 Beta 3",
"dev": "Liam Williams",
"dev_url": "https://lw-addons.net",
"faq_url": "",
Expand Down

0 comments on commit edba283

Please sign in to comment.