HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Download permissions

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#47035 (In Topic #10254)
Avatar

Community saint

How do I allow a guest to view a download but not be able to download it unless they register?

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
Posted
Rating:
#47053
Avatar

Hi,

There's no direct way to do this but you could fudge it with a template edit…

In DOWNLOAD_SCREEN see:

Code

         <div class="download_now">
            {+START,BOX,{!DOWNLOAD_NOW}}
               {+START,IF_PASSED,LICENCE_HYPERLINK}
               <p>
                  {!D_BEFORE_PROCEED_AGREE,{LICENCE_HYPERLINK}}
               </p>
               <a class="hide_button" href="#" onclick="hideTag(this.parentNode); return false;"><img title="" alt="{!EXPAND}/{!CONTRACT}" src="{$IMG*,expand}" /></a>
               
               <a class="hide_button non_link" href="#" onclick="hideTag(this.parentNode); return false;">{!I_AGREE}</a>
               <div class="hide_tag hide_button_spacing" style="display: {$JS_ON,none,block}">
               {+END}
               <div>
                  [ <a href="{$FIND_SCRIPT*,dload}?id={ID*}{$KEEP*,0,1}&amp;for_session={$SESSION_HASHED}">{!START}</a> ]<br />
                  {FILE_SIZE*}
                  <br />
                  {+START,IF_NON_EMPTY,{AUTHOR_URL}}
                     {!BY_SIMPLE,<a rel="author" href="{AUTHOR_URL*}" title="{!_AUTHOR,{AUTHOR*}}">{AUTHOR*}</a>}
                  {+END}
                  {+START,IF_EMPTY,{AUTHOR_URL}}{+START,IF_NON_EMPTY,{$USERNAME,{SUBMITTER}}}
                     {!BY_SIMPLE,<a href="{$MEMBER_PROFILE_LINK*,{SUBMITTER}}" title="{$USERNAME*,{SUBMITTER}}">{$USERNAME*,{SUBMITTER}}</a>}
                  {+END}{+END}
               </div>
               {+START,IF_PASSED,LICENCE_HYPERLINK}
               </div>
               {+END}
            {+END}
         </div>
and put:

Code

{+START,IF,{$NOT,{$IS_GUEST}}}
...
{+END}
around it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#47054
Avatar

That's the quick answer but if I were doing it myself I'd probably add something to the template that only shows to guests, to explain what's happening…

Code

{+START,IF,{$IS_GUEST}}
You need to <a href="{$PAGE_LINK*,:login}">login to download this</a>.
{+END}




If you only want certain downloads (let's say #1,#2 and #5) to have this….

Add some code at the top of the template:

Code

{$SET,restricted,{$EQ,{$_GET,id},1,2,5}}

And change the lines I gave you to be slightly more complex…

Code

{+START,IF,{$NOT,{$AND,{$IS_GUEST},{$GET,restricted}}}}
...
{+END}

Code

{+START,IF,{$AND,{$GET,restricted},{$IS_GUEST}}}
You need to <a href="{$PAGE_LINK*,:login}">login to download this</a>.
{+END}


(all this code is untested - just wrote it off the top of my head)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: