aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-11-09 16:18:26 +0100
committerSem <sembrestels@riseup.net>2013-11-09 16:18:26 +0100
commited6d980dcb06a66e1746fe4959aa138c39fb4e9e (patch)
treea018c2f31e0abbc543f97edf9d0337ebaf648a41
parent6834f913fe7ce7d4274a9757661589e9a222b71c (diff)
parente586807b4e6ace77d53b3195ca4fa13ab62d4a09 (diff)
downloadelgg-ed6d980dcb06a66e1746fe4959aa138c39fb4e9e.tar.gz
elgg-ed6d980dcb06a66e1746fe4959aa138c39fb4e9e.tar.bz2
Add 'mod/registrationterms/' from commit 'e586807b4e6ace77d53b3195ca4fa13ab62d4a09'
git-subtree-dir: mod/registrationterms git-subtree-mainline: 6834f913fe7ce7d4274a9757661589e9a222b71c git-subtree-split: e586807b4e6ace77d53b3195ca4fa13ab62d4a09
-rw-r--r--mod/registrationterms/.gitignore3
-rw-r--r--mod/registrationterms/README.md9
-rw-r--r--mod/registrationterms/languages/ca.php6
-rw-r--r--mod/registrationterms/languages/en.php6
-rw-r--r--mod/registrationterms/manifest.xml25
-rw-r--r--mod/registrationterms/screenshots/register-form.pngbin0 -> 8653 bytes
-rw-r--r--mod/registrationterms/start.php18
-rw-r--r--mod/registrationterms/views/default/registrationterms/register.php17
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
new file mode 100644
index 000000000..277a287af
--- /dev/null
+++ b/mod/registrationterms/screenshots/register-form.png
Binary files differ
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