Posted by akolahi on January 6, 2009 at 5:32am
| Project: | Terms of Use |
| Version: | 6.x-1.12 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Thank you for this wonderful module!
I think it would be of great benefit to allow for multiple terms of use that would need to be checked off. Many sites have "Terms of Use", "Privacy Policy" etc... There are many circumstances where several documents must be agreed to before registering.
thank you.
Comments
#1
#2
I agree. Initially, I removed check_plain() from line 152 in terms_of_use.module to allow inserting <a> tags, but then wrote a way to include links to nodes by including the node title in quotes, preceded by an @ sign (ex. @"Privacy Policy" links to a node called Privacy Policy). It even supports escaped quotes (\") for titles with quotes in them.
#3
subscribe
#4
Just to let people know - I included this feature in a combined patch #759064: Combined patch to address multiple issues and feature requests
#5
+++ terms_of_use.module 15 Apr 2009 19:48:22 -0000@@ -151,11 +151,30 @@ function terms_of_use_form_user_register
+ if(substr($checkbox_label,$i,2) == '@"') {
+ $start = $i+2;
+ $end = strpos($checkbox_label,'"',$start);
+ while(substr($checkbox_label,$end-1,1) == "\\") {
+ $end = strpos($checkbox_label,'"',$end+1);
+ }
+ $title = substr($checkbox_label, $start, ($end-$start));
+ $node = node_load(array('title' => str_replace( '\\"','"',$title) ) );
+ $checkbox_label = str_replace('@"'.$title.'"', l($node->title, 'node/'. $node->nid), $checkbox_label);
+ $i = $end+1;
+ } else {
+ $i++;
+ }
Coding style issues. Please fix them. And set your patches to "Needs review" and not to be "to be ported" :)
Powered by Dreditor.
#6
subscribe
#7
subscribing
#8
Here is a similar but different patch.
It uses tokens of the form @node:nid where nid is the node ID of the node you want to link to.
It also addresses a few issues with the original patch:
* Coding standards.
* Simplifies the logic.
* Doesn't use $node as the variable when loading the nodes for these links, because that would overwrite the existing $node variable, which is being used for other purposes.
* Adds extra info on the new tokens to the field description so people know they can do it.
Also note that if you don't use the @link token the terms will still display in the fieldset.
I made the patch for 6.x-1.12 so I haven't tested with 6.x-1.x-dev but the patch does apply to dev with a slight offset so it will probably work.