 acquia_agent/acquia_agent.module | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/acquia_agent/acquia_agent.module b/acquia_agent/acquia_agent.module
index 26b0a13..79068a9 100644
--- a/acquia_agent/acquia_agent.module
+++ b/acquia_agent/acquia_agent.module
@@ -83,6 +83,22 @@ function acquia_agent_menu() {
  * Implementation of hook_init().
  */
 function acquia_agent_init() {
+  
+  // If we do not have any current creds or connection, but there are creds
+  // provided by acquia cloud, use those.
+  if (!acquia_agent_has_credentials() && !variable_get('acquia_subscription_data', FALSE)
+    && variable_get('ah_network_key', FALSE) && variable_get('ah_network_identifier', FALSE)) {
+
+    variable_set('acquia_identifier', variable_get('ah_network_identifier', FALSE));
+    variable_set('acquia_key', variable_get('ah_network_key', FALSE));
+    $activated = acquia_agent_check_subscription();
+    
+    if ($activated) {
+      $text = 'Your site has been automatically connected to the Acquia Network subscription associated with this hosting account. ' . l(t('Change subscription', 'admin/settings/acquia-agent/setup'));
+      drupal_set_message($text, 'status', FALSE);
+    }
+  }
+  
   $hide_signup_messages = variable_get('acquia_agent_hide_signup_messages', 0);
   if (!$hide_signup_messages && arg(2) != 'acquia-agent' && empty($_POST) &&
     user_access('administer site configuration') &&
