<?php defined('COT_CODE') or die('Wrong URL');
/* ====================
[BEGIN_COT_EXT]
Hooks=usertags.main
[END_COT_EXT]
==================== */

// Provides social accounts tags

require_once cot_incfile('hybridauth', 'plug');

global $hybridauth_config;

// Sync extra fields if necessary
foreach ($hybridauth_config['providers'] as $key => $val)
{
	$name = strtolower($key);
	if ($val['enabled'])
	{
		if(!empty($user_data['user_'.$name.'_id'])) {
  		$temp_array[strtoupper($name.'_id')] = $user_data['user_'.$name.'_id'];
      $temp_array[strtoupper($name.'_url')] = $user_data['user_'.$name.'_url'];

      if($name == 'vkontakte') {
        $temp_array['SOCIAL_VK'] = $user_data['user_' . $name . '_url'];
      } elseif($name == 'facebook') {
        $temp_array['SOCIAL_FB'] = $user_data['user_' . $name . '_url'];
      }
    }
	}
}
