Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] how ti show à field only if no connected

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 8 months ago - 11 years 8 months ago #221531 by mfe13
hello,
I need to show a message in profile only in public mode and no in registred mode, like this:
"please login to view complete profile"

But I do not know how I do with cb_conditional or otherwise?
Can you help me?
Thank you in advance
Last edit: 11 years 8 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221538 by krileon
Replied by krileon on topic how ti show à field only if no connected
You can use CB Privacy for this or create a CB Query Field to check if the viewing user has a connection with the displayed user and output the row count so 0 for not connected and 1 for connected. You'd then use CB Conditional with its Custom Value feature to check that this query field is equal to 1 (you need latest CB Conditional for this).

The below query will handle the connection check.
Code:
SELECT COUNT(*) FROM `#__comprofiler_members` WHERE `referenceid` = '[cb:userdata field="user_id" user="#me" /]' AND `memberid` = '[user_id]'

Note it just checks that a connection exists and may want to extend it to check for accepted connection. You'd then use it as follows in a conditional.

Display: Field conditional self
Field: Custom Value
Value: [cb:userfield field="cb_myqueryfield" /]
Operator: Equal To
Value: 1
Mode: Show


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 or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 8 months ago #221569 by mfe13
Replied by mfe13 on topic how ti show à field only if no connected
Thank you,

Excuse me, but because of the translation, English / French, I misstated my question.

I'm not talking about the connection between two users.
What I want is to hide a field only if the user is online and show fields only to visitors who are not online.
I use latest CB Conditional but impossible to do that.
thank you

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221653 by krileon
Replied by krileon on topic how ti show à field only if no connected

What I want is to hide a field only if the user is online and show fields only to visitors who are not online.

Ah, I see. Please see the below example.

I use latest CB Conditional but impossible to do that.

Incorrect, it's very possible. Please see the below (tested and confirmed working).

Display: Field conditional self
Field: Custom Value
Value: [cb:userfield field="onlinestatus" output="csv" /]
Operator: Is REGEX
Value: /true/
Mode: Show


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 or Create an account to join the conversation.

  • mfe13
  • mfe13
  • OFFLINE
  • Posts: 572
  • Thanks: 26
  • Karma: 5
11 years 8 months ago #221667 by mfe13
Replied by mfe13 on topic how ti show à field only if no connected
hello,
Ok, this is exactly what I wanted.
Just put / false / to show the fields in the offline mode.
Great, thank you very much

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum