For a registered user, he will need on WordPress to navigate through the WP top bar, go to his profile and then click on 'CiviCRM Profile' to access his own contact. The CiviCRM link in Breadcrumb brings to the dashboard but I need them to access their own contact.

I'm looking for a way to make this easier and accessible through the CiviCRM menu bar. I know how to add a custom link but how can I customize the link based on:


From wordpress using custom php it's easy but once connected, how does it work?

How do I make the <contact_id> variable being replaced in the URL?


One way to do this is:

  1. Create an extension.
  2. Make up a url like civicrm/mymenu/contactrecord.
  3. Create a page for your extension that uses your url, e.g. civix generate:page MyPage civicrm/mymenu/contactrecord
  4. Inside the page run() method, put code that does CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . CRM_Core_Session::getLoggedInContactID()));
  5. You might want to check if the logged in contact is null first and do something else.

Now anyone can visit /civicrm/mymenu/contactrecord and it will go to their contact record.

Lastly, I know you're on wordpress, but for others for drupal there is https://github.com/compucorp/uk.co.compucorp.usermenu which adds a menu with a link but note that it goes to the drupal user account, not the civi contact record.

  • My question should have been (EDITED) how to replace <contact-id> in the URL to create the menu: domain.net/wp-admin/…>. Is this possible? Oct 25 at 14:44
  • Maybe I'm not understanding. Are you asking "How do I make a civicrm extension to insert a custom menu link"? And I'm not clear now on what you meant by "From wordpress using custom php it's easy" - before I thought you meant you already have a way to make the menu link, but just need to know how to get the logged in user's contact id.
    – Demerit
    Oct 25 at 15:07
  • My need is actually to add a new Menu to the Menu bar that brings to one's own profile. Oct 25 at 16:55
  • 1
    Ok have updated answer.
    – Demerit
    Oct 25 at 17:35
  • great! we start immediately :-) I thought first it was possible through the UI but an extension is also ok. thanks Oct 27 at 10:11

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.