Hide menu item when logged in

14 years 3 weeks ago #127678 by jakobe75
Replied by jakobe75 on topic Re:Hide menu item when logged in
before I ditch this tour tab, I want to see it actually work based on what you have provided me.


I still dont know my substitution or IF statement


I cannot find anything that explains it on:
www.allmysocials.com/component/content/article/2-community-builder/10-substitutions

I can find example of IF statements but not what they door how to create new ones.


my method so far

- My welcome graphic is called welcome.jpg

- create a tab called "welcome tab"
- create a delimiter field called cb_welcome
- this field only displays on welcome tab
- this field is titled Welcome
- this field currently contains this code to display the image
<p style="text-align: center;"><img style="border: 0px none #000000;" alt="welcome image" src="images/stories/welcome.jpg" width="375" height="810" /></p>
<br />


In CB_Subs/Plans I have my integrations/CB fields set to
- field: "Welcome"
- value: 1
- remove on deactivation: "yes"
- operator: Set:field = value


I think I am just missing the proper IF statement
and the proper place to add it

the CBsubs documentation
demonstrates that the delimiter field should contain
the IF statement

example:
[cb:if user="#me" cb_cbdoc!="1"] Hello html text and what not goes after the statement [/cb:if]

field settings
required: no
show on profile : yes 1 line
display field title in profile: no
searchable: no
user read only: no
show at reg: no
published: yes
size: 0


so my delimiter should contain something like this ?


[cb:if user="#displayedOrMe" user_id="0"]<p style="text-align: center;"><img style="border: 0px none #000000;" alt="VIP_surfer_tab2" src="images/stories/VIP_surfer_tab2.jpg" width="375" height="810" /></p>
<br />[/cb:if]


so I need an IF statement that defines these things:

iF this user is FREE then show field cb_welcome
or
iF this users is logged then hide field cb_welcome


I think I am close but dont know diddly about creating my own IF statement or their certain commands.

on the right track ..yes/no?

Post edited by: jakobe75, at: 2010/03/22 19:13

Please Log in to join the conversation.

14 years 3 weeks ago #127681 by jakobe75
Replied by jakobe75 on topic Re:Hide menu item when logged in
as per your example
this loaded into the delimiter field


<ol>
<li><a href="index.php?option=com_comprofiler&task=userProfile">View Profile</a></li>
[cb:if cb_subscriptions="1"]<li><a href="index.php?option=com_content&task=view&id=32">Thank You for Subscribing</a></li>[/cb:if]
</ol>


produces the exact same thing (view profile) for both logged and not logged users.

I dont understand when you state that one should have "view profile" and the other "view profile & register".

it does not work for me in this way.

I see the same thing for both

I am logged in as a user on FF but visiting the site as a public guest in IE.


and also this applied does not do anything either..its hidden for both

krileon wrote:

So what you are saying is that, A TAB CANNOT be hidden in any way from a logged user and available to ONLY a public user...?

Correct.

but a FIELD can be.

No, please re-read my post. A SUBSTITUTION INSIDE of a DELIMITER field CAN.

What you do is create a new tab, this tab has this SINGLE delimiter field; no other field, no other content. Using the substitutions method as seen in my earlier post when the user is logged in the tab will be empty. Within CB configuration set empty fields and empty tabs to NOT show.

This tab will then vanish for logged in users and of course the substitution will take place when not logged in therefor displaying its content. You may want to set your delimiter field to display on 2 lines and not show its title as well for best results.



Now as an example I tired to follow this very carefully:

my delimiter field only contains the code

[cb:if user="#displayedOrMe" user_id="0"]I am A GUEST.[/cb:if]

this field is set to display on the welcome tab, CB is set NOT to show empty tabs.
no other fields display on this tab

Yet a logged user and a public user both are UNABLE to view the text. "I am a Guest"


and even by adding this
[cb:if username="jakobe"]This is stuff for Jakobe being displayed.[/cb:if]

This displays the message This is stuff for Jakobe on both users.



what am I doing wrong?

Post edited by: jakobe75, at: 2010/03/22 19:44

Please Log in to join the conversation.

14 years 3 weeks ago #127705 by krileon
Replied by krileon on topic Re:Hide menu item when logged in
I've provided you with examples, not something 100% functional; it's 100% guaranteed it will take changes. What you need is someone experience to develop your site. I don't know how much further to explain substitutions. The tutorial explains their usage, how to structure them, and multiple examples.

You've also not grasped the concept of CBSubs Fields; please see the manual as it explains this usecase. You need say a text field called cb_subscription. You then use CBSubs Fields to change cb_subscription to say 1. You then use this field in a substitution IF statement.

