Jump to content

Mindbody login code snippet into nav

Recommended Posts

Site URL: http://www.goodtimepilates.com/

Hi all,

 

I'm trying to add a code snippet that allows users to login into their Mindbody profiles into my squarespace via the top nav, using the method prescribed by the Mindbody directions here or this YouTube video here (both are the same directions). When I follow the directions (adding a link, pasting <script src...> into Link Title, putting placeholder url in Link), instead of a clickable text appearing that reads Login | Register, I get the "<script>" tag pushing everything aside (screenshot below), essentially Squarespace can't parse the code and is displaying it directly as is. Any idea why? 

 

Thank you!

Screen Shot 2021-04-23 at 9.35.50 AM.png

Edited by simacna
Link to comment

@tuanphanthanks, it's below, but my hunch is Squarespace's version is now 7.1 and the instructions given by Mindbody is for v7.0, that might be the culprit. Happy to add any other info for troubleshooting. 

 

 

 

<script src="https://widgets.mindbodyonline.com/javascripts/healcode.js" type="text/javascript"></script><healcode-widget data-version="0.2" data-link-class="loginRegister" data-site-id="100795" data-mb-site-id="658429" data-type="account-link" data-inner-html="Login | Register"  />

Edited by simacna
Link to comment
On 4/27/2021 at 6:33 AM, simacna said:

@tuanphanthanks, it's below, but my hunch is Squarespace's version is now 7.1 and the instructions given by Mindbody is for v7.0, that might be the culprit. Happy to add any other info for troubleshooting. 

 

 

 

<script src="https://widgets.mindbodyonline.com/javascripts/healcode.js" type="text/javascript"></script><healcode-widget data-version="0.2" data-link-class="loginRegister" data-site-id="100795" data-mb-site-id="658429" data-type="account-link" data-inner-html="Login | Register"  />

Can you check your site url? I can't access it.

 

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

@tuanphan Right now on the live website, for the registration I have it just as a link to another site. I'd like that to be a login button that works as a model (which happens if it embed the <iframe> i posted above into a <code> block and according to the instructions in the the link above, should work in the hacky way for squarespace v7.0 but I'm on v7.1 😞

Link to comment

Thanks for checking @creedon and they're right, the adding a calendar works, my issue is adding a Login|Register button on the navigation (https://support.mindbodyonline.com/s/article/Putting-a-Login-Register-link-in-the-navigation-on-SquareSpace-7-branded-web-tools-formerly-HealCode?language=en_US) which asks the <iframe> to be place in the Text field, this is where the parsing issue happens. Can you replicate the functionality on your Squarespace v7.1 too? That'd be amazing.

Link to comment

The method MB described will not work for v7.1.

They took advantage of an unintentional method of slipping code into a place where SS didn't intend in v7.0. SS fixed that in v7.1.

I have a solution for v7.1. It requires the business plan or above.

Please see Header Navigation Mindbody Login or Register Links Add.

Let us know how it goes.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 3 months later...
On 4/29/2021 at 1:20 PM, creedon said:

The method MB described will not work for v7.1.

They took advantage of an unintentional method of slipping code into a place where SS didn't intend in v7.0. SS fixed that in v7.1.

I have a solution for v7.1. It requires the business plan or above.

Add the following to Settings > Advanced > Code Injection > HEADER.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

Add the following to Settings > Advanced > Code Injection > FOOTER.

<script>

  $( ( ) => {
  
    /*
    
      add mindbody login register link to navigation
      
      Version    : 0.1d0
      
      SS Version : 7.1
      
      By         : Thomas Creedon < http://www.tomsWeb.consulting/ >
      
      */
      
    const dataSiteId = '100795';
    
    const dataMbSiteId = '658429';
    
    // do not change anything below, there be the borg here
    
    $( '<script src="https://widgets.mindbodyonline.com/javascripts/healcode.js" type="text/javascript"><\/script>' +
      
      '<healcode-widget data-version="0.2" data-link-class="loginRegister" data-site-id="' + dataSiteId + '" data-mb-site-id="' + dataMbSiteId + '" data-type="account-link" data-inner-html="Login | Register" />' )
    
      .appendTo ( '.header-nav-list, .header-menu-nav-folder-content' );
      
    $( 'healcode-widget:first' )
    
      .addClass ( 'header-nav-item header-nav-item--collection header-nav-item--active' )
      
      .attr ( 'data-animation-role', 'header-element' );
      
    $( 'healcode-widget:last' )
    
      .addClass ( 'container header-menu-nav-item header-menu-nav-item--collection' );
      
    } );
    
  </script>

