Skip to Content Skip to Menu

function onAfterLogin help

17 years 6 months ago #34080 by SimonBaumer
Replied by SimonBaumer on topic Re:function onAfterLogin help
Thanks so much for your help so far. I took all your suggestions, turned on debugging in Joomla configuration and see the query outputs.

When I login to CB though, the query found within my plug-in's onAfterLogin function does not get displayed. I do know that it is working though because static information from my query is succesfully inputting into the database. Is there a way I can get queries from within that function to output in the debugging area?

Also, I created an additional column to hold the user id, one int and one varchar, and tried passing the same variable to both types of columns, and it shows up as 0 in both. I also removed the quotes and tried again, but only 0's.
[code:1]
global $database, $my;
$user_id = $my->id;
$querya="INSERT INTO #__comprofiler_plug_act SET userid=$user_id, new_id=$user_id";
$database->setquery($querya);
return $database->query();
[/code:1]

Is there any other reason why this wouldn't be working that you can think of?

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

17 years 6 months ago #34086 by SimonBaumer
Replied by SimonBaumer on topic Re:function onAfterLogin help
I did some more testing and tried using the onAfterLogout function, and the same query worked to pass the $my->id value into the database table.

This leads me to believe that CB doesn't know what the user id is for the user who just logged in during the onAfterLogin function. How can I capture the user id during the login process or immediately after login?

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

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 6 months ago #34100 by mikko
Replied by mikko on topic Re:function onAfterLogin help
You can check $my easily by putting this line in the beginning of the function:

die('MY='.$my->id);

mikko

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

  • p9939068
  • p9939068
  • OFFLINE
  • Posts: 186
  • Thanks: 0
  • Karma: 117
17 years 6 months ago #34105 by p9939068
Replied by p9939068 on topic Re:function onAfterLogin help
The id for the user in onAfterLogin is $user->id, which is why there is a $user in the function params. The $user object includes all other cb fields, eg $user->cb_gender etc


Mike Feng
Creator of SIMGallery, SIMAnswers, and ParaInvite
www.simbunch.com
twitter.com/simbunch

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

Moderators: beatnantkrileon
Powered by Kunena Forum