Require tags for topics/replies + AJAX
-
Hello everyone,
I would like to require tags for topics and replies. I managed to find some help.
Here is the code which you can have in your functions.php file.`
/*
@ Require tags for posting topics, replies
*/
add_action( ‘bbp_new_topic_pre_extras’, ‘check_front_end_tags_wpse_82956′ );
add_action( ‘bbp_new_reply_pre_extras’, ‘check_front_end_tags_wpse_82956′ );function check_front_end_tags_wpse_82956(){
if( empty( $_POST['bbp_topic_tags'] ) )
{
// WORKAROUND FOR LINKS WITH HASH TAG, e.g., topic/lorem-ipsum#post-91
// Necessary when posting multiple replies that generate hashed links
// OTHERWISE A SIMPLE href=”javascript:history.go(-1) WOULD WORK
?>
function goBack() {
if (window.history && history.pushState) {
history.replaceState(“”, “”, “?no-tags=true);
history.go(-1);
}
}
<?phpwp_die( '‘ . __( ‘« « Please type at least one tag’ ) . ‘‘ );
}
}
`
But I would like to use AJAX and a modal dialog for displaying the requirements when someone creates a topic or replies and forgets to type in a tag.
How can I do this, can someone give me guidance here?regards
You must be logged in to reply to this topic.