Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

help: show number of replies of a topic in a page outside smf

Aloittaja rgpedro, toukokuu 21, 2014, 05:59:49 AP

« edellinen - seuraava »

rgpedro

Dear friends,
I would like to know how can I show the number of replies of a specific topic in a page outside SMF.
What I want to do is in a specific wordpress post, show the number of replies of the topic related to the post(I manually create the topic and then I put the link on the wordpress post).
Many many thanks.

live627

- Do you add the link to the body or inside a custom field?
- Are WordPress and SMF bridged?

rgpedro

Lainaus käyttäjältä: live627 - toukokuu 21, 2014, 11:55:00 AP
- Do you add the link to the body or inside a custom field?
- Are WordPress and SMF bridged?

First, thank you very much for your attention!
I did not bridge them, and I link the forum topic manually in the respective post, I mean, like, I creat the post in WP and in the bottom I add "discuss it here"(link to the forum) - then I would like anywhere near it, to have the reply count shown.
I can do in a custom field, or any way you think it´s best or easier.
If you think that it´s good or better to bridge them somehow, I can give it a try!
Thank you again.

margarett

If you can run PHP in that WP block, you can query SMF's database, table smf_topics and fetch the column "num_replies". The ID is in the topic link you put there ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

(PM follow-up)
I'm sorry but I'm an absolute stranger to WP's code... What I imagine you need is something like (abstract):
* You create a post and, inside, you past a link to your forum topic.
* When someone is viewing that post you created, there should be an indication of the number of replies that topic has. In order to do this, there should be a piece of code, somewhere where WP displays the posts, that:
a) checks if, in the post body, there is the following text: http://www.yourforum.com/index.php?topic= (of course, you need to adjust it with your forum URL)
b) if yes, then fetch the topic ID --> the number after the "=" and the following "." (because you should paste something like 123455.0)
c) if yes, query SMF's database, table "smf_topics" and retrieve the column "num_replies", WHERE id_topic = the_topic_id_you_got_in_previous_point
d) if yes and the query presented some results, append some text, eg: "This topic has XX replies", where "XX" is the result of the previous query.

This is something you should take to WP support/community, probably. This pseudo-code should be enough for someone who can work WP's code...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair


Advertisement: