Additional menu

Get MemberPress today! Start getting paid for the content you create! Get MemberPress Now

Adding Tabs to the Account Page

NOTE: We have an add-on for Plus and Pro users that automatically handles creating custom navigation tabs on the Account without the use of code. Documentation on how the add-on can be set up and configured can be found here: Installing & Configuring our Account Nav Tabs Add-on

For the code needed to accomplish this custom development, please see
this gist in GitHub.

That code can be used as a plugin, or you can cut out the commented items at the top and paste the code somewhere else like a functions.php file, or use the WPCode plugin (please check this article for details: How to add custom code snippets in WPCode). Lines 22 and on can be deleted as well if you just want to link to another page.

Adding More than One Tab

You need to edit the following:

<span class="mepr-nav-item prem-support">
  <a href="/account/?action=premium-support">Premium Support</a>
</span>

To something like:

<span class="mepr-nav-item prem-support <?php MeprAccountHelper::active_nav('premium-support'); ?>">
  <a href="/account/?action=premium-support">Premium Support</a>
</span>

<span>
  <a href="http://site.com/feedback/">Provide Feedback</a>
</span>

Here is a finished example with two new tabs. Tab 1 (Premium Support) keeps the user on the account page and shows them a Contact Form 7 form. Tab 2 (Provide Feedback) redirects the user to a separate page on your site where they can provide feedback.

function mepr_add_some_tabs($user) {
  ?>
    <span class="mepr-nav-item prem-support <?php MeprAccountHelper::active_nav('premium-support'); ?>">
      <!-- KEEPS THE USER ON THE ACCOUNT PAGE -->
      <a href="/account/?action=premium-support">Premium Support</a>
    </span>

    <span>
      <!-- REDIRECTS THE USER TO A DIFFERENT PAGE ON THE SITE -->
      <a href="http://site.com/feedback/">Provide Feedback</a>
    </span>
  <?php
}
add_action('mepr_account_nav', 'mepr_add_some_tabs');

function mepr_add_tabs_content($action) {
  //Listens for the "premium-support" action on the account page, before rendering the contact form shortcode.
  if($action == 'premium-support') {
    echo do_shortcode('[contact-form-7 id="49034" title="Premium Support Form"]');
  }
}
add_action('mepr_account_nav_content', 'mepr_add_tabs_content');
Was this article helpful?

Related Articles

computer girl

Get MemberPress today!

Start getting paid for the content you create.