Skip to Content Skip to Menu

cb query field

10 years 4 weeks ago - 10 years 4 weeks ago #250093 by giorgionasis
cb query field was created by giorgionasis
hallo there,

i want help with something i cannot figure out.
i write a query but i miss one parameter which i don`t know how to express it. i want to retrieve the last k2 item a user has published.
Code:
select publish_up from #__k2_items WHERE published=1 AND trash=0 AND created_by= ????

there was a plugin for cb 1.9.1 from a 3rd party developer where in created_by has the value {USERID} and with this way, it recognized the user who has published it, i had my results..

what should i have in the ???? in order cb query to recognize the user??

thank you very much!!!

extensions.joomla.org/extensions/extension-specific/community-builder-extensions/community-builder-profiles/10043
Last edit: 10 years 4 weeks ago by giorgionasis.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48480
  • Thanks: 8283
  • Karma: 1443
10 years 4 weeks ago #250096 by krileon
Replied by krileon on topic cb query field
CB Query Field support standard substitutions as documented below.

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

So for example if you need the user id you can use [user_id].


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: giorgionasis

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

10 years 4 weeks ago #250101 by giorgionasis
Replied by giorgionasis on topic cb query field
awesome!!!
thank you very much!and something else if it is possible..the result of my query is a k2 item..is there any way to link it with the k2 item page?Like the CB 2.0 articles do..

thank you again!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48480
  • Thanks: 8283
  • Karma: 1443
10 years 4 weeks ago #250104 by krileon
Replied by krileon on topic cb query field
You'd have to build the URL manually in your query results display then substitute in the needed information for the URL, which for K2 is the article id and alias. So you'd need to set it to multiple column output with custom display. You can then substitute in column values using [column_COLUMN_NAME] (e.g. [column_title]).


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.

10 years 4 weeks ago - 10 years 4 weeks ago #250107 by giorgionasis
Replied by giorgionasis on topic cb query field
sorry kyle,

but i lost you totally.. :)

this is my query
Code:
SELECT title, publish_up FROM #__k2_items WHERE published=1 AND trash=0 AND created_by=[user_id] ORDER BY publish_up DESC;

in the parameters i have output "single row" and "multiple columns". as i have see in the table #k2_items there is not the url of the k2 item to retrieve it.

for now my result is
title_of_query
the_k2_item
the_date_of_k2_item

i want by clicking "the_k2_item" to redirect to the page of the k2 item

thank you
Last edit: 10 years 4 weeks ago by giorgionasis.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48480
  • Thanks: 8283
  • Karma: 1443
10 years 4 weeks ago #250110 by krileon
Replied by krileon on topic cb query field
You need the below usage to have multi-column display.

Output: Single Row
Columns: Multiple Columns
Display: Custom
Custom:
Code:
<div>Title: [column_title]</div> <div>Published: [column_publish_up]</div>

The columns in your SELECT can be substituted in using [column_COLUMN_NAME]. This information is also detailed in the tooltips of the various parameters.

The URL does exist in the database. You need to format the URL using database information. Specifically the "id" and the "alias" are used in the URL. To get the URL structure navigate to a K2 article without SEF and begin with index.php. Example as follows.

index.php?option=com_k2&view=item&id=[column_id]:[column_alias]


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.

Moderators: beatnantkrileon
Powered by Kunena Forum