Here's the background for what I'm tring to accomplish:

  • I am using Webform 6.x-3.11 and have a generic sign-up form located at “/project-sign-up."
  • The webform has a hidden field with its default value set to "%get[project-title]."
  • I have a custom Content-type called Project that holds data specific to various community outreach projects.

What I am trying to do is displaying a link at the bottom of each "Project" page saying "SIGN UP!" with the "href" pointing to "/project-sign-up?project=[project-title]." However, I cannot figure out how to create the link through the CCK fields of the content type. I have also tried creating a node attachment through Views UI (views_attach) to append a link (with its output rewritten) to the "Project" node, but to no avail.

Could anyone point me in the right direction?


If you are doing it in Drupal 6 then hook_nodeapi(&$node, $op, $a3, $a4) is to alter node object for additional information.

function custom_module_nodeapi(&$node, $op, $a3, $a4){
  if ($op == 'view' && $node->type == 'project') {
    $node->content['project_link'] = array(
      '#value' => l('Sign Up', 'node/[id]', array('query' => "project=" . $node->title)),
      '#weight' => 100,
|improve this answer|||||
  • hi shoaib, and thanx for the reply. I'm newish to Drupal, so would I be right in assuming that this function goes into my template.php file? – Shalan Jul 24 '11 at 20:24
  • This will go into a custom module. Here is guide about that. [drupal.org/node/416986]. You just need to create a directory in your modules directory. choose a unique name for your module. create two files (.info and .module) .info will contain few information about your module see examples in other modules you might be using. Then put the given code in .module file. Do not forget to replace your module name with 'custom_module' in function name. – Shoaib Nawaz Jul 24 '11 at 20:33
  • Excellent! Thank you Shoaib, that's just what I was looking for! – Shalan Jul 24 '11 at 20:38
  • On a side note (for my future reference) do you know of any way to attach an existing webform to a node type? This was my first approach (using nodereference URL) but this failed, and I can't imagine that this hasn't been done before. – Shalan Jul 24 '11 at 20:39
  • What is your problem? What are you doing with node reference and what is failing? – Shoaib Nawaz Jul 24 '11 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.