Answers.Body: <p>If you only want to customize the layout, you can override the Smarty template file. This is usually not recommended in CiviCRM, because it complicates upgrades and maintenance, but this specific template is fairly safe (most templates have too much logic/code in them and change often). You can also include custom JavaScript in templates (between 'literal' tags). It's not very elegant but it works.</p>
  <p>The <a href="https://docs.civicrm.org/dev/en/latest/framework/templates/customizing/" rel="nofollow noreferrer">official docs page about customizing templates</a> is surprisingly complicated, but covers the basics: under Administration &gt; System Settings &gt; Paths, set  a path for custom smarty templates. Then copy the original &quot;tpl&quot; in there. You can also create a custom extension (ex: for all customizations of a site). You will probably need to at some point, for other types of customizations as described below.</p>
  <p>It is also possible to modify the contents of the dashboard, such as to include custom sections. I often add links to &quot;My profile&quot; or &quot;My certifications&quot;, things like that.</p>
  <p>This can be done using the <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_pageRun/" rel="nofollow noreferrer">pageRun hook</a> and then matching the <code>CRM_Contact_Page_View_UserDashBoard</code> page name.</p>
  <p>For example:</p>
  <pre><code>function myext_civicrm_pageRun(&amp;$page) {
    $pageName = get_class($page);
  
    if ($pageName == 'CRM_Contact_Page_View_UserDashBoard') {
      CRM_Myext_Utils_DashboardLinks::addLinks($page);
    }
  }
  </code></pre>
  <p>and the class:</p>
  <pre><code>class Myext_Utils_DasboardLinks {
  
    public static function addLinks(&amp;page) {
        $links = [
          [
            'title' =&gt; E::ts('Modify your username, password or e-mail address'),
            'url' =&gt; ($uid ? url(&quot;user/$uid/edit&quot;, ['query' =&gt; ['destination' =&gt; &quot;user/$uid&quot;]]) : ''),
            'icon' =&gt; 'fa-user-circle',
          ],
          [
            'title' =&gt; E::ts('Update your profile (contact information) and communication preferences'),
            'url' =&gt;CRM_Utils_System::urll(&quot;civicrm/profile-update&quot;, ['cid' =&gt; $dashboard_contact_id]),
            'icon' =&gt; 'fa-address-card',
          ];
      ];
  
      self::addElement([
        'class' =&gt; 'crm-dashboard-updates',
        'sectionTitle' =&gt; E::ts('Updates'),
        'templatePath' =&gt; 'CRM/Myext/Contact/Page/View/UserDashBoard/MyLinks.tpl',
        'links' =&gt; $links,
      ]);
    }
  
    /**
     *
     */
    public static function addElement($element) {
      $smarty = CRM_Core_Smarty::singleton();
      $dashboardElements = $smarty-&gt;_tpl_vars['dashboardElements'];
      $dashboardElements[] = $element;
      $smarty-&gt;assign('dashboardElements', $dashboardElements);
    }
  </code></pre>
  <p>The above is a bad copy-paste of old custom code. You will have to adapt for your requirements.</p>
  <p>Finally, there is the issue of re-ordering dashboard items, without rewriting the entire template or custom code. The <a href="https://lab.civicrm.org/extensions/reorderdashboard" rel="nofollow noreferrer">reorder dashboard</a> extension might help.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-31T15:04:20.253Z
Answers.LastActivityDate: 2021-07-31T15:04:20.253Z
Answers.UserDisplayName: bgm
Body: <p>I am working on 4.7 on Wordpress 4.6 and I trying to customize the User Dashboard in the Frontend shown for the request myURL.com/civicrm/?page=CiviCRM&amp;q=civicrm%2Fuser&amp;reset=1.</p>
  
  <p>First I looked at the hook civicrm_dashboard and civicrm_summary, but those are used for different pages. It seems I can hook into that page with the hook civicrm_pageRun filtering for the page "CRM_Contact_Page_View_UserDashBoard".</p>
  
  <ol>
  <li>How can I add content or modify content on the page object?</li>
  <li>Where can I find documentation of the page object?</li>
  <li>How would I change the HTML Table on the UserDasboard to DIVs to have separate tabs for Contributions, Events, Memberships, etc. ?</li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-04T03:02:57.007Z
Comments.Text: Have you tried [`altercontent`](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterContent/) hook? With this, you can modify the display of any civicrm page.
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-03T05:37:04.443Z
Comments.Text: want to add above as an answer Jitendra
Comments.UserDisplayName: petednz - fuzion
Tags: <extension><user-dashboard>
Title: How can I customize the User Dashboard (Frontend)
ThreadText: # How can I customize the User Dashboard (Frontend)
  
  (Asked by: username_0 on 2016-09-03)
  
  I am working on 4.7 on Wordpress 4.6 and I trying to customize the User Dashboard in the Frontend shown for the request myURL.com/civicrm/?page=CiviCRM&q=civicrm%2Fuser&reset=1.
  
  First I looked at the hook civicrm\_dashboard and civicrm\_summary, but those are used for different pages. It seems I can hook into that page with the hook civicrm\_pageRun filtering for the page "CRM\_Contact\_Page\_View\_UserDashBoard".
  
  1. How can I add content or modify content on the page object?
  2. Where can I find documentation of the page object?
  3. How would I change the HTML Table on the UserDasboard to DIVs to have separate tabs for Contributions, Events, Memberships, etc. ?
  
  **Tags:** extension, user-dashboard
  
  > **Comments:**
  > **username_1**: Have you tried [`altercontent`](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterContent/) hook? With this, you can modify the display of any civicrm page.  
  > **username_2**: want to add above as an answer Jitendra  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2021-07-31. Score: 3
  
  If you only want to customize the layout, you can override the Smarty template file. This is usually not recommended in CiviCRM, because it complicates upgrades and maintenance, but this specific template is fairly safe (most templates have too much logic/code in them and change often). You can also include custom JavaScript in templates (between 'literal' tags). It's not very elegant but it works.
  The official docs page about customizing templates is surprisingly complicated, but covers the basics: under Administration > System Settings > Paths, set  a path for custom smarty templates. Then copy the original "tpl" in there. You can also create a custom extension (ex: for all customizations of a site). You will probably need to at some point, for other types of customizations as described below.
  It is also possible to modify the contents of the dashboard, such as to include custom sections. I often add links to "My profile" or "My certifications", things like that.
  This can be done using the pageRun hook and then matching the CRM_Contact_Page_View_UserDashBoard page name.
  For example:
  function myext_civicrm_pageRun(&$page) {
    $pageName = get_class($page);
  
    if ($pageName == 'CRM_Contact_Page_View_UserDashBoard') {
      CRM_Myext_Utils_DashboardLinks::addLinks($page);
    }
  }
  
  and the class:
  class Myext_Utils_DasboardLinks {
  
    public static function addLinks(&page) {
        $links = [
          [
            'title' => E::ts('Modify your username, password or e-mail address'),
            'url' => ($uid ? url("user/$uid/edit", ['query' => ['destination' => "user/$uid"]]) : ''),
            'icon' => 'fa-user-circle',
          ],
          [
            'title' => E::ts('Update your profile (contact information) and communication preferences'),
            'url' =>CRM_Utils_System::urll("civicrm/profile-update", ['cid' => $dashboard_contact_id]),
            'icon' => 'fa-address-card',
          ];
      ];
  
      self::addElement([
        'class' => 'crm-dashboard-updates',
        'sectionTitle' => E::ts('Updates'),
        'templatePath' => 'CRM/Myext/Contact/Page/View/UserDashBoard/MyLinks.tpl',
        'links' => $links,
      ]);
    }
  
    /**
     *
     */
    public static function addElement($element) {
      $smarty = CRM_Core_Smarty::singleton();
      $dashboardElements = $smarty->_tpl_vars['dashboardElements'];
      $dashboardElements[] = $element;
      $smarty->assign('dashboardElements', $dashboardElements);
    }
  
  The above is a bad copy-paste of old custom code. You will have to adapt for your requirements.
  Finally, there is the issue of re-ordering dashboard items, without rewriting the entire template or custom code. The reorder dashboard extension might help.
  
  
  ---
  
  