Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By STmainiac on
I want to create a Contact Author From.
I have created a webform for a content type. I want to insert a button into the content display which a user can click on that brings up a webform to contact that content author.
I am struggling to get the button to open the webform, and how do I assign the author?
Comments
Are you able to code som
Are you able to code some simple Javascript? Otherwise I don't think you will be able to accomplish that.
I like cookies!
I don't understand, when the
I don't understand, when the user clicks on the button, does the Webform suppose to dynamically appear on the page or are you refreshing the page to display the webform?
Simple Solution:
Simple Solution:
1) Copy the node.tpl.php in your theme.
2)Rename it node--"yourContentTypeMachineName".tpl.php
for example my custom file is now node--job_opening.tpl.php
3) To test it out write some text(anything) in your new template file.
4)Paste your new node.tpl file back in you theme folder
5)Clear all cache
if you go back to the content node on your Dupal site you should see the text you wrote in the file
More Dynamic Solution:
You can use hook_node_view hook add new variable for your link or button that linked to Author contact form. You have to add a template file page--YOUR_CONTENT_TYPE.tpl.php and place the link inside new created template. Clear cache. you will see the newly added content.
Look at Drupal 7 Template Suggestions.
Wow .. I don't want to see
Wow .. I don't want to see your complicated version then. :D ..
I like cookies!