Sorted. Borrowing from Tim here,
http://wiki.modxcms.com/index.php/MODx_site_menu_in_external_PHP_app, in the php file containing all the modx stuff I’ve inserted into the forum template, I’ve added to the top:
define('MODX_SITE_BASE_URL', '/');
And then after:
$modx->connect();
$modx->getSettings();
... I’ve added:
$modx->config['base_url'] = MODX_SITE_BASE_URL;
ie
<?php
// ----- CONFIG -----
$path = dirname(__FILE__).'/'; // '/path/to/api/file'
define('MODX_SITE_BASE_URL', '/');
// ------------------
include_once($path.'modxapi.php');
$modx = new MODxAPI();
// connect to db and load settings
$modx->connect();
$modx->getSettings();
// Set the base URL for any MODx snippets
$modx->config['base_url'] = MODX_SITE_BASE_URL;
$html= $modx->runSnippet('Wayfinder', array('startId' => '0', 'level' => '2', 'parentClass' => 'trigger', 'parentRowTpl' => 'p7expParentRow', 'outerTpl' => 'p7expOuter', 'innerTpl' => 'p7expInner', 'rowTpl' => 'p7expRow', 'outerClass' => 'navbar'));
echo $html;
?>