Hiya
I'm using this for both Wordpress and Xenforo, and have no issues with it in the main.
However, I've a bit of code I'm using in Wordpress to get the current user from Xenforo, so that I can show various items depending on usergroups
Basically along this lines
This all works fine in my test site, but when I try it on my live site, which has the Cloudflare plug-in installed, I get an error. When I temporarily disable the Cloudflare plug-in it works fine.
It's probably my shoddy code attempting to hack WP and XF together, but here's the error I get:
Any pointers would be helpful. Even if it's "your code is rubbish, start again!"
I'm using this for both Wordpress and Xenforo, and have no issues with it in the main.
However, I've a bit of code I'm using in Wordpress to get the current user from Xenforo, so that I can show various items depending on usergroups
Basically along this lines
PHP:
$fileDir = $_SERVER['DOCUMENT_ROOT'].'/community'; # relative path from this script to the Xenforo root
require($fileDir . '/src/XF.php');
XF::start($fileDir);
$app = XF::setupApp('XF\Pub\App');
$app->start();
$xfuser=XF::visitor();
This all works fine in my test site, but when I try it on my live site, which has the Cloudflare plug-in installed, I get an error. When I temporarily disable the Cloudflare plug-in it works fine.
It's probably my shoddy code attempting to hack WP and XF together, but here's the error I get:
Code:
An exception occurred: [ArgumentCountError] Too few arguments to function XF\Mvc\Entity\Repository::__construct(), 0 passed in /home/redacted/public/wp-content/plugins/app-for-cf/src/DigitalPoint/Cloudflare/Base/Pub.php on line 176 and exactly 2 expected in src/XF/Mvc/Entity/Repository.php on line 14
1. **XF\Mvc\Entity\Repository->__construct()** in **/home/redacted/public/wp-content/plugins/app-for-cf/src/DigitalPoint/Cloudflare/Base/Pub.php** at line **176**
2. **DigitalPoint\Cloudflare\Base\Pub::handleHeaders()** in **/home/redacted/public/wp-includes/class-wp-hook.php** at line **326**
3. **WP_Hook->apply_filters()** in **/home/redacted/public/wp-includes/plugin.php** at line **205**
4. **apply_filters()** in **/home/redacted/public/wp-includes/class-wp.php** at line **558**
5. **WP->send_headers()** in **/home/redacted/public/wp-includes/class-wp.php** at line **821**
6. **WP->main()** in **/home/redacted/public/wp-includes/functions.php** at line **1336**
7. **wp()** in **/home/redacted/public/wp-blog-header.php** at line **16**
8. **require()** in **/home/redacted/public/index.php** at line **17**
Any pointers would be helpful. Even if it's "your code is rubbish, start again!"