Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CB connection from a link with query

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago #333405 by activha
Replied by activha on topic CB connection from a link with query
Thanks so much as usual
That should be it for a few days of working now 😉
The following user(s) said Thank You: krileon

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

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago #333409 by activha
Replied by activha on topic CB connection from a link with query
Just an issue retrieving the user in a connection autoaction with the following code and that's ready :
Code:
$atid = 0; if (!empty($_COOKIE["atid"])) { $cookiecontent = unserialize(base64_decode($_COOKIE["atid"])); $atid = (int)$cookiecontent["atid"] ; } //test //$atid = 2173; global $_CB_database; $query = "SELECT " . $_CB_database->NameQuote( 'user_id' ) . " FROM " . $_CB_database->NameQuote( '__affiliate_tracker_accounts' ) .  " WHERE " . $_CB_database->NameQuote( 'id' ) . " = " . $atid ." LIMIT 1"; $_CB_database->setQuery( $query ); return (int)$_CB_database->loadResult();

I don't know what I missed. This is a user code search and setting return "11829" works fine for instance, there is no issue neither with the $atid, I checked that the cookie was there and tried with an existing number.
It seems like the last two lines are the problems but I cannot see while ?
 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 8 months ago #333415 by krileon
Replied by krileon on topic CB connection from a link with query

$_CB_database->NameQuote( '__affiliate_tracker_accounts' )

You're missing the #. So it should be #__affiliate_tracker_accounts for it to auto replace the table prefix.


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

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

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago #333557 by activha
Replied by activha on topic CB connection from a link with query
I tried with the trigger onAfterUserRegistration but cannot get it to work

Strange as the same code does correctly link the user and the parent in the component com_affiliates though they use a function onUserAfterSave to create the affiliate

So I am thinking of connecting the two when the link is established by com_affiliates.

How can I automatically connect the two in CB connections at this time. Shall I use a DB query or is there a function in CB to link the two ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 8 months ago #333558 by krileon
Replied by krileon on topic CB connection from a link with query
onAfterUserRegistration is only fired for frontend user registrations. It does not fire anywhere else so be sure you're testing a new registration each time. I cannot help you in regards to why your code is or is not working. The trigger absolutely will fire and absolutely will execute the auto action. What happens from there is entirely dependent on your code.

As for establishing a connection yes you could just directly insert that into the database if you wanted. Connections are managed in _comprofiler_members table. Review an existing connection row to better understand how to format your query.


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2336
  • Thanks: 117
  • Karma: 13
1 year 8 months ago #333566 by activha
Replied by activha on topic CB connection from a link with query
My issue was that the registration took place in an iframe and the cookie was not recognized because lacking the samesite = none !
The cookie is issued by a third party component so I ended by moving the registration process outside of th iframe and all went fine. 
Joomla should provide an option by default for same origin in its setcookie function 
Thanks for your help anyway 
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