This very same usecase is used on Joomlapolis it self (see your profile). It is doable and does work; however it is absolute trial and error until you achieve what you're wanting. I implore you to spend a day at the least trying to formulate and understand the correct substitution for your needs.

Using the following works perfectly fine in a Delimiter field locally and on live test environments. I can not duplicate your issue.

[code:1]
[cb:if user="#displayedOrMe" user_id="0"]I am A GUEST.[/cb:if]
[/code:1]

Based off this and the information provided you would want your delimiter field to contain the following.

[code:1]
[cb:if user="#displayedOrMe" user_id="0"]
<div style="text-align: center;"><img style="border: 0px none #000000;" alt="welcome image" src="images/stories/welcome.jpg" width="375" height="810" /></div>
[/cb:if]
[/code:1]

When using substitutions it is best to use No Editor, or if you have JCE switch to Source mode. As some editors in editor mode will convert certain aspects of a substitution.

Post edited by: krileon, at: 2010/03/22 21:00


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

14 years 3 weeks ago #127715 by jakobe75
Replied by jakobe75 on topic Re:Hide menu item when logged in
yes thank you for the help

for some reason I guess substitutions and IF statements are not working on this box...I guess its a php issue now. I jahve never had any issues on this box with php before though , so I dont know where to start.


I am not using any editor, I have disable JCE

Nothing in between the IF tags appears, I have tried all of the suggestions you have given...multiple times.

various and creative ways.


copied the exact code form your tutorial site and nothing appears except plain code or a blank tab

I can call basic fields like name or user name, phone number and whatnot into a tab

but
the result is the same no matter what if the user_id="0" is used

anything using that makes the field blank for either users.

adding user_id="66" shows it to user 66
but adding zero whites it out completely for both users.


also the [cb:if cb_tourlogged="0"] or [cb:if cb_tourlogged="1"]

and then
and setting the fields to change from from 1/0 after subscribing also displays nothing on the tabs.

I have come to the conclusion that this is not possible on my site. Maybe it works on your sites, but on my version and server this does not work.


and before I have written this
I have tested it out again starting from scratch each time..anything using the

[cb:if cb_tourlogged="1"] TEXT THAT SUPPOSED TO SHOW [/cb:if]

the "if's" make it unavailable to either profiles for some reason.

remove the if's and it appears ..add the ifs and it disappears



thanks again for the help.

Post edited by: jakobe75, at: 2010/03/22 22:04

Post edited by: jakobe75, at: 2010/03/22 22:25

Please Log in to join the conversation.

14 years 3 weeks ago #127737 by jakobe75
Replied by jakobe75 on topic Re:Hide menu item when logged in
There must be a bug somewhere

this:

[code:1][cb:if user="#displayedOrMe" user_id="0"]
<div style="text-align: center;"><img style="border: 0px none #000000;" alt="welcome image" src="images/stories/welcome.jpg" width="375" height="810" /></div>
[/cb:if]
[/code:1]


In plain english basically says:
If the displayed users profile that you are looking at or including Yourself(me) has a user ID# of "0" (which I am assuming means null.)
Then load this text and image code into the tab.


This code is loaded into a delimiter field and the delimiter field is then set to display on a certain tab.

so, If a public user goes to the site (obviosuly with no user ID# as they are not registered or logged) Then They will see the message.

Once they login or join then they recv. a user ID and the message will not display for them.

If the cb config settings are set to hide empty tabs
then the entire tab "Welcome" will disappear.

This is very easy and clear to understand, but for some reason It will not work for me.

cb 1.2.2
j 1.5.14
php 5.x

my screenshots are too big so heres a link.
www.pressuretec.net/cb_subs/cb_tabs.htm

Please Log in to join the conversation.

14 years 3 weeks ago #127746 by jakobe75
Replied by jakobe75 on topic Re:Hide menu item when logged in
getting closer

remove a bunch of old unused fields
ran all the cbtool

This code does not work still

[code:1]
[cb:if user="#displayedOrMe" user_id="0"]
<div style="text-align: center;"><img style="border: 0px none #000000;" alt="welcome image" src="images/stories/welcome.jpg" width="375" height="810" /></div>
[/cb:if][/code:1]


but the site does seem to be processing if statements now

I think I have this code working, will update progress in the AM

[code:1][cb:if user="#me" user_id="0"]
<div style="text-align: center;"><img style="border: 0px none #000000;" alt="welcome image" src="images/stories/VIP_surfer_tab2.jpg" width="375" height="810" /></div>
[/cb:if][/code:1]

Post edited by: jakobe75, at: 2010/03/23 04:45

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.169 seconds

Facebook Twitter LinkedIn