Usually, if you contribute a forum sending a request, you want to know if someone replies. On bbPress you can just activate the notifications on the topic you’re creating. But it comes unchecked by default.

And in a world of distracted people, assuming the most of your participant want to know if they set a discussion on fire, prechecking it could be of help.

Very easy, just adding a simple snippet of JS after the subscription checkbox.

add_action('bbp_theme_after_topic_form_subscriptions', function () {
echo '
  <script>
  var e = document.getElementById("bbp_topic_subscription");
  if (e) e.checked = true;
  </script>';
});

The code is not the most beautiful in the World, but it works. A similar action is available for the reply form, you need to use the action bbp_theme_after_topic_form_subscriptions.

You can use another add_action() if you want event the subscription on reply checkbox be pre-checked (actually you surely want it).

The code in this case will look like:

add_action('bbp_theme_after_topic_form_subscriptions', 'my_precheck');
add_action('bbp_theme_after_reply_form_subscriptions', 'my_precheck');

function myprecheck() {
echo '
  <script>
  var e = document.getElementById("bbp_topic_subscription");
  if (e) e.checked = true;
  </script>';
}

You can add all the in you child theme functions.php.

My excuses for my bad english but it's the only way I have to communicate with you. Would you suggest a correction? Leave a comment, thank you!
Categories: WordPress

0 Comments

Leave a Reply