Answers.Body: <p>What I figured out is that when inserting the shortcode in mode "view" the URL is <code>http://yoursite.com/civicrm/?page=CiviCRM&amp;q=civicrm/profile/view&amp;reset=1&amp;force=1&amp;gid=14</code> (which it will prompt you with an error) but the working URL is <code>http://yoursite.com/civicrm/?page=CiviCRM&amp;q=civicrm/profile&amp;reset=1&amp;force=1&amp;gid=14</code> which  outputs the directory and the search box, if you don't want the search box you could add <code>&amp;search=0</code> to the URL like this <code>http://your site.com/civicrm/?page=CiviCRM&amp;q=civicrm/profile&amp;reset=1&amp;search=0&amp;force=1&amp;gid=14</code> and it will output just the directory.</p>
  
  <p>Resuming I don't think you are having an permission issue, or a miss configured setting, I believe is a Civi issue.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-24T02:50:33.533Z
Answers.Text: 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.
Answers.UserDisplayName: jerrygarciuh
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-24T08:57:41.147Z
Answers.Text: 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.
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-24T09:02:38.653Z
Answers.Text: 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**
Answers.UserDisplayName: Andrei
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-24T21:33:45.847Z
Answers.Text: That had a fun effect but not one I was thinking it would.  Screenshot added to post.  :)
Answers.UserDisplayName: jerrygarciuh
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-25T23:12:06.347Z
Answers.Text: 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!
Answers.UserDisplayName: jerrygarciuh
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-23T23:33:35.340Z
Answers.LastActivityDate: 2015-09-23T23:38:52.690Z
Answers.LastEditDate: 2015-09-23T23:38:52.690Z
Answers.UserDisplayName: Andrei
Body: <p>Issue at hand is shortcode output of permissions error.  Anons and logged in users of all kinds can view whole list at <code>?page=CiviCRM&amp;q=civicrm%2Fprofile&amp;force=1&amp;gid=14</code> without issue.  Shortcode gives errors for all users including admin.</p>
  
  <p>I went over the steps mentioned here <a href="https://civicrm.stackexchange.com/questions/2264/creating-a-public-members-directory-with-civicrm-in-wordpress-using-profiles">Creating a public Members directory with CiviCRM in Wordpress using Profiles</a></p>
  
  <p>Read <a href="http://book.civicrm.org/user/current/organising-your-data/profiles/" rel="nofollow noreferrer">http://book.civicrm.org/user/current/organising-your-data/profiles/</a> and
  <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Access+Control+Context+and+Overview" rel="nofollow noreferrer">http://wiki.civicrm.org/confluence/display/CRMDOC/Access+Control+Context+and+Overview</a> multiple times</p>
  
  <p>My situation is that anonymous users and logged in users of all kinds can access and search full list of members at <code>?page=CiviCRM&amp;q=civicrm%2Fprofile&amp;force=1&amp;gid=14</code> without issue.</p>
  
  <p>When logged in as admin Shortcode <code>[civicrm component="profile" gid="14" mode="view"]</code> 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.</p>
  
  <p>Calling in template while logged in <code>&lt;?php do_shortcode('[civicrm component="profile" gid="14" mode="view"]'); ?&gt;</code> outputs nothing at all.</p>
  
  <p>When not logged in shortcode interrupts page drawing and outputs <code>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.</code></p>
  
  <p>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"</p>
  
  <p>Anons cannot access "CiviCRM: profile create " and "CiviCRM: profile edit"</p>
  
  <p>Under Manage Groups "Public Member List" has visibility "Public Pages" and types "Access Control, Mailing List".  </p>
  
  <p>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".</p>
  
  <p>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...</p>
  
  <p>Created "Not Logged In" under "Manage ACL Roles" </p>
  
  <p>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.</p>
  
  <p>Under "Manage ACLs" Role "Everyone" Operation "View" Type "Group" Which "Public Member List" Desc "View Profiles" Enabled "Yes"</p>
  
  <p>I think that covers the issue.</p>
  
  <p><strong>9.24 Update:</strong></p>
  
  <p>Per @Andrei's advice I edited <code>civicrm/includes/civicrm.shortcodes.php</code> on line 626 I changed</p>
  
  <pre><code>elseif ($mode == 'view') { $args['q'] = 'civicrm/profile/view'; } 
  </code></pre>
  
  <p>to</p>
  
  <pre><code>elseif ($mode == 'view') { $args['q'] = 'civicrm/profile&amp;force=1'; }
  </code></pre>
  
  <p>Interestingly I got no error but the output was not the group directory I expected:</p>
  
  <p><a href="https://i.sstatic.net/UKNtg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UKNtg.png" alt="screenshot"></a></p>
  
  <p>**Update 9.25 **</p>
  
  <p>Here is how I solved this for my templates:</p>
  
  <p>First I used this call to fetch all groups.  Dumped that data and got group ID of one I wanted.  <code>civicrm_api('Group','Get',array());</code></p>
  
  <p>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. :)</p>
  
  <pre><code>&lt;?php
   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' =&gt; '6', 'options' =&gt; array('limit' =&gt; 1000), 'version' =&gt;3));
   if ($group['values']) {
      foreach ($group['values'] as $k =&gt; $v) {
          $contact = civicrm_api('Contact','Get',array('contact_id' =&gt; $v['contact_id'], 'version' =&gt;3));
          if ($contact) {
              //print_r($contact); exit;
              echo $contact['values'][$v['contact_id']]['display_name'] . '&lt;br&gt;';
          }
      }
   }
   ?&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-23T22:15:53.750Z
Comments.Text: 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
Comments.UserDisplayName: Andrei
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-24T23:19:26.470Z
Comments.Text: 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.
Comments.UserDisplayName: Andrei
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-24T23:30:10.553Z
Comments.Text: 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.
Comments.UserDisplayName: Andrei
Tags: <wordpress><profile><acl>
Title: Creating a public Members directory with CiviCRM in Wordpress using Profiles and shortcode
ThreadText: # Creating a public Members directory with CiviCRM in Wordpress using Profiles and shortcode
  
  (Asked by: username_0 on 2015-09-23)
  
  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](https://civicrm.stackexchange.com/questions/2264/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 @username_1's advice I edited `civicrm/includes/civicrm.shortcodes.php` on line 626 I changed
  
  ```
  elseif ($mode == 'view') { $args['q'] = 'civicrm/profile/view'; } 
  
  ```
  
  to
  
  ```
  elseif ($mode == 'view') { $args['q'] = 'civicrm/profile&force=1'; }
  
  ```
  
  Interestingly I got no error but the output was not the group directory I expected:
  
  [![screenshot](https://i.sstatic.net/UKNtg.png)](https://i.sstatic.net/UKNtg.png)
  
  \*\*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. :)
  
  ```
  <?php
   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>';
          }
      }
   }
   ?>
  
  ```
  
  **Tags:** wordpress, profile, acl
  
  > **Comments:**
  > **username_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  
  > **username_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.  
  > **username_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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-23. Score: 4 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_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.  
  > **username_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**  
  > **username_0**: That had a fun effect but not one I was thinking it would.  Screenshot added to post.  :)  
  > **username_0**: 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!  
  
  ---
  
  