<?php

/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=usercom
Part=tags
File=usercom.tags
Hooks=users.details.tags
Tags=users.details.tpl:{USERS_DETAILS_COMMENTS_COUNT},{USERS_DETAILS_COMMENTS_DISPLAY},{USERS_DETAILS_RATINGS},{USERS_DETAILS_USERCOM}
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]
==================== */

defined('SED_CODE') or die('Wrong URL.');
include('plugins/usercom/lang/usercom.'.$lang.'.lang.php');

list($usr['read_wall'], $usr['write_wall'], $usr['admin_wall']) = sed_auth('plug', 'usercom');

$userrights = sed_auth_build($urr['user_id'] ,$urr['user_maingrp']);
$usr['auth']['plug']['usercom_grp']=$userrights['plug']['usercom'];
$carread = sed_auth('plug', 'usercom_grp', 'R');

$adminmode=$cfg['plugin']['usercom']['adminmode'];

$wall = (!$adminmode) ? ($usr['write_wall'] && $carread) : ($usr['admin_wall'] || $urr['user_id']==$usr['id']);

if ($wall)
{
	$item_code = 'u'.$urr['user_id'];
	$item_url = sed_cc('users.php?m=details&id='.$urr['user_id']);

	list($comments_link, $comments_display, $comments_count) = sed_build_comments($item_code, $item_url, true);
	list($ratings_link, $ratings_display) = sed_build_ratings($item_code, $item_url, true);

	$t->assign(array(
		"USERS_DETAILS_COMMENTS" => $comments_link,
		"USERS_DETAILS_COMMENTS_COUNT" => $comments_count,
		"USERS_DETAILS_COMMENTS_DISPLAY" => $comments_display,
		"USERS_DETAILS_RATINGS" => $ratings_link,
	));
}
elseif ($usr['write_wall'])
{
	$t->assign(array(
		"USERS_DETAILS_USERCOM" => $L['usercom'],
	));
}
?>