0

I am converting my guitar lessons site to drupal. On my previous site, I displayed an audio link, and upon clicking it, one could play the audio if they were registered. If not registered they were taken to a page asking them to register, then redirected to the lesson. The audio was in a protected folder. I am trying to do similarly in drupal. Any tips on how to get started? I am new to drupal...

Here is what I think would be ideal:

  • For the lesson page, use selection rule (via panels, views, or whatever) to display the embedded audio for the registered user
  • For guest user, display the embedded audio player but via guest class use javascript so when they press play they are redirected to register page, then have them register with captcha then redirect to lesson page. Or simpler, for guest user, just display a "play" icon that takes them to register page.

Ideas?

Regards

1

You could create a views block for the anonymous user.

1) add a content path field

2) Under Rewrite results, rewrite the content path field and use it's token.

Ex: <a href="/user/register?destination=[path]"> <img src="/images/playbutton.jpg"></a>

Note: (the ?destination= tag, will send them to that page after registration).

3) Change the view access from permission to role and select anonymous user.

4) Add a contextual filter of nid(node ID), select provide default value, select content ID from url.

Then you could use panels, a block, or a view block, then just give it a role of authenticated and put your player there.

  • Ok, that makes sense. I was thinking that I would have a view for the common things that all users will see, then the audio view for registered vs anonymous, then use panels. One question though - what would I specify as path? Would it be node/% or simply [path]? Thanks! – Brian Huether Sep 8 '15 at 7:57
  • simply [path] because [path] is a token that contains the url. ex: node/1 or /lesson/1 if you are using a URL alias. So when you hover the link you should see /user/register?destination=/node/1 or /user/register?destination=/lesson/1 – No Sssweat Sep 8 '15 at 8:03
  • It's *slash not dash – Beebee Sep 8 '15 at 8:13
  • @BrianHuether if you're leveraging Panels, it should be easy, set the Pane visibility settings based on User: Role and your Audio player pane should be visible to Authenticated user, and your Play button views pane should be visible to Anonymous user. – Beebee Sep 8 '15 at 8:15
  • Ok, watching some tutorials now. All this makes sense conceptually, but I am trying to tie it all together. So far I haven't quite figured out when I need to do something in Panels, versus Views. But it will come together! Thanks – Brian Huether Sep 8 '15 at 12:58

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.