Rushikesh Solanki
Rushikesh Solanki

Reputation: 173

How To Display Only Owner Name?

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

Upvotes: 0

Views: 65

Answers (1)

Alberto Bricio
Alberto Bricio

Reputation: 432

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!

Upvotes: 1

Related Questions