Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

MetaMod recipe - Comprofiler field empty then display "lightbox"

  • kj2012
  • kj2012
  • OFFLINE
  • Posts: 9
  • Thanks: 0
  • Karma: 0
11 years 7 months ago #227052 by kj2012
My goal is to launch a lightbox with a pre-developed "Fabrak" form inside of it. This feature will be based on if the logged-in user has selected a radio button option. If he or she did not then the lightbox will pop up with the form

Here is what I have so far...

user_id = $db->getEscaped((int)($user->id));

if ($user_id > 0) {
$query = "select * from #__comprofiler where user_id = '$user_id';";
$db->setQuery( $query );
$row = $db->loadObject();

$cb_communityportal = $row->cb_communityportal; // this is the field where the user selects a community

if ($cb_communityportal == null) return 183; else return;/* check if user selected a audience group, "183" is the module ID of the Ari Sexy Lightbox module*/

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
11 years 7 months ago #227072 by krileon
Please see the below tutorial for including CB API externally and constructing a CB user object with it. You should avoid direct database queries for CB data.

www.joomlapolis.com/support/tutorials/120-api-usage/18357-including-cb-api-for-usage-outside-of-cb

www.joomlapolis.com/support/tutorials/120-api-usage/18359-establishing-a-cb-user-object

You can find more CB API related tutorials below.

www.joomlapolis.com/support/tutorials/120-api-usage


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.

  • kj2012
  • kj2012
  • OFFLINE
  • Posts: 9
  • Thanks: 0
  • Karma: 0
11 years 7 months ago #227097 by kj2012
Thanks krileon, this is good information, but let me ask you, can my goal be achieved with an Auto Action?


Type: CODE
condition: [cb_communityportal] Empty
Code Action: Some sort of JQuery or Javascript that show's the ari sexylightbox module

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
11 years 7 months ago #227099 by krileon
CB Auto Actions acts on CB triggers only. So I guess it entirely depends on where you need what. To load in a module you'd need to use a Code action with PHP method and execute Joomla API to render a module. So locations you could use this at are extremely limited. If all you want to do is show a lightbox when a field is empty when viewing a profile for example then yes CB Auto Actions can easily do this with a Code action and jQuery method.


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.

  • kj2012
  • kj2012
  • OFFLINE
  • Posts: 9
  • Thanks: 0
  • Karma: 0
11 years 7 months ago #227885 by kj2012
Where would the cb API's be implemented? In the index.php page? or a separate page within the cb component directory?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
11 years 7 months ago #227906 by krileon
It doesn't need to be added anywhere if you're doing this within CB it self or using CB Auto Actions to act on a trigger. It's only needed if you're trying to add CB usages to MetaMod and would need to add it to MetaMod so you can use CB API throughtout MetaMod.


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