Answers.Body: <p>I figured out what happened. When I did the backup and migrate, Drupal set civicrm_tag.used_for to NULL. I set the field for all my tags to 'civicrm_contact' and it fixed the problem. No more errors. I just ran this query:<br>
  <code>UPDATE civicrm_tag SET used_for='civicrm_contact';</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-27T20:34:31.650Z
Answers.LastActivityDate: 2015-04-27T20:34:31.650Z
Answers.UserDisplayName: A.J.
Answers.Body: <p>I had deleted all my tags so the SQL query didn't help me at first. </p>
  
  <p>I added one tag via civiCRM, then went into phpMyAdmin and just pasted civicrm_contact into the used_for field. That worked, though at that point I could have used the SQL query.</p>
  
  <p>I was deleting all my contacts except a few administrators, so I could keep all the settings before importing 20k contacts, and also deleted all my tags when the problem occurred for me.</p>
  
  <p>Thanks for the solution, I would never have figured out my own version without your help.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-05T23:42:29.540Z
Answers.LastActivityDate: 2015-07-06T00:23:07.497Z
Answers.LastEditDate: 2015-07-06T00:23:07.497Z
Answers.UserDisplayName: OregonJohn
Body: <p>After I did a Backup and Migrate to a new system, I am getting two errors on any New Contact form. They are as follows: </p>
  
  <p><code>Notice: Undefined property: CRM_Core_BAO_Tag::$tree in CRM_Core_BAO_Tag-&gt;getTree() (line 75 of /sites/all/modules/civicrm/CRM/Core/BAO/Tag.php).</code></p>
  
  <p><code>Warning: Invalid argument supplied for foreach() in CRM_Contact_Form_Edit_TagsAndGroups::climbtree() (line 203 of /sites/all/modules/civicrm/CRM/Contact/Form/Edit/TagsAndGroups.php).</code></p>
  
  <p>I also noticed that the tag box at the bottom of the page under "Tags and Groups" has gone missing. Is there any way to fix this problem without starting from scratch? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-12T10:51:09.923Z
Comments.Text: Exactly the same problem here when editing or adding a contact. I can't seem to resolve the problem like AJ described because my civicrm_tag table is empty; I don't have tags. What can be the cause in my case? Please check my comment below.
Comments.UserDisplayName: Kwantum
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-12T10:56:30.930Z
Comments.Text: Seems to me this is a bug. When I create a new tag the warning is gone. So it occurs only when no tags exist or with the problem AJ described.
Comments.UserDisplayName: Kwantum
Tags: <drupal><import><contacts>
Title: Error in CiviCRM for Drupal7 after Migrate from "Backup and Migrate" module on New Contact Form
ThreadText: # Error in CiviCRM for Drupal7 after Migrate from "Backup and Migrate" module on New Contact Form
  
  (Asked by: username_0 on 2015-04-27)
  
  After I did a Backup and Migrate to a new system, I am getting two errors on any New Contact form. They are as follows:
  
  `Notice: Undefined property: CRM_Core_BAO_Tag::$tree in CRM_Core_BAO_Tag->getTree() (line 75 of /sites/all/modules/civicrm/CRM/Core/BAO/Tag.php).`
  
  `Warning: Invalid argument supplied for foreach() in CRM_Contact_Form_Edit_TagsAndGroups::climbtree() (line 203 of /sites/all/modules/civicrm/CRM/Contact/Form/Edit/TagsAndGroups.php).`
  
  I also noticed that the tag box at the bottom of the page under "Tags and Groups" has gone missing. Is there any way to fix this problem without starting from scratch?
  
  **Tags:** drupal, import, contacts
  
  > **Comments:**
  > **username_1**: Exactly the same problem here when editing or adding a contact. I can't seem to resolve the problem like AJ described because my civicrm_tag table is empty; I don't have tags. What can be the cause in my case? Please check my comment below.  
  > **username_1**: Seems to me this is a bug. When I create a new tag the warning is gone. So it occurs only when no tags exist or with the problem AJ described.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-04-27. Score: 2 | Accepted answer
  
  I figured out what happened. When I did the backup and migrate, Drupal set civicrm\_tag.used\_for to NULL. I set the field for all my tags to 'civicrm\_contact' and it fixed the problem. No more errors. I just ran this query:  
  `UPDATE civicrm_tag SET used_for='civicrm_contact';`
  
  
  ---
  
  ### Answer by username_2 on 2015-07-05. Score: 0
  
  I had deleted all my tags so the SQL query didn't help me at first.
  
  I added one tag via civiCRM, then went into phpMyAdmin and just pasted civicrm\_contact into the used\_for field. That worked, though at that point I could have used the SQL query.
  
  I was deleting all my contacts except a few administrators, so I could keep all the settings before importing 20k contacts, and also deleted all my tags when the problem occurred for me.
  
  Thanks for the solution, I would never have figured out my own version without your help.
  
  
  ---
  
  