Hello,
I want to update a field in comprofiler table when the request of connection made by a user is accepted. To better explain:
I have three type of usergroup: Volunteer, Association and Volunteer-not-confirmed.
When a Volunteer-not-confirmed ask for connection to an Association and the association accept his request, I want to update the custom field in comprofiler table [cb_assoid] with the value of the [cb_assoid] of the Association.
Then when the Volunteer-not-confirmed do the login and the field [cb_assoid] is no more empty, with an other auto action I change his usergroup from Volunteer-not-confirmed to Volunteer.
That's all.
I try CODE auto action with this params:
Type: code
Trigger: onAfterAddConnection
Access: Volunteer-not-confirmed
Method: PHP create function
Code:
Code:
$user = & JFactory::getUser();
$user_id = $user->id;
global $_CB_framework, $_CB_database;
$query = "SELECT memberid FROM r0sdt_comprofiler_members WHERE referenceid=$user_id AND accepted=1 AND pending=1";
$_CB_database->setQuery( $query );
$member_id =$_CB_database->loadResult();
$query2 = "SELECT cb_assoid FROM r0sdt_comprofiler WHERE id=$member_id ";
$_CB_database->setQuery( $query2 );
$cb_assoid =$_CB_database->loadResult();
$query3 = "UPDATE r0sdt_comprofiler SET cb_assoid=$cb_assoid WHERE user_id=$user_id";
$_CB_database->setQuery ($query3);
Return: Silent
But the field is not updated... even if in the debug all is ok...
Have any idea?