Hello, Can you please help me buid a simple php-code that will add a value to a custom field.
For example lets say we have a custom text-field with alias "Accept", How can I add the value "1" to the logged-in user with a simple php code?
I figured it out like this:
<?php
// Create and populate an object.
$user_record = new stdClass();
// Must be a valid primary key value.
$user_record->id = JFactory::getUser()->get('id');
$user_record->accept = '1';
// Update their details in the users table using id as the primary key.
$result = JFactory::getDbo()->updateObject('jos_jsn_users', $user_record, 'id');
?>