1

I have a wordpress page with a user-dashboard shortcode embedded in it ([civicrm component="user-dashboard" hijack="0"]). When logged in, it works fine. When using a private window (and a user id and checksum) I get told I must be logged in to view the page.

I assumed that I had forgotten to set the permission for anonymous users and the user-dashboard, but it seems I have that set correctly: permissions for user dashboard I assume I'm missing something else obvious, but web searches (including this database) have revealed nothing. I would love an answer or even a suggestion of where to look.

Based on the suggestion below, I've added some debug code to the user-dashboard:

  public function __construct() {
parent::__construct();
echo "<!-- " . CRM_Core_Permission::check('access Contact Dashboard') . " -->\n";
if (!CRM_Core_Permission::check('access Contact Dashboard')) {
  CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
}

$this->_contactId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$userID = CRM_Core_Session::singleton()->getLoggedInContactID();

echo "<!-- userID:" . $userID . " -->\n";
$userChecksum = $this->getUserChecksum();
echo "<!-- userChecksum:" . $userChecksum . " -->\n";

I was somewhat surprised to see that the checksum and cid aren't making it there:

<!-- 1 -->
<!-- userID: -->
<!-- userChecksum: -->
<div id="crm-container" class="crm-container" lang="en" xml:lang="en">

Now, this is a Wordpress page, not a civiCRM page, but I assumed that since there is a shortcode to add the user-dashboard, that these values would come through as well. Am I deluded in thinking this?

For completeness, here is the (slightly redacted) url: https://mywebsite.com/workshop-registration/?aca11184e16a867aeee5f317ab706f58_1570552008_1440&cid=2

I also tried this one just in case: https://mywebsite.com/workshop-registration/?cs=aca11184e16a867aeee5f317ab706f58_1570552008_1440&cid=2

  • Try adding in some debugging lines in CRM/Contact/Page/View/UserDashBoard.php to see what it doesn't like. There's a couple different checks in construct() there. You said you have an id and checksum, but maybe something's not matching up. – Demerit Oct 8 at 17:54
  • 1
    Based on your update try using the cs= version but change cid to id. – Demerit Oct 8 at 21:04
  • Thanks Demerit. I did that and got in. Howevcer, I discovered in the process a strange inconsistency that I guess emerges from the fact that CiviCRM didn't start on WP. In a WP page, it indeed needs to be 'id'. However, in CiviCRM it is definitely cid. This creates a weird situation where I have to do some fancy dancing with PHP code snippets embedded in the background. Probably the simplest solution is going to be to give in and create accounts for everyone. Not really what I want to do. – Keith Nunn Oct 9 at 21:00
  • It's not a WP vs civi thing. The user dashboard page is looking for id in the url if there is no logged in user. – Demerit Oct 9 at 21:03
  • but in Civi, 'id' is used in the GET string to select an event or contribution page and 'cid' is used for the client id. For example: https://mysite.com/?page=CiviCRM&q=civicrm%2Fevent%2Fregister&reset=1&id=2 points to event page 2 – Keith Nunn Oct 9 at 21:09
2

So, to close the loop on this, the answer is this:

  1. inside WP, but outside CiviCRM, the checksum and cid need to be identified on the GET string as cs and id respectively
  2. inside CiviCRM, the checksum stands alone (no separate variable, though it seems to work as cs too) and the client id must be cid as id is used for other purposes in CiviCRM.

I discovered no way to cleanly pass these values through a page. I used a PHP insertion plugin to Wordpress to extract the values from the $_GET global array and pass them back into the page.

Thanks to Demerit in helping me figure this out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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