Added XenForo activity for Laravel pages

This commit is contained in:
2026-07-03 18:26:03 +02:00
parent be885ab80d
commit e33f0bd77c
17 changed files with 188 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
namespace RomhackPlaza\Master\Pub\Controller;
use RomhackPlaza\Master\Helper\Laravel;
use XF\Mvc\ParameterBag;
use XF\Mvc\Reply\AbstractReply;
use XF\Pub\Controller\AbstractController;
@@ -15,7 +16,7 @@ class News extends AbstractController {
if( !$laravelDb )
return $this->notFound();
$entry = $laravelDb->fetchRow("SELECT id, slugFROM news WHERE id = ?", $entryId);
$entry = $laravelDb->fetchRow("SELECT id, slug FROM news WHERE id = ?", $entryId);
if( !$entry )
return $this->notFound();
@@ -47,4 +48,35 @@ class News extends AbstractController {
);
}
public static function getActivityDetails(array $activities)
{
return self::getActivityDetailsForContent(
$activities,
\XF::phrase('viewing_romhackplaza_news'),
'news_id',
function (array $ids)
{
$db = Laravel::db();
if( !$db || empty($ids) )
return [];
$entries = $db->fetchAll("
SELECT id, slug, title FROM news
WHERE id IN (" . $db->quote($ids) . ")
");
$data = [];
foreach( $entries as $entry ){
$data[$entry['id']] = [
'title' => $entry['title'],
'url' => \XF::options()->homePageUrl . '/news/' . $entry['slug'],
];
}
return $data;
},
\XF::phrase('viewing_romhackplaza_database')
);
}
}