CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • CiviContribute Permissions
Pages: [1]

Author Topic: CiviContribute Permissions  (Read 582 times)

Kathryn531

  • Guest
CiviContribute Permissions
July 14, 2010, 03:17:48 pm
I've built a Drupal 6.16 site running CiviCRM 3 and am using CiviContribute forms in several instances to collect member dues & contributions. I'd like to allow anonymous users to use all of the CiviContribute forms but one. This form in particular should only be accessible by logged-in, authenticated users.

I haven't been able to find a way to designate specific permissions based on an individual form level. Anonymous users can either access all of the contribution forms or none of them. Is there a way to control access to on a form-specific basis? Any help would be appreciated.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: CiviContribute Permissions
July 14, 2010, 10:48:04 pm
Yes there is, there is a way to detect if someone is not logged in and hide he form from them, but you need to create a custom .tpl.  This is not too terribly hard, but does require some know how of the system and how it works.  If you are not a programmer, this may sound like greek to you and you might want to consider hiring someone to make this 1/2 hour to 1 hour change for you.

Create a custom tpl directory, if you don't have one already.  Docs: http://wiki.civicrm.org/confluence/display/CRMDOC/Directories

Add this code to the top of CRM\Contribute\Form\Contribution\X\MembershipBlock.tpl, where X and Y are references the Contribution page ID numbers, such as "1" or "5" or whatever it is on your setup.

Code: [Select]
{if $session->get('userID') == 0 AND $smarty.get.id == X }

<div class="messages status">

To renew online, please <a href="/user">login</a> first.

</div>

{elseif $session->get('userID') == 0 AND $smarty.get.id == Y }

<div class="messages status">

Welcome!<br>

If you are already a member and here to renew, please <a href="/user">login</a> and <a href="/civicrm/contribute/transact?reset=1&id=5">renew here</a>.

</div>

{/if}
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Kathryn531

  • Guest
Re: CiviContribute Permissions
July 15, 2010, 12:10:39 pm
Thanks, Stoob.

Your solution worked for me, although instead of using the MembershipBlock.tpl I used the forms' Main.tpl template. Worked brilliantly.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • CiviContribute Permissions

This forum was archived on 2017-11-26.