Skip to Content Skip to Menu

Trouble with cb:if in CB Forums Plug In

  • ksaltman
  • ksaltman
  • OFFLINE
  • Posts: 108
  • Thanks: 11
  • Karma: 2
9 years 5 months ago #264089 by ksaltman
Trouble with cb:if in CB Forums Plug In was created by ksaltman
I am trying to do some custom formatting of the sidebar in Kunena and am using the CB Forums->Parameters->Forums->Sidebar->Registered field. Pretty much doing exactly as described in the Primer pages 82-83.

Anything I try to do with [cb:if completely doesn't work. I've boiled the code down to:

<ul class="kpost-profile">
<li class=“cbrw_debug">cb_rw_forum_display_full_name=([cb_rw_forum_display_full_name])</li>

[cb:if cb_rw_forum_display_full_name = “0”]
<li class="kpost-username">
<a class="kwho-user" href="index.php?option=com_comprofiler&task=userProfile&user=[user_id]” title="View [name]’s Profile" rel="nofollow">[name]</a>
</li>
</cb:if>
[cb:if cb_rw_forum_display_full_name=“1”]
<li class="kpost-username">
<a class="kwho-user" href="index.php?option=com_comprofiler&task=userProfile&user=[user_id]” title="View [formatname]’s Profile" rel="nofollow">[formatname]</a>
</li>
</cb:if>
</ul>


The HTML code that is generated looks like this:

<ul class="kpost-profile">
<li class=“cbrw_debug">cb_rw_forum_display_full_name=(1)</li>

[cb:if cb_rw_forum_display_full_name = “0”]
<li class="kpost-username">
<a class="kwho-user" href="/joomla/index.php/component/comprofiler/userprofile/754”%20%20title="View Super User’s Profile" rel="nofollow">Super User</a>
</li>
</cb:if>
[cb:if cb_rw_forum_display_full_name=“1”]
<li class="kpost-username">
<a class="kwho-user" href="/joomla/index.php/component/comprofiler/userprofile/754”%20%20title="View admin’s Profile" rel="nofollow">admin</a>
</li>
</cb:if>
</ul>


And a screen grab of the sidebar area is attached. I've spent hours on this, what am I doing wrong?


Attachments:

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

  • ksaltman
  • ksaltman
  • OFFLINE
  • Posts: 108
  • Thanks: 11
  • Karma: 2
9 years 5 months ago #264090 by ksaltman
Replied by ksaltman on topic Trouble with cb:if in CB Forums Plug In
Also btw, please note the %20%20 generated in the href.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 5 months ago #264120 by krileon
Replied by krileon on topic Trouble with cb:if in CB Forums Plug In
Your cb:if statements are closed incorrectly and the space between operator and value shouldn't be there on your first cb:if usage. Please see the below substitution tutorial for correct usage of substitutions and cb:if examples at the bottom of the page.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


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.

  • ksaltman
  • ksaltman
  • OFFLINE
  • Posts: 108
  • Thanks: 11
  • Karma: 2
9 years 5 months ago #264152 by ksaltman
Replied by ksaltman on topic Trouble with cb:if in CB Forums Plug In
Thanks I did read the tutorial multiple times. Rockie mistake on the [/cb:if]. Happened when I was creating the boiled down code to post.

The space around the = sign did fix the cb:if issue. Thanks.

Any thoughts on the %20%20 being generated in the href output?

This is what I get now.

<li class="kpost-username">
<strong>Equals 1</strong><br>
<a class="kwho-user" href="/joomla/index.php/component/comprofiler/userprofile/754”%20%20%20title="View admin’s Profile" rel="nofollow">admin</a>
</li>

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
9 years 5 months ago #264157 by krileon
Replied by krileon on topic Trouble with cb:if in CB Forums Plug In
No idea, that's after the href attribute has closed so it doesn't make much sense. Edit the HTML within CB Forums parameters, backspace the space between " and title, then add it back in to see if it clears it up.


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.

  • ksaltman
  • ksaltman
  • OFFLINE
  • Posts: 108
  • Thanks: 11
  • Karma: 2
9 years 5 months ago #264182 by ksaltman
Replied by ksaltman on topic Trouble with cb:if in CB Forums Plug In
Yup already tried that before I submitted the original request, no joy.

I did now go ahead and re-order the line putting the title before the href and now it renders fine.

In thinking more about this I wonder though if at least at the logic level if I am perhaps doing this wrong. By putting the render logic in the CB Forums plug in, I basically adding it to the view.

Could I use the substitute capability of a field like the formatname field and effectively do it in the model once and use through out. Would the CB Plugin get the value of the field using the Profile Value Layout or Userlist Value Layout or is that not possible?

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

Moderators: beatnantkrileon
Powered by Kunena Forum