How To Display Only Owner Name?

66 Views Asked by At

I Wa't to display only Owner Name..in My Widget.. but i don't know how to do that.

Image That Shows Owner Name

1

There are 1 best solutions below

0
Alberto Bricio On

Elgg framework has a MVC architecture where View knows Model/entities.

To solve this, View needs to get the owner entity which has to display in your widget, so: in elgg/mod/(your widget folder)/views/default/widgets/(your name widget)/content.php, you should write the code of below:

<?php
$widget = elgg_extract('entity', $vars);
echo $widget->getOwnerEntity()->username;

Hope it helps!