Index: terms_of_use.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/terms_of_use/terms_of_use.module,v retrieving revision 1.1.2.8 diff -u -p -r1.1.2.8 terms_of_use.module --- terms_of_use.module 23 Mar 2009 21:20:27 -0000 1.1.2.8 +++ terms_of_use.module 15 Apr 2009 19:48:22 -0000 @@ -151,11 +151,30 @@ function terms_of_use_form_user_register // Reading the checkbox label to find out. $show_terms = TRUE; $checkbox_label = check_plain(variable_get('terms_of_use_checkbox_label', t('I agree with these terms.'))); + if (strpos($checkbox_label, '@link') !== FALSE) { $checkbox_label = str_replace('@link', l(check_plain($node->title), 'node/'. $node->nid), $checkbox_label); $show_terms = FALSE; - } + } + // Go through the $checkbox_label string, replacing @"Terms Link" with an actual node link + $checkbox_label = str_replace('"','"',$checkbox_label); + while( $i < strlen($checkbox_label) ) { + 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++; + } + } + // Adding the Terms of Use to the fieldset. if ($show_terms && $node) { $terms = node_prepare($node);