diff -rup ../terms_of_use/terms_of_use.module ./terms_of_use.module --- ../terms_of_use/terms_of_use.module 2010-05-15 23:05:40.000000000 +1000 +++ ./terms_of_use.module 2011-03-18 11:11:03.000000000 +1100 @@ -84,7 +84,7 @@ function terms_of_use_admin_settings() { '#type' => 'textfield', '#title' => t('Label for the checkbox'), '#default_value' => variable_get('terms_of_use_checkbox_label', t('I agree with these terms.')), - '#description' => t('Type here something like "I agree with these terms." or "I CERTIFY THAT I AM OVER THE AGE OF 18 YEARS OLD.", without quotes. You can use the token @link to insert a link to the Terms in this label. For example, the label can be: "I agree with the @link.", without quotes. You may want to link to the Terms if you prefer not to show the full text of the Terms in the registration form. If you use the token, the Terms will not be shown.'), + '#description' => t('Type here something like "I agree with these terms." or "I CERTIFY THAT I AM OVER THE AGE OF 18 YEARS OLD.", without quotes.') . '
' . t('You can use the token @link to insert a link to the Terms in this label. For example, the label can be: "I agree with the @link.", without quotes. You may want to link to the Terms if you prefer not to show the full text of the Terms in the registration form. If you use the token, the Terms will not be shown.') . '
' . t('You can also add additional node links by using tokens in the form @node:nid (where nid is the node ID of the node to link to). For example, the label can be: "I agree with the @link and the @node:47.", without quotes. You can add as many of these additional links as you like.'), ); return system_settings_form($form); @@ -174,6 +174,17 @@ function terms_of_use_form_user_register $checkbox_label = str_replace('@link', l($node->title, 'node/' . $node->nid), $checkbox_label); $show_terms = FALSE; } + + // Replace all occurances of @node:nid with an actual node link. + preg_match_all('/@node:\d+/', $checkbox_label, $matches); + foreach ($matches[0] as $match) { + $nid = substr($match, 6); + $link_node = node_load($nid); + if ($link_node) { + $checkbox_label = str_replace($match, l($link_node->title, 'node/' . $link_node->nid), $checkbox_label); + } + } + // Adding the nodes body by theme_terms_of_use() to the fieldset if desired. if ($show_terms) { $node = node_prepare(node_load($terms_of_use_node_id));