This is for v7.1.

Let us know how it goes.

This works for me! But now it's affecting other widgets on my site. 😞

Link to comment
  • 3 months later...
  • 2 months later...

I did this code solution and it works. I have used it on two different sites. So far so good, and no conflicts. @lindz5223 I see you didn't use the code due to conflicts. Can you share more info?

My question. with the code @creedon created. How do I place the "Register" text to the left of the shopping car icon? Or at least on the same line as the menu. It puts it below the centered menu. Thank you!

https://www.providencepilatescenter.com/

Best,

Scott

Link to comment
On 3/10/2022 at 1:28 PM, indy said:

My question. with the code @creedon created. How do I place the "Register" text to the left of the shopping car icon?

My code won't do that. Could it be altered to perhaps do it? Maybe but that area of the header looks less forgiving for adding elements in. The navigation is a natural area as it was designed to accommodate a different number of elements.

Quote

Or at least on the same line as the menu. It puts it below the centered menu.

The wrapping is occurring because that area of the header is divided into 3 equal spots. When the navigation element exceed its 1/3 allocation of space the items wrap. You can turn that wrapping off but there may be unintended consequences.

Add the following to Design > Custom CSS.

.header-layout-nav-center .header-nav-list {

  flex-wrap : nowrap;
  
  }

This is for v7.1.

Let us know how it goes.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 7 months later...
On 4/29/2021 at 6:20 PM, creedon said:

The method MB described will not work for v7.1.

They took advantage of an unintentional method of slipping code into a place where SS didn't intend in v7.0. SS fixed that in v7.1.

I have a solution for v7.1. It requires the business plan or above.

Please see Add Mindbody Login Register Link to Navigation.

Let us know how it goes.

Hi there - firing up this question/solution again. This post is a bit of a mess sorry!

  • I'd like to Login | Register in the main nav only...any thoughts on what I am doing wrong? 
  • The Login | Register then disappears from the Main navigation but still appears very far down in the left corner. 

MY SITE: https://www.wearefixology.co.uk/book
PASSWORD: ruth

I've followed your steps: 

Header code:  <scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> 

However when I add the footer code - my calendar starts overlapping with random large bits of font - see attached. 

<script>$( ( ) => { 

 const dataSiteId = '[5728933]'; 

const dataMbSiteId = '[5728933]';     

// do not change anything below, there be the borg here 

    $( '<script src="https://widgets.mindbodyonline.com/javascripts/healcode.js" type="text/javascript"><\/script>' + 

      '<healcode-widget data-version="0.2" data-link-class="loginRegister" data-site-id="' + dataSiteId + '" data-mb-site-id="' + dataMbSiteId + '" data-type="account-link" data-inner-html="Login | Register" />' ) 

    .appendTo ( '.header-nav-list, .header-menu-nav-folder-content' ); 

    $( 'healcode-widget:first' ) 

      .addClass ( 'header-nav-item header-nav-item--collection header-nav-item--active' ) 

      .attr ( 'data-animation-role', 'header-element' ); 

    $( 'healcode-widget:last' ) 

      .addClass ( 'container header-menu-nav-item header-menu-nav-item--collection' ); 

    } ); 

Screenshot 2022-10-25 at 15.25.31.png

Screenshot 2022-10-25 at 15.36.47.png

Edited by TechyBecky_101
Missed some info
Link to comment

And this is my MINDBODY code:

<script src="https://widgets.mindbodyonline.com/javascripts/healcode.js" type="text/javascript"></script><healcode-widget data-version="0.2" data-link-class="loginRegister" data-site-id="110636" data-mb-site-id="5728933" data-bw-identity-site="false" data-type="account-link" data-inner-html="Login | Register"  />

Edited by TechyBecky_101
Edits
Link to comment
13 hours ago, TechyBecky_101 said:

Login | Register isn't in the header or footer at all now...

There are still syntax errors in the code. I suggest pasting in the my original code without editing out the blank lines and such. When you edit the code like that you risk breaking it.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 1 year later...
4 hours ago, laurenh432 said:

but now the other widgets on the site are being affected. How do I go about updating the code to not change my client's other widgets?

I have updated my cited code in my April 29, 2021 post.

From the changes...

  • only load script once and only if needed
  • fix for code messing up the layout of other mb widgets

Let us know how it goes.

@lindz5223

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.