Subscribe to own topics automatically
Quote from Guillaume on September 26, 2019, 9:55 pmfunction auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);Hello @asgaros
When I put the two functions in function.php of my theme, I have an error of type E_COMPILE_ERROR
Is this code better?
function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);
function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);
Hello @asgaros
When I put the two functions in function.php of my theme, I have an error of type E_COMPILE_ERROR
Is this code better?
function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);
Quote from ukbestrong on September 30, 2019, 9:28 pmQuote from Guillaume on September 26, 2019, 9:55 pmfunction auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);Hello @asgaros
When I put the two functions in function.php of my theme, I have an error of type E_COMPILE_ERROR
Is this code better?
function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);
@asgaros Just checking which is best before I implement it?
Quote from Guillaume on September 26, 2019, 9:55 pmfunction auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);Hello @asgaros
When I put the two functions in function.php of my theme, I have an error of type E_COMPILE_ERROR
Is this code better?
function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);
@asgaros Just checking which is best before I implement it?
Quote from Guillaume on October 1, 2019, 10:18 pmfunction auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);With my forum, it works perfectly
function auto_subscribe($postID, $topicID) { global $asgarosforum; $asgarosforum->notifications->subscribe_topic($topicID); } add_action('asgarosforum_after_add_topic_submit', 'auto_subscribe', 10, 2); add_action('asgarosforum_after_add_post_submit', 'auto_subscribe', 10, 2);
With my forum, it works perfectly
Quote from Asgaros on October 3, 2019, 9:10 pmHello @guillaume @ukbestrong
The code in the last post of Guillaume is correct. That error before happened because you were using two times a version with the same name. As you already saw its enough to just declare it once.
Hello @guillaume @ukbestrong
The code in the last post of Guillaume is correct. That error before happened because you were using two times a version with the same name. As you already saw its enough to just declare it once.
Quote from ukbestrong on October 11, 2019, 9:11 amThank you so much!
Thank you so much!
Quote from Alcandau on October 4, 2020, 5:37 pmHi @asgaros
Would you consider integrating this code (auto subscribe after topic creation) into the settings of the plugin as a regular functionality ?
Thank you,
Regards,
Alcan
Hi @asgaros
Would you consider integrating this code (auto subscribe after topic creation) into the settings of the plugin as a regular functionality ?
Thank you,
Regards,
Alcan