Skip to Content Skip to Menu

[SOLVED] [#6317] Substitutions question

  • siala
  • siala
  • OFFLINE
  • Posts: 26
  • Thanks: 1
  • Karma: 0
7 years 11 months ago - 7 years 11 months ago #288391 by siala
I have the following substitution:
Code:
[cb:userfield field=\"cb_vocational_professional_skills\" user=\"$youth_id\" /]
(The \ are there because its inside some php)

Its being used in an article in combination with some php. $youth_id is the userid of the profile being viewed.

When the owner of the profile views the article the field appears as it should.

When an admin views the article it is not shown (the admin can see the field on the profile).

I have found what seems to be causing the problem. cb_vocational_professional_skills is hidden/shown using cb conditional. When i disable the condition the admin can view the field on the article.

So for some reason the condition is causing the field to be hidden on the article for admin even though the field is shown on the profile. Any ideas why?

I have tested this using the following cb conditional versions:
4.0.7+build.2016.07.09.00.28.00.ec65dbf5d
4.0.7+build.2016.11.29.00.30.50.47936091e


Joomla! Version 3.6.2 Stable [ Noether ] 4-August-2016 23:41 GMT
PHP Version 5.6.24
mysql version 5.6.32-78.1
community builder version 2.0.15+build.2016.09.18.15.00.02.b2e3df5e1
Last edit: 7 years 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
7 years 11 months ago #288412 by krileon
Replied by krileon on topic Substitutions question
CB Conditional acts on the trigger onAfterFieldsFetch to remove fields from the fields array directly. The problem is getFields calls _getTabFieldsDb which fires onAfterFieldsFetch with the viewing user object and not the user object attempting to be displayed. I'm unsure if I'll be able to workaround this, but have added a bug ticket to see if it's possible in a later CB Conditional release.

forge.joomlapolis.com/issues/6317

Unfortunately I've no workaround to suggest at this time, sorry.


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.

  • siala
  • siala
  • OFFLINE
  • Posts: 26
  • Thanks: 1
  • Karma: 0
7 years 11 months ago #288434 by siala
Replied by siala on topic Substitutions question
It might be worth pointing out that the vast majority of fields on the article, many of which are also hidden/shown using cb conditional, were not affected by this problem and can be seen by both profile owner and admin

Also i added the below code to the few fields that were not appearing for admins and they are now appearing. Is there any reason why i wouldn't want to add this:
Code:
reason="edit"

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
7 years 11 months ago #288448 by krileon
Replied by krileon on topic Substitutions question
New CB Conditional build should be out later today that fixes this issue. The problem is the conditions in this case are being applied to the viewing user instead of the user being displayed. So if you're trying to display a conditioned field from a user other than your self with substitutions it conditions against you and not that user. I was able to implement a fix for this case so that can't happen anymore. You shouldn't need to make any changes to your substitutions or conditions and will just need to update when build is available.


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.
The following user(s) said Thank You: siala

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

  • siala
  • siala
  • OFFLINE
  • Posts: 26
  • Thanks: 1
  • Karma: 0
7 years 11 months ago #288469 by siala
Replied by siala on topic Substitutions question
thanks. ill give it a try when its out

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

  • siala
  • siala
  • OFFLINE
  • Posts: 26
  • Thanks: 1
  • Karma: 0
7 years 11 months ago #288471 by siala
Replied by siala on topic Substitutions question
looks like it fixed the problem. thanks
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum