elgg user profile url in a plugin

By kxx4

I am editing an outdated download counter plugin by westor. What url path is right for the highlighted part of the following code.That url is to link a visitor to the profile page of the owner of a content being viewed. 

.............

if (get_input('search_viewtype') == "gallery") {
         echo "<div class=\"filerepo_gallery_item\">";if ($vars['entity']->smallthumb) {
                echo "<p class=\"filerepo_title\">" . $file->title . "</p>";
              echo "<p><a href=\"{$file->getURL()}\"><img src=\"{$vars['url']}mod/file/thumbnail.php?                     size=small&file_guid={$vars['entity']->getGUID()}\" border=\"0\" /></a></p>";
               echo "<p class=\"filerepo_timestamp\"><small><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->username}</a> {$friendlytime}</small></p>";

I changed the code to :

        if (get_input('search_viewtype') == "gallery") {
            echo "<div class=\"filerepo_gallery_item\">";
            if ($vars['entity']->smallthumb) {
                echo "<p class=\"filerepo_title\">" . $file->title . "</p>";
                echo "<p><a href=\"{$file->getURL()}\"><img src=\"{elgg_get_site_url()}mod/file/thumbnail.php?size=small&file_guid={$vars['entity']->getGUID()}\" border=\"0\" /></a></p>";
                echo "<p class=\"filerepo_timestamp\"><small><a href=\"{elgg_get_site_url()}file/{$owner->username}\">{$owner->username}</a> {$friendlytime}</small></p>";

But it stil does not load the user's profile page.

 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking