Hello, all.

Drupal newbie: I have Drupal8 up, and have created a content type with an attachment (eBook). The premise of the site is each node has a survey and a free eBook you can get if you complete the survey: the eBook should be visible if the user did the survey, and replaced by a "complete this survey" link if the user has not.

Can someone give me hints on making the link point to the book or the survey based on whether or not the user has completed the survey? I'm unclear if I'm trying to develop a block or a view or a theme or just supposed to find a "view hook" and write PHP code for it.

I know there's a rules project, a "business rules" project and a survey project, but before I go deeply into any of those I'd like to get a better idea of how it will tie together.

Richard

Comments

Kristi Wachter’s picture

There are often several ways to accomplish a particular goal in Drupal.

One idea that occurs to me would be using Views to display the download link on a separate page.

So you could try this:
* hide the attached file on the main page for each survey
* when a visitor completes a survey, have the completion/thank you page go to your view page, using the survey page's node id as an argument (something like thank-you/[nid] )
* include the link to the downloadable file in your view

Are you using the Webform module for your surveys? I think that would let you easily redirect to a view.

I hope that helps!

Kristi

˚ ˚ ˚ ˚ ˚
Kristi Wachter
Drupal consultant, evangelist, and enthusiast

rar2’s picture

Thanks, Kristi.

I'll take a look at views, then.

Richard