diff options
-rw-r--r-- | mod/registrationterms/.gitignore | 3 | ||||
-rw-r--r-- | mod/registrationterms/README.md | 9 | ||||
-rw-r--r-- | mod/registrationterms/languages/ca.php | 6 | ||||
-rw-r--r-- | mod/registrationterms/languages/en.php | 6 | ||||
-rw-r--r-- | mod/registrationterms/manifest.xml | 25 | ||||
-rw-r--r-- | mod/registrationterms/screenshots/register-form.png | bin | 0 -> 8653 bytes | |||
-rw-r--r-- | mod/registrationterms/start.php | 18 | ||||
-rw-r--r-- | mod/registrationterms/views/default/registrationterms/register.php | 17 |
8 files changed, 84 insertions, 0 deletions
diff --git a/mod/registrationterms/.gitignore b/mod/registrationterms/.gitignore new file mode 100644 index 000000000..f24f87a96 --- /dev/null +++ b/mod/registrationterms/.gitignore @@ -0,0 +1,3 @@ +/.settings +/.project +/.buildpath diff --git a/mod/registrationterms/README.md b/mod/registrationterms/README.md new file mode 100644 index 000000000..266368f80 --- /dev/null +++ b/mod/registrationterms/README.md @@ -0,0 +1,9 @@ +# Registration Terms for Elgg 1.8 #
+
+This is a simple little plugin that adds a checkbox to your registration form
+and forces users to check it before they can proceed.
+
+## Customization ##
+
+If you'd like to customize the wording or translate it into other languages,
+just override the language strings in languages/en.php
\ No newline at end of file diff --git a/mod/registrationterms/languages/ca.php b/mod/registrationterms/languages/ca.php new file mode 100644 index 000000000..4d2055ba0 --- /dev/null +++ b/mod/registrationterms/languages/ca.php @@ -0,0 +1,6 @@ +<?php +$language = array ( + 'registrationterms:agree' => 'He llegit i estic d\'acord amb les <a target="_blank" href="%s">Condicions del Servei</a>', + 'registrationterms:required' => 'Has d\'estar d\'acord amb les condicions', +); +add_translation("ca", $language);
\ No newline at end of file diff --git a/mod/registrationterms/languages/en.php b/mod/registrationterms/languages/en.php new file mode 100644 index 000000000..eecf0963f --- /dev/null +++ b/mod/registrationterms/languages/en.php @@ -0,0 +1,6 @@ +<?php + +add_translation("en", array( + 'registrationterms:agree' => 'I have read and agree to the <a target="_blank" href="%s">Terms of Service</a>', + 'registrationterms:required' => "You must first agree to the terms", +));
\ No newline at end of file diff --git a/mod/registrationterms/manifest.xml b/mod/registrationterms/manifest.xml new file mode 100644 index 000000000..9277f23eb --- /dev/null +++ b/mod/registrationterms/manifest.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Registration Terms</name>
+ <author>Evan Winslow</author>
+ <version>1.8.0</version>
+ <description>Force users to check a box saying they agree to the site's terms before they are allowed to register</description>
+ <website>http://github.com/ewinslow/elgg-registrationterms</website>
+ <copyright>(C) Evan Winslow 2010</copyright>
+ <license>GNU Public License version 2</license>
+ <requires>
+ <type>plugin</type>
+ <name>externalpages</name>
+ </requires>
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+
+ <screenshot>
+ <description>Checkbox appears in registration form.</description>
+ <path>screenshots/register-form.png</path>
+ </screenshot>
+
+ <admin_interface>simple</admin_interface>
+</plugin_manifest>
diff --git a/mod/registrationterms/screenshots/register-form.png b/mod/registrationterms/screenshots/register-form.png Binary files differnew file mode 100644 index 000000000..277a287af --- /dev/null +++ b/mod/registrationterms/screenshots/register-form.png diff --git a/mod/registrationterms/start.php b/mod/registrationterms/start.php new file mode 100644 index 000000000..3c42aa14a --- /dev/null +++ b/mod/registrationterms/start.php @@ -0,0 +1,18 @@ +<?php + +function registrationterms_init() { + //put the terms agreement at the very end + elgg_extend_view('register/extend', 'registrationterms/register', 1000); + + //block user registration if they don't check the box + elgg_register_plugin_hook_handler('action', 'register', 'registrationterms_register_hook'); +} + +function registrationterms_register_hook() { + if (get_input('agreetoterms', false) != 'true') { + register_error(elgg_echo('registrationterms:required')); + forward(REFERER); + } +} + +elgg_register_event_handler('init', 'system', 'registrationterms_init'); diff --git a/mod/registrationterms/views/default/registrationterms/register.php b/mod/registrationterms/views/default/registrationterms/register.php new file mode 100644 index 000000000..153674dd0 --- /dev/null +++ b/mod/registrationterms/views/default/registrationterms/register.php @@ -0,0 +1,17 @@ +<?php
+/**
+ *
+ */
+
+$label = elgg_echo('registrationterms:agree', array(elgg_normalize_url('/terms')));
+
+$input = elgg_view('input/checkbox', array(
+ 'name' => 'agreetoterms',
+ 'value' => 'true',
+ 'required' => TRUE,
+ 'default' => false,
+));
+?>
+<div>
+ <label><?php echo "$input $label"; ?></label>
+</div>
\ No newline at end of file |