diff --git a/forum/qa-plugin/send-pw-on-register/metadata.json b/forum/qa-plugin/send-pw-on-register/metadata.json new file mode 100644 index 00000000..2cef2751 --- /dev/null +++ b/forum/qa-plugin/send-pw-on-register/metadata.json @@ -0,0 +1,13 @@ +{ + "name": "Auto-send register PW message.", + "uri": "https://github.com/CodersCommunity/forum.pasja-informatyki.local", + "description": "This plugin automatically send private message to new user.", + "version": "1.0", + "date": "2018-06-10", + "author": "Mariusz08", + "author_uri": "https://forum.pasja-informatyki.pl/user/Mariusz08", + "license": "GNU GPL v2", + "update_uri": "https://github.com/CodersCommunity/forum.pasja-informatyki.local", + "min_q2a": "1.7", + "min_php": "5.3" +} diff --git a/forum/qa-plugin/send-pw-on-register/qa-plugin.php b/forum/qa-plugin/send-pw-on-register/qa-plugin.php new file mode 100644 index 00000000..32b02f5d --- /dev/null +++ b/forum/qa-plugin/send-pw-on-register/qa-plugin.php @@ -0,0 +1,32 @@ +prepareAdminForm($isSaved, $info); + } + + private function prepareAdminForm($isSaved, $info) + { + return [ + 'ok' => $isSaved ? 'Settings saved' : '', + 'fields' => [ + [ + 'label' => 'Enable plugin', + 'tags' => 'name="enablePlugin"', + 'value' => qa_opt('sendPwMessageOnRegister_enabled'), + 'type' => 'checkbox' + ], + [ + 'label' => 'DANGER ZONE! Bot for sending messages (id): DANGER ZONE!', + 'tags' => 'name="botId" type="number"', + 'value' => qa_opt('sendPwMessageOnRegister_botId'), + 'error' => empty($info['botId']) ? '' : $info['botId'] + ], + [ + 'label' => 'Message content:', + 'tags' => 'name="messageContent"', + 'value' => qa_html(qa_opt('sendPwMessageOnRegister_messageContent')), + 'type' => 'textarea', + 'rows' => 20, + 'error' => empty($info['content']) ? '' : $info['content'] + ] + ], + 'buttons' => [ + [ + 'label' => 'Save Changes', + 'tags' => 'name="sendPwMessageOnRegister_save"', + ] + ] + ]; + } +} diff --git a/forum/qa-plugin/send-pw-on-register/qa-pw-event.php b/forum/qa-plugin/send-pw-on-register/qa-pw-event.php new file mode 100644 index 00000000..02353c96 --- /dev/null +++ b/forum/qa-plugin/send-pw-on-register/qa-pw-event.php @@ -0,0 +1,37 @@ + $userId, + 'handle' => $handle, + 'messageid' => (int) $messageId, + 'message' => $messageContent + ]); + } + } +}