Make code for guest/logged out users
4 posters
Page 1 of 1
Make code for guest/logged out users
I want to add a CSS Style code for logged out users in my viewtopic_body:
Is it possible and where will I add it? in my Template viewtopic_body?
- Code:
.pun .postmain .user {
display: none!important;
}
Is it possible and where will I add it? in my Template viewtopic_body?
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Just add a tag with class inside the logged out user variable:
Then for the CSS: (Just put some styles)
- Code:
<!-- BEGIN switch_user_logged_out --><div class="logged-out">
Content here
</div>
<!-- END switch_user_logged_out -->
Then for the CSS: (Just put some styles)
- Code:
.logged-out {
}
Last edited by E-Mark on Sun May 26, 2013 12:44 pm; edited 1 time in total
Re: Make code for guest/logged out users
so how would look like sir, like this?
then CSS
- Code:
<!-- BEGIN switch_user_logged_out --><div class="logged-out">
.pun .postmain .user {
display: none!important;
}
</div>
then CSS
- Code:
logged-out {
}
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Nope. It should be like this: (Put this on index_body)
Then on your CSS, put this one:
- Code:
<!-- BEGIN switch_user_logged_out -->
<div class="logged-out">
This is the text that will saw by the users who are not yet logged in.
</div>
<!-- END switch_user_logged_out -->
Then on your CSS, put this one:
- Code:
.logged-out {
// Put the styles here
}
Re: Make code for guest/logged out users
but i want it on viewtopic_body , is it possible?
So i would add this:
So i would add this:
- Code:
.logged-out {
.pun .postmain .user {
display: none!important;
}
}
Last edited by thefirstdanshin on Sun May 26, 2013 1:21 pm; edited 1 time in total
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Yes. It is possible, you can put them on viewtopic_body template.
Re: Make code for guest/logged out users
here's a photo example sir:
and is this the code, that I will add in CSS
at which part will I add this
to viewtopic_body
sorry if i have a lot of questions
and is this the code, that I will add in CSS
- Code:
.logged-out {
.pun .postmain .user {
display: none!important;
}
}
at which part will I add this
- Code:
<!-- BEGIN switch_user_logged_out -->
<div class="logged-out">
This is the text that will saw by the users who are not yet logged in.
</div>
<!-- END switch_user_logged_out -->
to viewtopic_body
sorry if i have a lot of questions
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Then use the logged in variable instead:
Also, don't use the .pun .postmain .user { as it is considered as redundant of opening tags. Also don't use display: none as it will hide the content of the class connected to it.
- Code:
<!-- BEGIN switch_user_logged_in -->
<div class="logged-out">
This is the text that will saw by the users who logged in and will not be visible to users who are logged out.
</div>
<!-- END switch_user_logged_in -->
Also, don't use the .pun .postmain .user { as it is considered as redundant of opening tags. Also don't use display: none as it will hide the content of the class connected to it.
Re: Make code for guest/logged out users
uhmm, sir, that's kind of my purpose to hide
.pun .postmain .user {
i want to hide it from Guests how can it be done?
.pun .postmain .user {
i want to hide it from Guests how can it be done?
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Then just use this one:
The <!-- BEGIN switch_user_logged_in --> / <!-- END switch_user_logged_in --> will automatically hide the content inside it to guest users.
- Code:
<!-- BEGIN switch_user_logged_in -->
This is the text that will saw by the users who logged in and will not be visible to users who are logged out.
<!-- END switch_user_logged_in -->
The <!-- BEGIN switch_user_logged_in --> / <!-- END switch_user_logged_in --> will automatically hide the content inside it to guest users.
Re: Make code for guest/logged out users
Try using this JavaScript if you don't want to edit templates, add it under Administration Panel -> Modules -> HTML & JavaScript -> JavaScript pages management -> Create a new JavaScript.
- Code:
jQuery(document).ready(function(){
if(!jQuery('#logout')){
jQuery('.pun .postmain .user').each(function(){
jQuery(this).replaceWith('<span style="font-weight: bold; color: #ff1010; text-align: center;">You must be logged in to view this content.</span>');
});
}
});
Re: Make code for guest/logged out users
@Ultron's Vision: it doesn't quite work, you can still see it here: http://ggpalace.forumotion.net/t1603-2013-sunny-s-birthday-message-thread
Please help me
Please help me
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Would you do me a favor?
Hover over the 'Register' link and then right-click and click on Inspect Element, then copy what the browser outputs (preferably, use Chrome so you can take a screenshot of the console in case you don't know what to do) in here (I'm looking for the CSS Selector for the Register link) so I can optimize my code above.
Hover over the 'Register' link and then right-click and click on Inspect Element, then copy what the browser outputs (preferably, use Chrome so you can take a screenshot of the console in case you don't know what to do) in here (I'm looking for the CSS Selector for the Register link) so I can optimize my code above.
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Okay, take the code I posted above and replace it with this.
- Code:
jQuery(document).ready(function(){
if($('a[href="/register"]')){
$('.pun .postmain .user').each(function(){
$(this).replaceWith('<span style="text-align: center; color: #ff1010; font-weight: bold; text-decoration: underline;">You must be registered and logged in to view this content.</span>');
});
}
});
Re: Make code for guest/logged out users
Sir, it works , but I can still see this
You must be registered to view this content.
even if I'm logged in
You must be registered to view this content.
even if I'm logged in
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Errr, so I guess that even registered users see the register link somewhere on your site.
Could you provide a test admin account to me via PM so that I can inspect the site and post a new code for you?
Could you provide a test admin account to me via PM so that I can inspect the site and post a new code for you?
Re: Make code for guest/logged out users
yes sir, Even registered users see the "You must be logged in.."
this works perfectly sir, only registered users see it also...
EDIT: Oh sorry for the trouble sir, thank you for helping Topic Solved
- Code:
jQuery(document).ready(function(){
if($('a[href="/register"]')){
$('.pun .postmain .user').each(function(){
$(this).replaceWith('<span style="text-align: center; color: #ff1010; font-weight: bold; text-decoration: underline;">You must be registered and logged in to view this content.</span>');
});
}
});
this works perfectly sir, only registered users see it also...
EDIT: Oh sorry for the trouble sir, thank you for helping Topic Solved
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
thefirstdanshin wrote:yes sir, Even registered users see the "You must be logged in.."
- Code:
jQuery(document).ready(function(){
if($('a[href="/register"]')){
$('.pun .postmain .user').each(function(){
$(this).replaceWith('<span style="text-align: center; color: #ff1010; font-weight: bold; text-decoration: underline;">You must be registered and logged in to view this content.</span>');
});
}
});
this works perfectly sir, only registered users see it also...
EDIT: Oh sorry for the trouble sir, thank you for helping Topic Solved
So it is working for you?
Re: Make code for guest/logged out users
yup i will do it on my other forum
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Glad to be of help
Just so that I have it confirmed -- the code is working, and registered users are not affected by the code, did I get that right?
Just so that I have it confirmed -- the code is working, and registered users are not affected by the code, did I get that right?
Re: Make code for guest/logged out users
the registered users are still affected though, but I just removed the text:
You must be registered and logged in to view this content and it was fine thanks
You must be registered and logged in to view this content and it was fine thanks
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
Okay, give me about two hours, I'll have some code written for you, then.
Re: Make code for guest/logged out users
ok sir, thank you very much
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
So after registering, I found a detail which is unique to guests.
Delete all the previous codes I gave you and type this in a new JavaScript under Administration Panel -> Modules -> HTML & JavaScript -> JavaScript pages management -> Create a new JavaScript.
Delete all the previous codes I gave you and type this in a new JavaScript under Administration Panel -> Modules -> HTML & JavaScript -> JavaScript pages management -> Create a new JavaScript.
- Code:
$(document).ready(function(){
if($('img#i_icon_mini_login')){
$('.pun .postmain .user').each(function(){
$(this).replaceWith('<span style="text-align: center; color: #ff1010; font-weight: bold; text-decoration: none !important;">You must be registered and logged in to view this content.</span>');
});
}
});
Re: Make code for guest/logged out users
WOW~ this one really works i thought it doesn't, I was using IE as my browser, turned out the Jscript was off now it works, i'm using chrome Thank you very very very much!!!!!!!!!!!!!!!!! :*
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Re: Make code for guest/logged out users
You're welcome
Don't forget to mark this as solved to simplify the moderators' work
Don't forget to mark this as solved to simplify the moderators' work
Re: Make code for guest/logged out users
Ok thank you very much Solved~
thefirstdanshin- Forumember
- Posts : 63
Reputation : 1
Language : English
Similar topics
» How to Make an Element in My Portal Only Appear Logged in
» Says 0 users online when I'm not logged in and when others are not
» I need a code to show the profile image (avatar) for the logged in user
» HTML page accessible only to logged in users
» Money taken from logged in, gullible, forum users by spam advertising
» Says 0 users online when I'm not logged in and when others are not
» I need a code to show the profile image (avatar) for the logged in user
» HTML page accessible only to logged in users
» Money taken from logged in, gullible, forum users by spam advertising
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum