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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Drupal roles & CiviCRM roles - menu items
Pages: [1]

Author Topic: Drupal roles & CiviCRM roles - menu items  (Read 2487 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Drupal roles & CiviCRM roles - menu items
February 21, 2008, 04:51:07 pm
Hi,

I'm looking to have menus in Drupal dependent on permissions - i.e. a link to search for contacts for people with rights to do so. I have found that there is a Drupal module:

http://drupal.org/project/menu_per_role

I'm wondering though - I guess it uses Drupal groups. Does this mean I need to maintain Drupal groups for this function and CiviCRM groups for other permissions - is this the best approach?

On a related note. I'd like to have a link that only shows (the register now link) to authorised users - how would I best approach this. I see I could create a .tpl file instead of using the default form - is that the go? Where should I look to figure out what code to use to test the user's role.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Drupal roles & CiviCRM roles - menu items
February 24, 2008, 01:41:29 pm
I have implemented the menu per role module & it's good - plus my concern about maintaining Drupal groups was not required as I need to anyway for ACLs.

But - I'm still trying to work out the other question here. I want everyone to see the listings but only authnticated users to be able to enrol. At the moment the register link shows for both but doesn't work for non-authenticated users.

One idea seems to be if I could edit the page so that the register now link shows if they are authenticated (or have rights to register) and otherwise a message or a link to create an account shows.

Can someone point me in the right direction to implement this. I'm sure I found a fairly specific post on doing it once in the wiki but I've searched and couldn't find it again
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Drupal roles & CiviCRM roles - menu items
February 24, 2008, 01:51:16 pm

here's a patch to show the register now link to only authenticated users. You can hack the template to deal with other cases.

Code: [Select]
svn diff templates/CRM/Event/Page/EventInfo.tpl
Index: templates/CRM/Event/Page/EventInfo.tpl
===================================================================
--- templates/CRM/Event/Page/EventInfo.tpl      (revision 13407)
+++ templates/CRM/Event/Page/EventInfo.tpl      (working copy)
@@ -85,6 +85,7 @@
 
     {include file="CRM/Contact/Page/View/InlineCustomData.tpl" mainEditForm=1}
 
+{if $session->get( 'ufID' )}
     {* Show link to Event Registration page if event if configured for online reg AND we are NOT coming from Contact Dashboard (CRM-2046) *}
     {if $is_online_registration AND $context NEQ 'dashboard'}
         <div class="action-link">
@@ -92,6 +93,8 @@
         </div>
     {/if}
        </div>
+{/if}
+
     <div class="action-link">
          {capture assign=icalFile}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`"}{/capture}
          {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&page=1&id=`$event.id`"}{/capture}
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Drupal roles & CiviCRM roles - menu items
February 24, 2008, 05:01:55 pm
Yay - that's what I needed! Am I right in thinking that for general use (i.e. to be part of the build) the if would need to test for the permission to register & edit profiles rather than whether or not the person is authenticated?
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Drupal roles & CiviCRM roles - menu items
February 24, 2008, 05:28:43 pm

the permission to register for an event is set at the drupal level, so that conditional should not be part of the template. the template is hacked to make it suit your case (so it wont really become part of the build that way)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Drupal roles & CiviCRM roles - menu items
February 27, 2008, 01:23:12 am
Hi all - if you read the earlier part of this thread please note the Menu per role is NOT compatible with CiviCRM at this stage.

It's nice but nasty
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Drupal roles & CiviCRM roles - menu items

This forum was archived on 2017-11-26.