Issue at hand is shortcode output of permissions error. Anons and logged in users of all kinds can view whole list at ?page=CiviCRM&q=civicrm%2Fprofile&force=1&gid=14 without issue. Shortcode gives errors for all users including admin.

I went over the steps mentioned here Creating a public Members directory with CiviCRM in Wordpress using Profiles

Read http://book.civicrm.org/user/current/organising-your-data/profiles/ and http://wiki.civicrm.org/confluence/display/CRMDOC/Access+Control+Context+and+Overview multiple times

My situation is that anonymous users and logged in users of all kinds can access and search full list of members at ?page=CiviCRM&q=civicrm%2Fprofile&force=1&gid=14 without issue.

When logged in as admin Shortcode [civicrm component="profile" gid="14" mode="view"] outputs "Permission Denied You do not have permission to view this contact record. Contact the site administrator if you need assistance." Have also tried adding force="1" to shortcode to emulate url of successful view.

Calling in template while logged in <?php do_shortcode('[civicrm component="profile" gid="14" mode="view"]'); ?> outputs nothing at all.

When not logged in shortcode interrupts page drawing and outputs Sorry but we are not able to provide this at the moment. Could not find the required contact id parameter (id=) for viewing a contact record with a Profile.

Here are some steps I have taken: In WordPress Access Control under these items all levels including Anonymous are checked "CiviCRM: view all contacts" "CiviCRM: profile listings and forms" "CiviCRM: profile listings"

Anons cannot access "CiviCRM: profile create " and "CiviCRM: profile edit"

Under Manage Groups "Public Member List" has visibility "Public Pages" and types "Access Control, Mailing List".

Under Profiles I have "Public Directory List" used for "Standalone form or Directory" and "Search Views". Active is checked. "Limit listings to a specific Group?" is set to "Public Member List".

The Profile has two fields- first and last name. Both are set to Searchable, In Selector, and View Only. Required and Reserved are set to No. Preview button just outputs a heading and no data. Seems like that is unexpected behavior...

Created "Not Logged In" under "Manage ACL Roles"

Under "Assign Users to Roles" the assigned to only offers groups of Contacts. Setting this up for non-logged in users so they are not contacts... So confused.

Under "Manage ACLs" Role "Everyone" Operation "View" Type "Group" Which "Public Member List" Desc "View Profiles" Enabled "Yes"

I think that covers the issue.

9.24 Update:

Per @Andrei's advice I edited civicrm/includes/civicrm.shortcodes.php on line 626 I changed

elseif ($mode == 'view') { $args['q'] = 'civicrm/profile/view'; } 


elseif ($mode == 'view') { $args['q'] = 'civicrm/profile&force=1'; }

Interestingly I got no error but the output was not the group directory I expected:


**Update 9.25 **

Here is how I solved this for my templates:

First I used this call to fetch all groups. Dumped that data and got group ID of one I wanted. civicrm_api('Group','Get',array());

ID was 6. Now in my templates I use the following to print out the members of that group. I'm sure it could be more elegant but it does what I mean for it to do. :)

 require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/civicrm/civicrm.settings.php';
 require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/civicrm/civicrm/CRM/Core/Config.php';
 $config = CRM_Core_Config::singleton( );
 require_once $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/civicrm/civicrm/api/api.php';
 $group = civicrm_api('GroupContact','Get',array('group_id' => '6', 'options' => array('limit' => 1000), 'version' =>3));
 if ($group['values']) {
    foreach ($group['values'] as $k => $v) {
        $contact = civicrm_api('Contact','Get',array('contact_id' => $v['contact_id'], 'version' =>3));
        if ($contact) {
            //print_r($contact); exit;
            echo $contact['values'][$v['contact_id']]['display_name'] . '<br>';
  • 1
    I'm able to reproduce this when inserting the profile shortcode in mode="view" but it does work in mode="search" I'm not sure if I'm missing something or this is a bug. Same behaviour in Civi 4.6.4 and 4.6.8 WordPress 4.3
    – Andrei
    Commented Sep 23, 2015 at 22:15
  • 1
    About the timestamps what is saying is that there might be a mismatch between your timezones, you could check that either in you php.ini, wp-settings.php or mysql you will have to correct it, look for something like date.timezone (for php.ini ) or date_default_time_zone_set (for wp-settings.php) let me know if you need help with that.
    – Andrei
    Commented Sep 24, 2015 at 23:19
  • 1
    Regarding the shortcode outputting contacts from another group, I've tested it myself before posting and is working as expected in Civi 4.6.8. As I said is not a FIX, but you could try deleting the shortcode from the page, save the page, insert the shortcode again, save the page and test the directory . Those were the steps I did. My fault for no have warned you. Try that and see if it solves the issue, if not revert back the shortcode in civicrm.ahortcodes.php, from my side I will try to investigate and see what I can get.
    – Andrei
    Commented Sep 24, 2015 at 23:30

1 Answer 1


What I figured out is that when inserting the shortcode in mode "view" the URL is http://yoursite.com/civicrm/?page=CiviCRM&q=civicrm/profile/view&reset=1&force=1&gid=14 (which it will prompt you with an error) but the working URL is http://yoursite.com/civicrm/?page=CiviCRM&q=civicrm/profile&reset=1&force=1&gid=14 which outputs the directory and the search box, if you don't want the search box you could add &search=0 to the URL like this http://your site.com/civicrm/?page=CiviCRM&q=civicrm/profile&reset=1&search=0&force=1&gid=14 and it will output just the directory.

Resuming I don't think you are having an permission issue, or a miss configured setting, I believe is a Civi issue.

Please try those URLs and report back. If you confirm this behaviour, I think we could open an issue or try to figure out where the problem is.

  • Wow, thank you. You nailed that. The first URL generates errors whether logged in or not. The second two will both render whether logged in or not. So, at present AFAYK the short code is not usable for this? I just need to spit out a linked list of names for the group contacts. Commented Sep 24, 2015 at 2:50
  • 1
    The shortcode does work, I believe the problem with the mode="view" is that a contact id has to be passed in the URL like this: http://yoursite.com/civicrm/?page=CiviCRM&q=civicrm/profile/view&reset=1&id=N&gid=14 if you paste that in browser replacing the N with any Civi contact id it will output the data properly.
    – Andrei
    Commented Sep 24, 2015 at 8:57
  • 1
    A quick workaround would be to hardcode the URL when the shortcode is created under civicrm/includes/civicrm.shortcodes.php on line 626 Current code: elseif ($mode == 'view') { $args['q'] = 'civicrm/profile/view'; } Workaround: elseif ($mode == 'view') { $args['q'] = 'civicrm/profile&force=1'; } Please note this is not a FIX
    – Andrei
    Commented Sep 24, 2015 at 9:02
  • That had a fun effect but not one I was thinking it would. Screenshot added to post. :) Commented Sep 24, 2015 at 21:33
  • 1
    I really appreciate your time and help here! Just posted an update showing the way I got what I needed via API. Thank you again! Commented Sep 25, 2015 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.