The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Toolbar hidden for guests

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Solved Toolbar hidden for guests

Post by Kami-sama on Thu Jun 22 2017, 00:37

Hey everyone!

Sooooo, this is an easy one. Is it possible to hide toolbar for guests?


Last edited by Kami-sama on Thu Jun 22 2017, 15:59; edited 1 time in total
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Draxion on Thu Jun 22 2017, 00:49

Yes, it's possible via JavaScript.

You can use the variable '_userdata["session_logged_in"]' if you understand how.

Something like this.
Code:
$(document).ready(function() {
  if (_userdata["session_logged_in"] == 0) {
    $('#fa_toolbar').css('display', 'none !important');
});


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1696
Reputation : 223
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Thu Jun 22 2017, 00:55

Hello Draxion,

Thank you for the response. I have tried this already, but it does not work for me.
(successfully have hidden some other elements already)
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Thu Jun 22 2017, 06:14

Hi,

The code posted by Draxion should work. Try this one:
Code:

$(function(){
if(!_userdata.session_logged_in && $("#fa_toolbar").length){
$("#fa_toolbar").remove();
};
})
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Thu Jun 22 2017, 13:52

Wolfuryo, your code works!! Very Happy
With
Code:
$("#fa_toolbar").length
you are checking if toolbar is there?
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Thu Jun 22 2017, 14:10

Yes. $("#fa_toolbar") returns the element with the id fa_toolbar. Then I check it's length property. If an element with that id exists, then length is 1, otherwise it is 0.
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Thu Jun 22 2017, 14:12

One last question. Whys is the
Code:
$(function(){
needed, if I am placing the code in
Code:
$(document).ready(function(){
. Tested this. Without the function it does not work.
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Thu Jun 22 2017, 15:15

Code:
$(function(){
is a shorthand of
Code:
$(document).ready(function(){
. Basically, they do the same thing:they execute the code in them when the page fully loads.
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Thu Jun 22 2017, 15:48

Yes, do you know why the code is not working like this?
Code:
$(document).ready(function() {
if(!_userdata.session_logged_in && $("#fa_toolbar").length){
$("#fa_toolbar").remove();
};
});
I it is the same, it should work like this, but it does not for some reason. Tested. Only works like this:
Code:
$(document).ready(function() {
$(function(){
if(!_userdata.session_logged_in && $("#fa_toolbar").length){
$("#fa_toolbar").remove();
};
});
})


avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Thu Jun 22 2017, 15:56

Hmm, that's strange. The second code executes itself later than the first one. I think that the toolbar is inserted in the forum by javascript(which is kinda stupid).
Basically, $(document).ready(function() waits for the html elements to load. After that $(function() waits for the elements inserted by JS to load. That's the reason why the first code is not working. You can have those two lines in any order and you can even have them like this:
Code:
$(function(){
$(function(){
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Thu Jun 22 2017, 15:59

Yeah, that makes sense. (to do execution when elements are loaded)
Thanks! I learned a lot! Never really learned Java before ;D only by using forum started to nibble on it. Before that I only worked with C++ and other boring stuff Very Happy
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Thu Jun 22 2017, 16:02

Same with me, I started learning JS and other web-related stuff when I discovered forums. I think javascript is easier than C++, but that's just my opinion. Anyway, good luck with your forum Smile
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by brandon_g on Thu Jun 22 2017, 17:00

Thanks for the help again Wolfuryo. Smile

Topic solved & archived ~ brandon_g
Please read our forum rules: ESF General Rules


Remember to mark your topic when a solution is found.
avatar
brandon_g
Support Moderator
Support Moderator

Male Posts : 5937
Reputation : 547
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by SLGray on Thu Jun 22 2017, 20:11

I have opened this topic to add some information. If you mean the toolbar at the top of the forum, you can not hide/remove with coding since it contains a Forumotion copyright. This means even for a certain group.

Topic re-opened by request.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 40171
Reputation : 2714
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 12:10

Hey again!

So to have it properly and following the term I adjusted Toolbar with CSS (unsuccesfully)
I am trying to hide the right side completely for guest users.
I tried
Code:
#fa_right
no luck
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 14:12

@SLGray, it's not illegal to remove a part of the toolbar, it is just kind of illegal to remove the copyright(left side. I say kind of illegal because you won't get arrested or anything like that for doing it. @Kami-sama, this code should hide the right side:
Code:
body #fa_right{
display:none !important;
}
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 14:14

Hey Wink

Yeah I am trying to hide it for guest only.
If you remember, you suggested the code to specify URLS and ELEMENTS to hide.
I am using that. Adding the element there, but no go....
Code:
var elements=[".rightHeaderLink", "#info_closed", "#info_open", "#ptrafic_closed", "#ptrafic_open", ".mainmenu", "#fa_ticker_block", "#fa_right"];
    var len1=pages.length, len2=elements.length, j=0;
    for(var i=0;i<len1;i++){
       if(document.URL.indexOf(pages[i]) >= 0){
          j=1;
          break;
        };
    };
    if(j){
       for(var i=0;i<len2;i++){
          $(elements[i]).hide();
        };
    };
  });
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 14:20

Try replacing that code with:
Code:
        var elements=[".rightHeaderLink", "#info_closed", "#info_open", "#ptrafic_closed", "#ptrafic_open", ".mainmenu", "#fa_ticker_block", "#fa_right"];
            var len1=pages.length, len2=elements.length, j=0;
            for(var i=0;i<len1;i++){
              if(document.URL.indexOf(pages[i]) >= 0){
                  j=1;
                  break;
                };
            };
            if(j){
              for(var i=0;i<len2;i++){
                  $("body "+elements[i]).css("display":"none !important");
                };
            };
          });
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 14:25

Nop. That does not work at all.
Tried adding just
Code:
.css("display":"none !important");
- same not working at all
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 14:44

The code seems ok. The problem is that jquery seems to ignore the !important. Try this code:
Code:
if(!_userdata.session_logged_in && $("#fa_right").length){
$("head").append("<style>body #fa_right{display:none !important;}</style>");
}

If you need to hide it only on specific pages:
Code:

var pages=[];
if(!_userdata.session_logged_in && $("#fa_right").length && $.inArray(document.URL, pages)==-1){
$("head").append("<style>body #fa_right{display:none !important;}</style>");
}
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 14:50

Hmmm same. I wonder if my Toolbar styling is interfering with this...
Code:
#fa_toolbar_hidden {
  background: none!important;
  background-image: url("http://i.solidfiles.net/70643ae713.png")!important;
 
}
#live_notif .fa_notification .content  {
  background-image: url("http://i.solidfiles.net/65f2ed22d0.png")!important;
  height: 80px!important;
  padding-left: 70px!important;
  overflow: visible!important;
}
#fa_usermenu {
  font-size: 10px!important;
}
#fa_usermenu img {
  border-radius: 50%;
  box-shadow: 0 2px 3px rgba(0,0,0,0.3), 0 -1px 1px rgba(0,0,0,0.3);
}
#fa_toolbar {
  background: none!important;
}
#notif_unread {
  color: #6c458d!important;
}
#notif_list li a.delete {
  background: none!important;
  background-image: url("http://hitsk.in/t/15/23/85/i_topic_delete.png")!important;
  height: 20px!important;
  width: 20px!important;
}
#fa_right, #fa_menulist, #notif_list {
  background: none!important;
  background-image: url("http://i.solidfiles.net/70643ae713.png")!important;
  border-bottom-left-radius: 3em;
  border: 4px double white!important;
}
#fa_toolbar #fa_right #notif_list li.see_all {
  background: none!important;
  background-image: url("http://i.solidfiles.net/70643ae713.png")!important;
  border-bottom-left-radius: 3em;
  border-color: #7baea7!important;
}
#fa_toolbar #fa_right #notif_list li.see_all a {
  color: #1E2E33!important;
}
#fa_right.welcome #fa_menu #fa_welcome {
  background: none!important;
}
#fa_menu {
  margin-left: 10px;
}
#fa_share, #fa_search {
  display: none!important;
}

avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 14:52

What's your forum's link?
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 14:53

Will send you via PM Wink
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 15:08

Try this code:
Code:
var pages=["http://hogostiliaustest.forumlt.com/forum"];
if(!_userdata.session_logged_in && $("#fa_right").length && $.inArray(document.URL, pages)!=-1){
$("head").append("<style>body #fa_right{display:none !important;}</style>");
}
I wrote == instead of != Razz
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by brandon_g on Fri Jun 23 2017, 17:47

Wolfuryo wrote:@SLGray, it's not illegal to remove a part of the toolbar, it is just kind of illegal to remove the copyright(left side. I say kind of illegal because you won't get arrested or anything like that for doing it. @Kami-sama, this code should hide the right side:
Code:
body #fa_right{
display:none !important;
}

Well slgray never said it was illegal. He just said that it is against forumotion TOS to hide/modify the copyrights of the toolbar using code, unless you pay to remove the copyright using credits first.

Now as long as your arent hiding or changing the copyright on the toolbar, then you should be fine and customize the toolbar however you like.

Just keep in mind that if you hide/modify the copyright on the toolbar without using credits to remove it first, your forum could be in violation of our tos and be subject to removal if it is found out by our litigation team. That is all slgray was trying to say.

If your not doing hiding or changing the copyright of the toolbar at all though, you are fine.

I just wanted to clarify on what exactly SLGray was trying to say in his post.

-Brandon


Remember to mark your topic when a solution is found.
avatar
brandon_g
Support Moderator
Support Moderator

Male Posts : 5937
Reputation : 547
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 17:58

@SLGray, I could swear that he said it was illegal. Anyway, it doesn't matter Smile
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 18:07

Brandon_g, thank you for the clarification Wink

Wolfuryo, thank you! The code worked!!
You did it in an interesting way. Just by adding code part to head element?
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 18:27

That code was the jquery library Smile
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Kami-sama on Fri Jun 23 2017, 18:43

You mixed the topics ;DD
I was talking about this
Code:
$("head").append("<style>body #fa_right{display:none !important;}</style>");
avatar
Kami-sama
Forumember

Female Posts : 317
Reputation : 7
Language : English, Russian, German, Lithuanian
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Toolbar hidden for guests

Post by Justice™ on Fri Jun 23 2017, 18:47

Oh yes, you're right. That code adds(appends) a style element in the head element with the necessary css tohide the right part of the toolbar. The reason I had to do it this way was because jquery ignores !important and the code needed it to work.
avatar
Justice™
Forumember

Posts : 514
Reputation : 117
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum