How do you add and remove tags from a user?
Posted: Thu May 07, 2015 11:54 pm
I've tried using the API class CompanyGenericTag function called deleteCompanyGenericTag(), but this only removes the tag from the database. Opening the employee in TimeTrex shows the tag is still there but orphaned.
I've tried modifying the ['tag'] element of the array of data obtained from the getUserfunction in the API class User, but the tag still remains orphaned.
Code: Select all
// this code leaves an orphaned tag still associated with the user record
$ttAPI = new TimeTrexClientAPI( 'CompanyGenericTag' );
$ttAPI->deleteCompanyGenericTag($tag['id'])
Code: Select all
// this code does not remove a tag on the user record
$ttAPI = new TimeTrexClientAPI( 'User' );
$ttData = $ttAPI->getUser(null, true)->getResult();
$tagged_entry = $ttData[0];
$tagged_entry['tag'] = str_replace($tag_string,'',$tagged_entry['tag']);
$ttAPI->setUser($tagged_entry);