Added NSFW compatibility
This commit is contained in:
10
Setup.php
10
Setup.php
@@ -21,6 +21,7 @@ class Setup extends AbstractSetup
|
|||||||
{
|
{
|
||||||
$this->schemaManager()->alterTable('xf_user', function (\XF\Db\Schema\Alter $table) {
|
$this->schemaManager()->alterTable('xf_user', function (\XF\Db\Schema\Alter $table) {
|
||||||
$table->addColumn('rhpz_entry_count', 'int')->setDefault(0);
|
$table->addColumn('rhpz_entry_count', 'int')->setDefault(0);
|
||||||
|
$table->addColumn('nsfw_content', 'int')->setDefault(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,10 +57,17 @@ class Setup extends AbstractSetup
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function upgrade1010070Step1(): void
|
||||||
|
{
|
||||||
|
$this->schemaManager()->alterTable('xf_user', function (\XF\Db\Schema\Alter $table) {
|
||||||
|
$table->addColumn('nsfw_content', 'int')->setDefault(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function uninstallStep1(): void
|
public function uninstallStep1(): void
|
||||||
{
|
{
|
||||||
$this->schemaManager()->alterTable('xf_user', function($table) {
|
$this->schemaManager()->alterTable('xf_user', function($table) {
|
||||||
$table->dropColumns(['rhpz_entry_count']);
|
$table->dropColumns(['rhpz_entry_count', 'nsfw_content']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class User extends XFCP_User
|
|||||||
$structure = parent::getStructure($structure);
|
$structure = parent::getStructure($structure);
|
||||||
|
|
||||||
$structure->columns['rhpz_entry_count'] = [ 'type' => self::UINT, 'default' => 0 ];
|
$structure->columns['rhpz_entry_count'] = [ 'type' => self::UINT, 'default' => 0 ];
|
||||||
|
$structure->columns['nsfw_content'] = [ 'type' => self::BOOL, 'default' => 0 ];
|
||||||
|
|
||||||
return $structure;
|
return $structure;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace RomhackPlaza\Master\XF\Pub\Controller;
|
namespace RomhackPlaza\Master\XF\Pub\Controller;
|
||||||
|
|
||||||
use RomhackPlaza\Master\Service\DeleteAccount\CodeService;
|
use RomhackPlaza\Master\Service\DeleteAccount\CodeService;
|
||||||
|
use XF\Entity\User;
|
||||||
|
|
||||||
class AccountController extends XFCP_AccountController
|
class AccountController extends XFCP_AccountController
|
||||||
{
|
{
|
||||||
@@ -22,4 +23,18 @@ class AccountController extends XFCP_AccountController
|
|||||||
return $this->addAccountWrapperParams($view, 'delete_account');
|
return $this->addAccountWrapperParams($view, 'delete_account');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function preferencesSaveProcess(User $visitor)
|
||||||
|
{
|
||||||
|
$form = parent::preferencesSaveProcess($visitor);
|
||||||
|
|
||||||
|
$input = $this->filter([
|
||||||
|
'user' => [
|
||||||
|
'nsfw_content' => 'bool',
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$form->basicEntitySave($visitor, $input['user'] );
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,12 +23,24 @@
|
|||||||
"version_string": "1.0.0",
|
"version_string": "1.0.0",
|
||||||
"hash": "15d96c48f857b975c051d7c98b13a385"
|
"hash": "15d96c48f857b975c051d7c98b13a385"
|
||||||
},
|
},
|
||||||
|
"enable_nsfw_entries.txt": {
|
||||||
|
"global_cache": false,
|
||||||
|
"version_id": 1010070,
|
||||||
|
"version_string": "1.1.0",
|
||||||
|
"hash": "5fe4c9ee5afb3f3b3125508f27c245b6"
|
||||||
|
},
|
||||||
"entries.txt": {
|
"entries.txt": {
|
||||||
"global_cache": false,
|
"global_cache": false,
|
||||||
"version_id": 1000000,
|
"version_id": 1000000,
|
||||||
"version_string": "1.0.0",
|
"version_string": "1.0.0",
|
||||||
"hash": "bc14b0a9c516310fc195a778937cc0a0"
|
"hash": "bc14b0a9c516310fc195a778937cc0a0"
|
||||||
},
|
},
|
||||||
|
"entries_options.txt": {
|
||||||
|
"global_cache": false,
|
||||||
|
"version_id": 1010070,
|
||||||
|
"version_string": "1.1.0",
|
||||||
|
"hash": "7c72b58cc8011ac1c23376fffb33f0da"
|
||||||
|
},
|
||||||
"nav.about.txt": {
|
"nav.about.txt": {
|
||||||
"global_cache": false,
|
"global_cache": false,
|
||||||
"version_id": 1000000,
|
"version_id": 1000000,
|
||||||
|
|||||||
1
_output/phrases/enable_nsfw_entries.txt
Normal file
1
_output/phrases/enable_nsfw_entries.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Enable NSFW Entries
|
||||||
1
_output/phrases/entries_options.txt
Normal file
1
_output/phrases/entries_options.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Entries options
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
"public/rhpz_above_thread_list_clubs_buttons.json": {
|
"public/rhpz_above_thread_list_clubs_buttons.json": {
|
||||||
"hash": "c783001e00f7a63389c9ae988012f5fe"
|
"hash": "c783001e00f7a63389c9ae988012f5fe"
|
||||||
},
|
},
|
||||||
|
"public/rhpz_account_preferences_nsfw_content.json": {
|
||||||
|
"hash": "9feae814b9fa8f40a08e1b50e2d410c5"
|
||||||
|
},
|
||||||
"public/rhpz_account_wrapper_delete_account.json": {
|
"public/rhpz_account_wrapper_delete_account.json": {
|
||||||
"hash": "6594c0474a9b3e737a10dbd9c531521e"
|
"hash": "6594c0474a9b3e737a10dbd9c531521e"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"template": "account_preferences",
|
||||||
|
"description": "Add NSFW Content field to the settings",
|
||||||
|
"execution_order": 10,
|
||||||
|
"enabled": true,
|
||||||
|
"action": "str_replace",
|
||||||
|
"find": "<xf:macro id=\"helper_account::email_options_row\" arg-showConversationOption=\"{{ true }}\" />",
|
||||||
|
"replace": "<xf:checkboxrow label=\"{{ phrase('entries_options') }}\">\n\t<xf:option value=\"true\" name=\"user[nsfw_content]\" checked=\"{{ $xf.visitor.nsfw_content == 1 ? true : false }}\"\n\t\t\t label=\"{{ phrase('enable_nsfw_entries') }}\">\n\t</xf:option>\n</xf:checkboxrow>\n$0"
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
"legacy_addon_id": "",
|
"legacy_addon_id": "",
|
||||||
"title": "RomhackPlaza Master Addon",
|
"title": "RomhackPlaza Master Addon",
|
||||||
"description": "",
|
"description": "",
|
||||||
"version_id": 1000000,
|
"version_id": 1010070,
|
||||||
"version_string": "1.0.0",
|
"version_string": "1.1.0",
|
||||||
"dev": "",
|
"dev": "",
|
||||||
"dev_url": "",
|
"dev_url": "",
|
||||||
"faq_url": "",
|
"faq_url": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user