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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Extension Permission Hook Changes with 4.6
Pages: [1]

Author Topic: Extension Permission Hook Changes with 4.6  (Read 610 times)

lee.gooding

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 1
    • Clear River Church
  • CiviCRM version: 4.5
  • CMS version: Drupal 7
  • MySQL version: 5.7
  • PHP version: 5.3
Extension Permission Hook Changes with 4.6
April 06, 2015, 11:51:34 am
I upgraded my test server to 4.6 and now permissions for my extensions are not loading properly. I get the following error on the drupal permissions page:
Warning: array_shift() expects parameter 1 to be array, string given in civicrm_permission() (line 66 of C:\xampp\htdocs\drupal\sites\all\modules\civicrm\drupal\civicrm.module).
Warning: array_shift() expects parameter 1 to be array, string given in civicrm_permission() (line 67 of C:\xampp\htdocs\drupal\sites\all\modules\civicrm\drupal\civicrm.module).

The permissions rows for my extensions are there, but there is no string showing for the permission name.

I tried changing how my permissions are set by modeling the format in CiviVolunteer, but that didn't seem to fix it. What am I missing?

Thanks!

lee.gooding

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 1
    • Clear River Church
  • CiviCRM version: 4.5
  • CMS version: Drupal 7
  • MySQL version: 5.7
  • PHP version: 5.3
Re: Extension Permission Hook Changes with 4.6
April 06, 2015, 12:08:16 pm
Solved my own problem. It had to do with a lack of description for the permission. In previous versions this would not throw an error. Now I use the following when setting my permissions:

 
Code: [Select]
       $prefix = ts('CiviCRM SmallGroup Tracking', array('domain' => 'org.namelessnetwork.smallgrouptracking')) . ': ';
        $permissions = array(
            'access SmallGroupTracking' => array(
                $prefix . ts('access SmallGroupTracking'),
                ts('View and select discipleship community groups, small groups, and add attendance records'),
            ),
            'edit SmallGroupTracking' => array(
                $prefix . ts('edit SmallGroupTracking'),
                ts('Manage the creation/deletion of Discipleship communities & small groups'),
            ),
        );

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Extension Permission Hook Changes with 4.6
April 06, 2015, 04:27:41 pm
Lee - A fix was submitted today by Andrew Hunt to accommodate both situations (permissions with or without description).

https://issues.civicrm.org/jira/browse/CRM-16230
https://github.com/civicrm/civicrm-core/pull/5561

It looks like you've updated your extension to pass arrays in any case, but wanted to update this here for others.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Extension Permission Hook Changes with 4.6

This forum was archived on 2017-11-26.