27 Replies Latest reply on Aug 6, 2014 6:26 AM by craig.reeves

    Pop Up Login Problems

    zeaochoa

      <script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>

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

      <script src="http://buckwilson.me/lightboxme/jquery.lightbox_me.js" type="text/javascript" charset="utf-8"></script>

       

      i am trying to use lightbox_me but it seems to interfere with the drop down menus of jive disabling them it doesnt drop down anymore.

      crap.JPG

      Thanks to Craig Reeves i have my code for the login to put in my pop up. But i still have some issues to tackle down.

       

      I need the pop up to recognize that the user has already logged in, and make the pop up appear when the user who is viewing the pages isnt logged in. Craig Reeves already gave me an idea how to do this here is the code.

       

      <script type="text/javascript">

          $("#sign_up").lightbox_me({centered: true, preventScroll: true, onLoad: function() {

              $("#sign_up").find("input:first").focus();

          }});

      </script>

       

      this is my pop up script and below is the script given by Craig

       

      function testLogin() {

          if (window.parent._jive_current_user.ID == "-1") {

                alert("Logged out");

          } else {

                alert(window.parent._jive_current_user.ID);

          }

       

      }

       

       

      I dont really know how i can incorporate this he said to enclose it in a  function. but i have no idea where to put this.

       

      Thanks Guys i really need help.

        • Re: Pop Up Login Problems
          craig.reeves

          Hi Eric,

           

          This is the code I gave you in the other discussion on how to include the 'decision' code with your popup code.

           

          <script type="text/javascript">  
            if (window.parent._jive_current_user.ID == "-1") {  
             $("#sign_up").lightbox_me({centered: true, preventScroll: true, onLoad: function() {  
                  $("#sign_up").find("input:first").focus();  
              
             }
             });  
              } else {  
              alert("Welcome back!");  
              }   
          </script> 
          

           

          My next question would be what errors are shown in the developer console? In Chrome I press ctrl+shift+i to load the developer tools, then you can click the console tab to view any errors. Can you take a screenshot? It would help us to help you.

           

          devtools.PNG

           

          Thanks

          Craig

          • Re: Pop Up Login Problems
            zeaochoa

            Hi Craig,

             

            Hmmm can you help me where to put the codes in this list of themes, the code u gave me recently does not seem to work, i tried to do it today.

            picture.JPG

             

            Thanks

              • Re: Re: Pop Up Login Problems
                craig.reeves

                Hi Eric,

                 

                You can add it to navbar.soy - you will need to replace { with {lb} and } with {rb} in the code so that the templating engine parses it correctly:

                 

                <script type="text/javascript">    
                  if (window.parent._jive_current_user.ID == "-1") {lb}    
                  $j('#navLogin').trigger('click');  
                    {rb}   
                </script> 
                

                 

                Cheers

                Craig

                  • Re: Re: Re: Pop Up Login Problems
                    zeaochoa

                    Craig im really sorry about this thank you for all the help.

                     

                    Ok i have the lightbox_me from buck wilson it was working great except for the fact the external ajax and jquery is having conflict and disables the dropdown menu above.

                     

                    ill attach the whole code here and can you tell me where i went stupid or something im not really a developer i somehow understand things but at some parts im clueless.

                    I have attached the whole code here if you can look at it, this are the parts i want to attach in the theme itself.

                     

                    Hope this helps Thanks men im really new with this and i dont really have any formal training with Jive im just trying to figure out how things work but to no avail.

                     

                    Thank You

                      • Re: Re: Re: Pop Up Login Problems
                        craig.reeves

                        Hi Eric,

                         

                        Personally I would forget about that lightbox_me plugin from buck wilson (which looks like it was developed for a much earlier version of Jive) and use the built in method. Delete whatever you have added, and copy and paste the code I supplied into the navbar.soy template file which will cause it to exist on every page the nav bar is on.

                         

                        Hope this helps

                        Craig

                          • Re: Re: Re: Pop Up Login Problems
                            zeaochoa

                            Hi Craig,

                             

                            Okay scrapping buck wilsons lightbox_me, so i just put this in nav.soy

                             

                            1. <script type="text/javascript">     
                            2.   if (window.parent._jive_current_user.ID == "-1") {lb}     
                            3.   $j('#navLogin').trigger('click');   
                            4.     {rb}    
                            5. </script> 


                            ok ive tried to add it in nothing happens even if u click the login still goes to login.jspa it doesnt work, i looked at the satelliteNav.soy


                                    <ul id="j-satNav">

                                        <li class="login">

                                            <a href="{buildUrl('/login.jspa')|noAutoescape}" class="login" title="{i18nText('userbar.login.link')}">{i18nText('userbar.login.link')}</a>

                                        </li>

                             

                             

                                        {if $registrationLink.visible}

                                            <li class="register">

                                                <a href="{buildUrl('/login.jspa')|noAutoescape}" class="register" title="{i18nText($registrationLink.nameKey)}">{i18nText($registrationLink.nameKey)}</a>

                                            </li>

                                        {/if}

                                    </ul>

                             

                            I think it has something to do with this. any solutions for this. I have attached the whole satteliteNav.soy  if i am right this is the problem.

                              • Re: Pop Up Login Problems
                                craig.reeves

                                Hi Eric,

                                 

                                So we can see if the behaviour you are seeing is standard functionality or something custom, what version of Jive are you running - and is this on-prem or a cloud instance? Generally, you will be redirected to the login page if you don't have permission to access a page, so if you have guest mode disabled you will never be able to see the content and have a popup login. You also may have to clear the cache once you have modified the templates (browser and server side) before changes are detected. Another test you can do to verify that the code has loaded is to search the page source for the code you just added. If it exists and isn't working, then provide screenshots of the browser's console log to give us some clues.

                                 

                                Cheers

                                Craig

                                  • Re: Pop Up Login Problems
                                    zeaochoa

                                    Hi Craig,

                                     

                                    Ok Craig will try what you said, i dont really know if this is on-prem or cloud instance but i know that this is jive 7.

                                    On the clear cache i already did that on my side but i dont think i have permission to clear cache in on the server side.

                                    Will provide the screenshot for the developers console.

                                     

                                    Thanks

                                      • Re: Pop Up Login Problems
                                        craig.reeves

                                        Hi Eric,

                                         

                                        Could you also include the navbar.soy file that you modified inside the theme?

                                         

                                        Thanks

                                        Craig

                                          • Re: Pop Up Login Problems
                                            zeaochoa

                                            Hi Craig,

                                             

                                            There is nothing to screenshot in the dev console it does not have errors on it, one thing i noticed the code you have given me does not seem to appear i already cleared my cache, i dont really know how to do a server clear cache.

                                            Wait for it il attach the code from the navbar.soy

                                             

                                            Thanks for the help

                                              • Re: Pop Up Login Problems
                                                craig.reeves

                                                Thanks I will take a look tomorrow morning - hopefully I can help spot something

                                                  • Re: Pop Up Login Problems
                                                    craig.reeves

                                                    Hmm I thought I had responded to this already. Sorry!

                                                     

                                                    Okay so what I was suggesting was it looks like the code is in the wrong place inside the navbar.soy file. If you look there are template groupings, so I would look for the correct place to put it (probably through trial and error). I would start with the section that has your main navbar code, as that will appear on every page. You also don't need (I dont think) the {literal} tags around the code I gave you to paste in, it should work without.

                                                      • Re: Pop Up Login Problems
                                                        zeaochoa

                                                        Hi Craig,

                                                         

                                                        Sorry Craig, i just cant make it work, im trying to work on it by myself but to no avail, yep ive been doin the trial and error thing still no luck. I have even resorted to sorting out the j-pop in this community. but i cant seem to figure it out.

                                                         

                                                        Thanks for all the help

                                                          • Re: Pop Up Login Problems
                                                            craig.reeves

                                                            Hey Eric,

                                                             

                                                            Lets start off by going into your browser developer tools console:

                                                             

                                                            Screen Shot 2014-07-28 at 10.24.00.png

                                                             

                                                            In here you can type next to the little blue > icon.

                                                             

                                                            Put in this line (which triggers the popup) and press enter. You will need to be a guest in order for this to work:

                                                             

                                                            $j('#navLogin').trigger('click');


                                                            This should be the result:

                                                            Screen Shot 2014-07-28 at 10.26.08.png


                                                            If you can replicate this (try it on both the Jive community and on your own instance) then you will be able to see that the code you are adding in, is running correctly and actually triggering the popup. I would then move on to the navbar.soy file again, and putting in something to test the javascript is firing when we expect. Something like an alert("testing"); usually works quite well for that. I would also look at the source on the page and find some source code that also exists in the navbar.soy and put the javascript near to that. It's all a bit trial and error depending on how customised your theme is.


                                                            Hope this helps

                                                            Craig


                                                              • Re: Pop Up Login Problems
                                                                zeaochoa

                                                                Hi Craig,

                                                                 

                                                                Thanks for this, here is a screenshot of the UAT page and the Live one.

                                                                This is the UAT Dev Console, lots of errors.

                                                                UAT-dev-console.JPG

                                                                 

                                                                Then this is the Live Version of the community. Nothing comes up

                                                                live-gc.JPG

                                                                 

                                                                Thanks I will try again for the trial and error if it somehow works.

                                      • Re: Pop Up Login Problems
                                        zeaochoa

                                        Hi Craig,

                                         

                                        Okay, Question how can i call the jquery in Jive? if it already has its own lightbox or modal is there a way for me to call that and use it instead.

                                        I think it will be an easier solution rather than making thesame login as this one, i already have the code u have given me for the login, i can use that instead and just make a javascript to call the built in pop up within jive il just put inside the code for the login.

                                        Thank You for all the help Craig im sorry for all the confusion im not really a developer so please bear with me on this one.

                                         

                                        Thank You

                                          • Re: Pop Up Login Problems
                                            craig.reeves

                                            Hi Eric - no problem.

                                             

                                            So I have just taken a look on your UAT environment (deduced the URL based on the screenshots you provided) and it looks like your theme has been so heavily customised that they have removed the built in popup method. If you click the login button it redirects you to the login.jspa page. It looks like the functionality was removed by the theme designers. The change doesn't look like it will be too easy for a non-developer to implement because the theme is so heavily customised and I don't know myself where the functionality is introduced, so I would recommend going back to your developers and getting them to restore that functionality - they should be able to do it fairly simply for you.

                                              • Re: Pop Up Login Problems
                                                zeaochoa

                                                Hi Craig,

                                                 

                                                Thanks! They want me to use a diiferent lightbox now for this, anyway i know jquery libraries are already in jive i just need to know how to call it,

                                                il be using the code u have given me before and use that instead.

                                                  • Re: Pop Up Login Problems
                                                    craig.reeves

                                                    OK Eric - good luck I hope you manage to sort it. Let us know how you get on

                                                      • Re: Pop Up Login Problems
                                                        zeaochoa

                                                        Hi Craig,

                                                         

                                                        I finally have the solution il put this up here just in case someone will try to use it again.

                                                        This is the correct code to call the lightbox_me. Hope this helps for future use.

                                                        Thanks for helping me btw.

                                                         

                                                        {literal}

                                                         

                                                         

                                                            <script type="text/javascript">

                                                         

                                                         

                                                            $j(function(){

                                                         

                                                         

                                                                if (window.parent._jive_current_user.ID == "-1") { 

                                                         

                                                         

                                                                    $j("#sign_up").lightbox_me({ centered: true, preventScroll: true, onLoad: function() { 

                                                         

                                                         

                                                                            $j("#sign_up").find("input:first").focus(); 

                                                         

                                                         

                                                                        }

                                                         

                                                         

                                                                    }); 

                                                         

                                                         

                                                                } else { 

                                                         

                                                         

                                                                    alert("Welcome back!"); 

                                                         

                                                         

                                                                }

                                                         

                                                         

                                                            });

                                                         

                                                         

                                                            </script>

                                                         

                                                         

                                                        {/literal}

                                                          • Re: Pop Up Login Problems
                                                            craig.reeves

                                                            Hey Eric,

                                                             

                                                            Great news, I'm glad you managed to figure it out. Thanks for sharing the solution!

                                                             

                                                            I suggest though that the alert saying welcome back (if it isnt there just for debugging) will get really annoying as it loads on every page view.

                                                              • Re: Pop Up Login Problems
                                                                zeaochoa

                                                                Hi Craig,

                                                                 

                                                                Well unfortunately on my end its still not working but when i hit it in dev console it pops up, the alert helps actually but im sure anyone can modify that for their own purpose, il modify mine if it starts working on load of the page soon.

                                                                 

                                                                Thank You

                                                                  • Re: Pop Up Login Problems
                                                                    craig.reeves

                                                                    Great that it works from console - thats a good sign. It sounds like it might just be where you are including the code in your theme, I would try and find a common item that appears on every page and then look in your theme files for that item. All trial and error at this point

                                                                     

                                                                    Good luck!