Build Link

Look at XenForo_Route_Prefix_Members:
PHP:
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
    $action = $router->resolveActionWithIntegerParam($routePath, $request, 'user_id');
    return $router->getRouteMatch('XenForo_ControllerPublic_Member', $action, 'members');
}
You need to use resolveActionWithIntegerParam for the item.id

As for the action, you should be able to specify actionViewImage() inside your chosen ControllerPublic (see getRouteMatch)
 
Is it for the existing useralbums add-on?
If there are all necessary data in $image, you can use:

{xen:link useralbums/view-image, $image}

Check XfRu_UserAlbums_Route_Prefix_UserAlbums ;) and not that what james requested...
 
Is it for the existing useralbums add-on?
If there are all necessary data in $image, you can use:

{xen:link useralbums/view-image, $image}

Check XfRu_UserAlbums_Route_Prefix_UserAlbums ;) and not that what james requested...

Some urls weren't working on the useralbums addons

I made a few modifications to fix them, to the albums addon to allow albums owner's info when someone posts a new image, and the link wasn't working because it needed some missing image data:

newsfeed $item
PHP:
$item['content']['image_id'] = $item['content']['last_image_id'];

$item['content']['filename'] = $item['content']['last_image_filename'];

$item['content']['image_date'] = $item['content']['last_image_date'];

^^ the above fixes the image links

username+user_id of the album's owner was missing when posting a new comments on images

^^ the above also for the album owner be mentioned on the news feed

newsfeed $item
PHP:
$extra = unserialize($item['extra_data']);

$item['album_owner'] = $extra['album_owner'];

$item['thumbnail'] = $extra['thumbnail'];

to pick the info of the album's owner, so that it can be also submitted to the serialized array $extra on the newsfeed

PHP:
//XfRu_UserAlbums_ControllerPublic_Comments::actionImageAddComment(): 29
/**ADDED**/

$imagesModel = $this->getImagesModel();

$image = $imagesModel->getImageById($imageId);

$albumHash = $this->_input->filterSingle('access_hash', XenForo_Input::STRING);

$albumsModel = $this->getAlbumsModel();

try {

$album = $albumsModel->assertAlbumValidAndViewable($image['album_id'], $albumHash);

} catch (Exception $e) {

throw $this->getNoPermissionResponseException();

}

$thumbnailUrl = $imagesModel->getImageThumbnailUrl(array('data_id' => $image['data_id'], 'file_hash' => $image['file_hash']));

/**END_ADDED**/

^^ the above allows for the $album and $image data to be submitted to the newsfeed so that it can be used for additional, stuff like showing thumbnail
.........

Publishing the info to the newsfeed
PHP:
$this->getModelFromCache('XfRu_UserAlbums_Model_NewsFeed')->publishFeedItem($writer->getMergedData()+array(

'owner_name'=> $album['username'],'owner_id'=> $album['user_id'],'thumbnail'=> $thumbnailUrl) /**ADDED**/

, 'comment');

PHP:
case 'comment':
//XfRu_UserAlbums_Model_NewsFeed::publishFeedItem(): 52
$newsFeedModel->publish(

$data['user_id'],

$user['username'],

XfRu_UserAlbums_Helper::CT_ALBUM_IMAGE_COMMENT,

$data['comment_id'],

'insert',

/**ADDED**/

array(

'album_owner' =>

array(

'username'=> $data['owner_name'],

'user_id'=> $data['owner_id']

),

'thumbnail'=> $data['thumbnail']

)

/**ADDED**/

);

break;

^^ the above is just the second part that complements the part above
 
Top Bottom