Please or Register to create posts and topics.

Forum Topic or Post to Discord

Hello, I’m fairly new to php and this Asgaros Forum, – amazing work by the way – a forum layout as I think it has to be.
Anybody has tried to code a send to Discord channel function, to display in a Discord channel the latest posts or topics?

function submit_info($postID, $topicID) {
  global $asgarosforum;
  $groupIDs = get_term_meta($asgarosforum->current_category, 'usergroups', true);
  // IDs of usergroups for category.
  // Can get more information about it with:
  // AsgarosForumUserGroups::getUserGroupBy($groupID)
  print_r('<pre>');
  print_r($groupIDs);
  print_r('</pre>');
  // Access level for category.
  $accessLevel = get_term_meta($asgarosforum->current_category, 'category_access', true);
  print_r('<pre>');
  print_r($accessLevel);
  print_r('</pre>');
  die();
}
add_action('asgarosforum_after_add_topic_submit', 'submit_info', 10, 2);

// Get latest Topic
global $asgarosforum;
$link = html_entity_decode($asgarosforum->getLink('topic', $asgarosforum->current_topic, false, '#postid-'.$asgarosforum->current_post));

//Get latest Post
global $asgarosforum;
$link = html_entity_decode($asgarosforum->get_postlink($asgarosforum->current_topic, $asgarosforum->current_post));

I found this here, and I like to ask, if this is still a working solution to get the topics or posts hooked.
Thanks for your help

 

Hello @dirkb

The hook is still fine, but it has six parameters now:

  • post-ID
  • topic-ID
  • subject
  • content
  • link
  • author-ID
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Please complete the code, somehow I can't make it work.
Thank you
:)