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] CB Conditional - how to get the viewing user Id?

9 years 1 week ago - 9 years 1 week ago #272528 by gjvanwijk63
I want to hide a field for the viewing user by using the cb conditional plugin.

So I use the 'Field conditioning self' and select the username field (If) to be 'Not Equal To' (Is) and the variable [user_id] (To).

But is won't work that way. I replaced the value in the 'To' field with the real username and that workef fine. So I guess I using the wrong variable name.

Any clue?

regards GJ
Last edit: 9 years 1 week ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 week ago #272551 by krileon
Sorry, I don't understand your condition. You're checking that the username is not equal to the users user id? Please clarify what you're trying to condition against.


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.

9 years 1 week ago - 9 years 1 week ago #272554 by gjvanwijk63
Replied by gjvanwijk63 on topic CB Conditional - how to get the viewing user Id?
It's probably my english ;-)

I have this field called PM (it's the private message field). It is part of the User profile tab. You can click on it to send a private message to another user.

The thing is that this PM field also is visible when you look at your own user profile. When you click it a warning message shows up that you can't send private messages to yourself.

For that reason I want to hide it in the user's own profile tab. It has no function there. Of course when you view a profile of another user it must be visible.

I thought that if I make the PM field's visibility conditional that would do the trick. So I want to set he condition to the PM field like this. If it is my own profile tab I'm viewing hide the PM field, if it is the profile tab of another user I'm viewing make it visible.
Attachments:
Last edit: 9 years 1 week ago by gjvanwijk63.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 week ago #272558 by krileon
The below condition on your PM field should do the trick. Note there's a menu item on the top menu for users to send a PM so the field isn't necessary and can be moved to a tab in a not shown on profile position if you like.

Display: Field conditional self
Field: Custom > Value
Value: [user_id]
Translate Value: No
Operator: Equal To
Value: [cb:userdata field="user_id" user="#me" /]
Translate Value: No
Mode: Hide
Registration: No
Profile Edit: No
Profile View: Yes
Userlists Search: No
Userlists View: Yes


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.

9 years 1 week ago #272560 by gjvanwijk63
Replied by gjvanwijk63 on topic CB Conditional - how to get the viewing user Id?
You're the Best!!!

Thanx
The following user(s) said Thank You: nant, krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum