Please or Register to create posts and topics.

Subscribe to own topics automatically

12

You can use the asgarosforum_after_add_thread_submit hook to ensure that users automatically have a subscription for new topics created by them. Simply add the following code to your themes functions.php file:

function auto_subscribe($postID, $topicID) {
  global $asgarosforum;
  $asgarosforum->notifications->subscribe_topic($topicID);
}
add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2);

 

Yeye and Guillaume have reacted to this post.
YeyeGuillaume
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

很赞,正好需要

An error occurs in this line:

 AsgarosForumNotifications::subscribeTopic();

Hello @childledj

Thanks for the information. I made some changes in one of the last updates and fixed the code in the first post. 🙂

childledj has reacted to this post.
childledj
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on April 3, 2018, 9:26 am

Hello @childledj

Thanks for the information. I made some changes in one of the last updates and fixed the code in the first post. 🙂

Thanks! It's awesome!

Asgaros has reacted to this post.
Asgaros

This is only test

Uploaded files:
  • cevap-sor-retina-logo.png

When I paste this code into my theme function I got empty blank page when I press subment "for my topic"

What I'm doing wrong?

Hello @narzan5137

The code changed in one of the last updates. Please try it again with the updated code in the first post which should work now.

Guillaume has reacted to this post.
Guillaume
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Hi all,

Is it possible to add some code to auto subscribe a member to a topic after they reply to it?

Regards,

Rick

Guillaume has reacted to this post.
Guillaume

Hello @ukbestrong

Please try the following code:

function auto_subscribe($postID, $topicID) {
  global $asgarosforum;
  $asgarosforum->notifications->subscribe_topic($topicID);
}
add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
12