Fatal error: Call to a member function getId()

После поста livestreet.ru/blog/17162.html, видя что реакции 0 (ноль), решил я воспользоваться плагином от vOFFka «TOP пользователей», тем самым вывести ТОП 5-пользователей. Все получилось (за что большое спасибо автору) и решил я добавить дополнительный функционал, а точнее выдрать код и убрав не нужное с /templates/skin/synio/actions/ActionProfile/sidebar.tpl

{if $oUserCurrent && $oUserCurrent->getId()!=$oUserProfile->getId()}
	<script type="text/javascript">
		jQuery(function($){
			ls.lang.load({lang_load name="profile_user_unfollow,profile_user_follow"});
		});
	</script>
        <br />
        </div>
            <a href="#" onclick="ls.user.followToggle(this, {$oUserProfile->getId()}); return false;" class="{if $oUserProfile->isFollow()}followed{/if}">{if $oUserProfile->isFollow()}{$aLang.profile_user_unfollow}{else}{$aLang.profile_user_follow}{/if}
	    </a>
	</div>
{/if}


и добавить ее в плагин «TOP пользователей» в block.usertop.tpl
	<div class="block-content">
	
		<ul class="usertop block-blog-list">
			{foreach from=$aUsertop item=oUser name="cmt"}
				<li>
					<a href="{$oUser->getUserWebPath()}" class="user">{$oUser->getLogin()}</a>

					{if $oUserCurrent && $oUserCurrent->getId()!=$oUserProfile->getId()}
						<script type="text/javascript">
							jQuery(function($){
								ls.lang.load({lang_load name="profile_user_unfollow,profile_user_follow"});
							});
						</script>		
						<a href="#" onclick="ls.user.followToggle(this, {$oUserProfile->getId()}); return false;" class="{if $oUserProfile->isFollow()}followed{/if}">
							{if $oUserProfile->isFollow()}{$aLang.profile_user_unfollow}{else}{$aLang.profile_user_follow}{/if}
						</a>
					{/if}
				</li>
			{/foreach}
		</ul>


и естественно — выскочила ошибка:

Fatal error: Call to a member function getId() on a non-object in /root/www/site.ru/templates/compiled/synio/7dys7af8hda8fhda7hfau8fha8fhafiajn.file.block.usertop.tpl.php on line 49

З.Ы. Подскажите, что я делаю не то.

2 комментария

avatar
if-ы удалите
avatar
хотя не прокатит — шаблон «не узнает» $oUserProfile
Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.