Article and Forum Connect: XenForo and WordPress

Article and Forum Connect: XenForo and WordPress 1.0.6

No permission to download

Sanmu

Active member
Hi, I paid money to my WordPress author to disable the Ajax comment and fix some CSS issues.

Started to use it on my live site. Almost perfect. No repeat comment now.

But my WordPress theme author says in the site portal the comment count only will be shown after user login from Xenforo forum.

Is it true? Can you please look into it? I can share the site FTP with you.

Do you have any examples, live sites which are using this plugin?
 
Last edited:

mattrogowski

Well-known member
I'm really not sure what they mean by that to be honest. The internal comment count based on the number of XF posts is updated when the comments_template hook runs to render the template, and it uses the get_comments_number hook to display that stored value. It hasn't got anything to do with being logged in anywhere at all. I can look into it if you want but if these hooks are not working then your theme must be doing something extremely unusual because these are just standard WP hooks.

We have some clients looking to use this plugin in the near future, however I haven't got a lit of any other people who have downloaded and installed it.
 

Sanmu

Active member
I think the wordpress theme author may have not enough skill about wordpress. They told me they know little about plugins. Paid 100USD to them but they fixed nothing...

Great, I will PM all my details including server FTP to you.
 

mattrogowski

Well-known member
Have explained in more detail via PM but essentially the issue here was that the theme had custom code to manually make API calls to load the reply count, which a) wasn't done correctly and b) isn't necessary in the first place because the plugin hooks into the default WordPress get_comments_number function and returns a reply count that is automatically updated when the comments are loaded on a post. No edits should be required to any theme built in a standard way for the plugin to work. Like I'm sure most WP plugins are, this plugin is built to be dropped in and doesn't require any theme edits to work. The comments template gets automatically swapped out and inherits the same styling of the comments for the theme, and the reply count is automatically swapped out from the internal WP comment count.
 

Sanmu

Active member
Hi, @mattrogowski , can you please directly help me change the codes to let them work properly? I have zero knowledge about how these codes should be put and where they should be put.
 

Sanmu

Active member
The theme author told me to recover the comment section code to the original WordPress comment. But still have a bug that the counter is not working.
______

PS>. The theme author just told me to change the code in the place template-parts/post-cards/card-meta.php, from
$post->comment_count; to get_comments_number();

Now it works very well, this is just what I want~! Great plugin! Finally solved the problem.
 
Last edited:

mattrogowski

Well-known member
Okay cool, glad it's working. Yes it shouldn't be outputting comment_count directly, should be calling get_comments_number() so it runs the hooks, just a mistake in the theme if it was directly using the value like that.
 

Rushster

Member
Thought I would give this another go :)

Anyway, managed to connect everything fine, adding the post to Xenforo works but I am getting this error in WP when I try and view the post on the WP side:

Uncaught XFApi\Exception\RequestException\NoPermissionRequestException: You do not have permission to view this page or perform this action.

This is a similar error to the one you get when you haven't set up a user with the API permissions. Any idea why this error is happening when you simply try to view the post on WP?
 

mattrogowski

Well-known member
Thought I would give this another go :)

Anyway, managed to connect everything fine, adding the post to Xenforo works but I am getting this error in WP when I try and view the post on the WP side:

Uncaught XFApi\Exception\RequestException\NoPermissionRequestException: You do not have permission to view this page or perform this action.

This is a similar error to the one you get when you haven't set up a user with the API permissions. Any idea why this error is happening when you simply try to view the post on WP?
Is there a longer stack trace for that? Unless the thread has been deleted or something I can't see what would be throwing a permissions error.
 

Sado Yasashii

Active member
Hello.
Tell me, please. The free version does not provide that when you create a new WP entry, it automatically creates a theme in XF? Because when I try to publish it gives me an error, if I specify the topic ID manually, it skips the publication. Is it so designed in the free version or do I do something wrong? Tried 2 ways (XF Session Cookie/Connected WP/XF users), same thing everywhere. I manually specified any XF theme ID and the messages synced.

And the second question, is it necessary to configure "Advanced Settings" below? Just haven't set it up and don't quite understand if it's needed...
 

mattrogowski

Well-known member
Yes, this is one of the primary purposes of the plugin. Please make sure you have followed the instructions here: https://help.themehouse.com/docs/article-and-forum-connect/automatic-thread-creation

The step people seem to miss the most is the "Setting up XenForo API access for WordPress users" step. You need to specify the forum user ID in the settings for your WordPress user so it knows which user to create the thread as.

Unless you have a specific need to change any of the advanced settings, you do not need to change them, no.
 

Sado Yasashii

Active member
The funny thing is, I did everything according to the instructions. Selected the forum, selected the prefix, the user, specified the automatic creation of themes. Selected the category and category prefix. API is prescribed in XF, the link is, as well as synchronization of messages, everything works, the plugin works, but does not work automatically create themes. When publishing an unknown error and can not understand what is wrong. I can only draw one conclusion, that the free version of the plugin does not provide for automatic creation of themes, or a bug between WP 6.0 / XF 2.2.9. The plugin for the test put on the bare bases, and here is the problem. :(
 
Last edited:

mattrogowski

Well-known member
It is not a bug - as I said, you need to enter the forum user ID in the WordPress user settings, like this:

1654351990492.png

WP admin > Users > select the user > scroll to the Article and Forum Connect Settings > enter the forum user ID.

The plugin works fine if it is configured correctly.
 
Last edited:

Sado Yasashii

Active member
This point about the user exactly did not set up, in the instruction did not see information about it. But even by specifying XF user ID and writing a new API key for it, the problem did not go away. The same error when publishing. I don't understand what he doesn't like. All the basic settings are filled in and specified. Any other ideas?
 

Attachments

  • Screen Shot 06-04-22 at 05.46 PM 003.PNG
    Screen Shot 06-04-22 at 05.46 PM 003.PNG
    46.7 KB · Views: 5
  • Screen Shot 06-04-22 at 05.46 PM 002.PNG
    Screen Shot 06-04-22 at 05.46 PM 002.PNG
    45.9 KB · Views: 5
  • Screen Shot 06-04-22 at 05.46 PM 001.PNG
    Screen Shot 06-04-22 at 05.46 PM 001.PNG
    53.5 KB · Views: 4
  • Screen Shot 06-04-22 at 05.46 PM.PNG
    Screen Shot 06-04-22 at 05.46 PM.PNG
    46.3 KB · Views: 5
  • Screen Shot 06-04-22 at 05.45 PM.PNG
    Screen Shot 06-04-22 at 05.45 PM.PNG
    109.3 KB · Views: 4
  • Screen Shot 06-04-22 at 05.44 PM 001.PNG
    Screen Shot 06-04-22 at 05.44 PM 001.PNG
    118.9 KB · Views: 4
  • Screen Shot 06-04-22 at 05.44 PM.PNG
    Screen Shot 06-04-22 at 05.44 PM.PNG
    168.6 KB · Views: 4
  • Screen Shot 06-04-22 at 05.42 PM.PNG
    Screen Shot 06-04-22 at 05.42 PM.PNG
    75.4 KB · Views: 4

mattrogowski

Well-known member
Have you definitely put the super user API key in the main settings and not the user API key? You also didn't need to create the user API key, you only needed to enter the user ID. The instructions say "Depending on your chosen integration method, you may already have an XF API key entered here. If you do not, you will need to enter the user ID of the forum user this user relates to", so you only needed to enter the API key.

Can you check your WP error log to see what the actual error message is?
 

Sado Yasashii

Active member
The API key has exactly put it all in. Screenshots above for confirmation sent to you.

Error Log:
Code:
[04-Jun-2022 15:05:21 UTC] PHP Fatal error:  Uncaught XFApi\Exception\RequestException\NoPermissionRequestException: You do not have permissions to view this page or perform this action. in /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php:396
Stack trace:
#0 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php(362): XFApi\Client->handleException(403, Array)
#1 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php(211): XFApi\Client->request('POST', 'threads', Array, Array, Array)
#2 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Domain/AbstractDomain.php(67): XFApi\Client->post('threads', Array, Array, Array)
#3 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Domain/XF/ThreadDomain.php(16): XFApi\Domain\AbstractDomain->post('threads', Array, Array)
#4 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/src/AudentioForumConnect/Actions/TransitionPostStatus.php(102): XFApi\Domain\XF\ThreadDomain->create('2', 'Demo', 'test demo\n\n[URL...', Array)
#5 /var/www/host_user/data/www/localhost/wp-includes/class-wp-hook.php(307): AudentioForumConnect\Actions\TransitionPostStatus::callback('publish', 'auto-draft', Object(WP_Post))
#6 /var/www/host_user/data/www/localhost/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#7 /var/www/host_user/data/www/localhost/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#8 /var/www/host_user/data/www/localhost/wp-includes/post.php(5303): do_action('transition_post...', 'publish', 'auto-draft', Object(WP_Post))
#9 /var/www/host_user/data/www/localhost/wp-includes/post.php(4563): wp_transition_post_status('publish', 'auto-draft', Object(WP_Post))
#10 /var/www/host_user/data/www/localhost/wp-includes/post.php(4775): wp_insert_post(Array, true, false)
#11 /var/www/host_user/data/www/localhost/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(831): wp_update_post(Array, true, false)
#12 /var/www/host_user/data/www/localhost/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->update_item(Object(WP_REST_Request))
#13 /var/www/host_user/data/www/localhost/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/posts/(?...', Array, NULL)
#14 /var/www/host_user/data/www/localhost/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request))
#15 /var/www/host_user/data/www/localhost/wp-includes/rest-api.php(394): WP_REST_Server->serve_request('/wp/v2/posts/11...')
#16 /var/www/host_user/data/www/localhost/wp-includes/class-wp-hook.php(307): rest_api_loaded(Object(WP))
#17 /var/www/host_user/data/www/localhost/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#18 /var/www/host_user/data/www/localhost/wp-includes/plugin.php(524): WP_Hook->do_action(Array)
#19 /var/www/host_user/data/www/localhost/wp-includes/class-wp.php(398): do_action_ref_array('parse_request', Array)
#20 /var/www/host_user/data/www/localhost/wp-includes/class-wp.php(770): WP->parse_request('')
#21 /var/www/host_user/data/www/localhost/wp-includes/functions.php(1330): WP->main('')
#22 /var/www/host_user/data/www/localhost/wp-blog-header.php(16): wp()
#23 /var/www/host_user/data/www/localhost/index.php(17): require('/var/www/host_user...')
#24 {main}
  thrown in /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php on line 396
[04-Jun-2022 15:05:21 UTC] PHP Fatal error:  Uncaught XFApi\Exception\RequestException\NoPermissionRequestException: You do not have permissions to view this page or perform this action. in /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php:396
Stack trace:
#0 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php(362): XFApi\Client->handleException(403, Array)
#1 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php(211): XFApi\Client->request('POST', 'threads', Array, Array, Array)
#2 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Domain/AbstractDomain.php(67): XFApi\Client->post('threads', Array, Array, Array)
#3 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Domain/XF/ThreadDomain.php(16): XFApi\Domain\AbstractDomain->post('threads', Array, Array)
#4 /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/src/AudentioForumConnect/Actions/TransitionPostStatus.php(102): XFApi\Domain\XF\ThreadDomain->create('2', 'Demo', 'test demo\n\n[URL...', Array)
#5 /var/www/host_user/data/www/localhost/wp-includes/class-wp-hook.php(307): AudentioForumConnect\Actions\TransitionPostStatus::callback('publish', 'publish', Object(WP_Post))
#6 /var/www/host_user/data/www/localhost/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#7 /var/www/host_user/data/www/localhost/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#8 /var/www/host_user/data/www/localhost/wp-includes/post.php(5303): do_action('transition_post...', 'publish', 'publish', Object(WP_Post))
#9 /var/www/host_user/data/www/localhost/wp-includes/post.php(4563): wp_transition_post_status('publish', 'publish', Object(WP_Post))
#10 /var/www/host_user/data/www/localhost/wp-includes/post.php(4775): wp_insert_post(Array, false, true)
#11 /var/www/host_user/data/www/localhost/wp-admin/includes/post.php(426): wp_update_post(Array)
#12 /var/www/host_user/data/www/localhost/wp-admin/post.php(227): edit_post()
#13 {main}
  thrown in /var/www/host_user/data/www/localhost/wp-content/plugins/article-forum-connect/vendor/xfapi/xfapi-php/src/Client.php on line 396
 

mattrogowski

Well-known member
Okay, so still seems to be an issue with the API details. Double check the XenForo URL and XenForo API Key fields are correctly set (XenForo API Key needs to be the Super User key), and that 1 is the correct user ID to set on the user. The error is coming from XenForo, it's returning a 403 Forbidden error (XFApi\Client->handleException(403, Array), so it's not accepting the API details. The only reason for this will be if the provided values are incorrect.
 
Top