Forum Replies Created
-
In reply to: replies not working sometimes
what is the FFEPremium tag ?
In reply to: replies not working sometimesOK There seems to be no fixed reason that the replies are rejected, one minute it works and next it does not. I have 2 pages 1 Thank you page and 1 error page. I am running through cloudflare so I am not sure if that is causing the problem.
This code I have added to the function.php seems to be working// 1 Check if the reply submission has missing fields & redirect to the error page
add_action(‘template_redirect’, ‘rew_check_reply_submission’);function rew_check_reply_submission() {
// Check if a reply is being submitted
if (isset($_POST[‘bbp_reply_submit’])) {
// Check if required fields are missing (e.g., content, forum, topic)
if (empty($_POST[‘bbp_reply_content’]) || !isset($_POST[‘bbp_forum_id’]) || !isset($_POST[‘bbp_topic_id’])) {
// Grab the topic ID from the form (ensure it’s valid)
$topic_id = !empty($_POST[‘bbp_topic_id’]) ? intval($_POST[‘bbp_topic_id’]) : 0;// Redirect to the error page with the topic ID
wp_redirect(site_url(‘/reply_error/?topic_id=’ . $topic_id));
exit; // Stop the script execution after the redirect
}
}
}// 2️ Modify reply redirection: If pending, go to moderation page
add_filter(‘bbp_new_reply_redirect_to’, ‘rew_pending_check’, 30, 3);function rew_pending_check($reply_url, $redirect_to, $reply_id) {
$status = get_post_status($reply_id);
$topic_id = bbp_get_reply_topic_id($reply_id);// If the reply is pending moderation, redirect to the moderation page
if ($status === ‘pending’) {
return site_url(‘/moderation/?moderation_pending=’ . $topic_id);
}return $reply_url; // Otherwise, return the usual redirect URL
}// 3 Create a shortcode [mod-return] to display “Return to Topic” on error and moderation pages
add_shortcode(‘mod-return’, ‘mod_return’);function mod_return() {
// Get the topic ID from the URL (works for both error and moderation pages)
$topic_id = !empty($_GET[‘topic_id’]) ? intval($_GET[‘topic_id’]) : (!empty($_GET[‘moderation_pending’]) ? intval($_GET[‘moderation_pending’]) : 0);// If a valid topic ID is found, generate the “Return to Topic” button
if ($topic_id) {
$topic_url = get_permalink($topic_id);if ($topic_url) {
return ‘<div class=”mod-return” style=”text-align:center; margin-top:20px;”>
<a href=”‘ . esc_url($topic_url) . ‘”
style=”color:white; background-color:tomato; padding:12px 20px;
border-radius:5px; text-decoration:none; font-size:16px;”>
⬅ Return to Topic</div>’;
}
}// If no valid topic ID found, return nothing or a message
return ‘<p style=”text-align:center; color:red;”>No topic found to return to.</p>’;
}In reply to: replies not working sometimesOK so just to let you know this is what I have and it seems to be working, There does not seem to be any fixed reason that the replies get rejected without warning. I am running cloudflare so I cannot rule that out.
I have two pages, a thank you page and an error page, this code is in my function.php which seems to be working.// 1 Check if the reply submission has missing fields & redirect to the error page add_action('template_redirect', 'rew_check_reply_submission'); function rew_check_reply_submission() { // Check if a reply is being submitted if (isset($_POST['bbp_reply_submit'])) { // Check if required fields are missing (e.g., content, forum, topic) if (empty($_POST['bbp_reply_content']) || !isset($_POST['bbp_forum_id']) || !isset($_POST['bbp_topic_id'])) { // Grab the topic ID from the form (ensure it's valid) $topic_id = !empty($_POST['bbp_topic_id']) ? intval($_POST['bbp_topic_id']) : 0; // Redirect to the error page with the topic ID wp_redirect(site_url('/reply_error/?topic_id=' . $topic_id)); exit; // Stop the script execution after the redirect } } } // 2️ Modify reply redirection: If pending, go to moderation page add_filter('bbp_new_reply_redirect_to', 'rew_pending_check', 30, 3); function rew_pending_check($reply_url, $redirect_to, $reply_id) { $status = get_post_status($reply_id); $topic_id = bbp_get_reply_topic_id($reply_id); // If the reply is pending moderation, redirect to the moderation page if ($status === 'pending') { return site_url('/moderation/?moderation_pending=' . $topic_id); } return $reply_url; // Otherwise, return the usual redirect URL } // 3 Create a shortcode [mod-return] to display "Return to Topic" on error and moderation pages add_shortcode('mod-return', 'mod_return'); function mod_return() { // Get the topic ID from the URL (works for both error and moderation pages) $topic_id = !empty($_GET['topic_id']) ? intval($_GET['topic_id']) : (!empty($_GET['moderation_pending']) ? intval($_GET['moderation_pending']) : 0); // If a valid topic ID is found, generate the "Return to Topic" button if ($topic_id) { $topic_url = get_permalink($topic_id); if ($topic_url) { return '<div class="mod-return" style="text-align:center; margin-top:20px;"> <a href="' . esc_url($topic_url) . '" style="color:white; background-color:tomato; padding:12px 20px; border-radius:5px; text-decoration:none; font-size:16px;"> ⬅ Return to Topic </a> </div>'; } } // If no valid topic ID found, return nothing or a message return '<p style="text-align:center; color:red;">No topic found to return to.</p>'; }
In reply to: replies not working sometimesHi Robin
Thank you, I have now tracked it down to the following code in my functions.phpadd_filter (‘bbp_new_reply_redirect_to’ , ‘rew_pending_check’, 30 , 3) ;
function rew_pending_check ($reply_url, $redirect_to, $reply_id) {
$status = get_post_status ($reply_id) ;
$topic_id = bbp_get_reply_topic_id( $reply_id );
if ($status == ‘pending’ ) {
$reply_url = ‘/moderation/?moderation_pending=’.$topic_id ;
}
return $reply_url ;
}add_shortcode (‘mod-return’ , ‘mod_return’ ) ;
function mod_return () {
if (!empty($_REQUEST[‘moderation_pending’] )) {
$topic_url = get_permalink( $_REQUEST[‘moderation_pending’] );
echo ‘<div class=”mod-return”><h2 style=”color:Tomato;”>Return to topic</h2></div>’;
}
}just got to work out how to bring up a different page if the post is not saved, dont warry go and have a nice holiday you deserve it.
I will post the answer when I work it out.Regards
CliveIn reply to: replies not working sometimesThe thank you message is a page with a permalink of moderation (I last changed it 5 years ago ) the title is Thank you. I cannot find where / how that is called.I think it was introduced because none of the replies are published they all go to moderation.
On the style pack 16 is ticked if I untick I do not get any thank you message.
I have tried ticking 17 and adding a message but if there is an error like they leave out the email address it just goes to the top of the topic but no message shows.
The website is wateratairports.com
In reply to: replies not working sometimesHi Robin,
Thanks for replyig.
I copied the same text from notepad into the reply, using firefox, the first time it failed the second time it worked. What I do not to understand is why if it works I get a thank you message but if it fails it just goes to the top of the topic. all the replies are hold for moderaion.
Is there a way to check that the reply was written to the database then report back to the user.In reply to: replies not working sometimesAny ideas please,
I cannot find where the thank you page is called.
In reply to: Missing title in repliesThanks Robin,
Regards
CliveIn reply to: Missing title in repliesHi Robin,
Thank you for replying.
I did find something that was said years ago about not putting the topic title into the reply record, not sure why.
So I create a record in the meta table, which is a custom field in the reply form using the following code and add the topic title as a custom field to the custom message in the Fs Poster plugin I am using to post to social media.function check_and_populate_top_title_on_edit() { global $pagenow; // Check if we are in the post.php page (edit post/reply screen) and in the admin area. if ($pagenow === 'post.php' && is_admin()) { // Get the post ID from the URL query string. $post_id = isset($_GET['post']) ? intval($_GET['post']) : 0; // If we have a valid post ID, proceed. if ($post_id) { $post = get_post($post_id); // Ensure we're working with a 'reply' post type. if ($post && $post->post_type === 'reply') { // Check if the post title is empty. if (empty($post->post_title)) { // Get the parent post ID. $parent_post_id = $post->post_parent; // Check if a parent post exists. if ($parent_post_id) { // Get the parent post data. $parent_post = get_post($parent_post_id); // If the parent post exists and has a title, update the 'top_title' custom field. if ($parent_post && !empty($parent_post->post_title)) { // Add or update the 'top_title' meta field with the parent post's title. update_post_meta($post_id, 'top_title', $parent_post->post_title); } } } } } } } add_action('load-post.php', 'check_and_populate_top_title_on_edit');
In reply to: Missing title in repliesHi,
Does anyone know why the post_title is blank in the reply ?
If I populate the reply post_title with the title from the topic is it going to give me problems ?Clive
In reply to: Missing title in repliesHi,
Still trying to sort this, When I create a new reply is there a way to create a custom field of the topic title?
I see there are lots of custom fields but not the topic title.Clive
In reply to: “H1 tag missing” in bing site searchHi,
Thanks for replying, I am not sure how to check the template but I have looked at the page source in the browser and checked that there is an H1 tags and all pages show it is there. I am using the Astra Theme.In reply to: alt attribute missing for bing searchHi Robin,
Works great, thank youIn reply to: alt attribute missing for bing searchHi Robin,
That looks great, I will try it.
Thank you
CliveIn reply to: bbpress new topic too wide on mobileYes I will, it reduces the size on the desktop as well but most of the users are on mobiles.
Thank again for you help.In reply to: bbpress new topic too wide on mobileI have found what I think is it, I put in the change
}
.bbp-the-content-wrapper {
width: 80%;
height: 100% !important
}
which does bring it all onto the screen but I get a scroll bar down the right hand side it does not do anything but it is there.
does what I have done make any sense ?In reply to: bbpress new topic too wide on mobileI do yes but I have purged the cache and set cloudflare to development mode which turns of cache, could you try again please.
In reply to: bbpress new topic too wide on mobileyes I now have both of them there
In reply to: bbpress new topic too wide on mobileI had
@media screen and (max-width: 480px) {
.bsp-topic-rules {
width : 60% !important
}
}in the bbp style pack>custom css
I have tried adding the new one, but it is the same, I also tried removing the other one
In reply to: bbpress new topic too wide on mobileI am adding it to the theme additional css
In reply to: bbpress new topic too wide on mobileThat does not seem to be working
In reply to: bbpress new topic too wide on mobileIn reply to: bbpress new topic too wide on mobileHi,
I have had this problem for 3years using the twentytwelve theme, for various reasons I am just changing to the Astra theme and still getting the same problem.
It would be nice to get it sorted.In reply to: Hitting 50 forum limit? What can I do?Hi, Sorry I found it it is
function bbp_increase_topic_per_page( $args = array() ) {
$args[‘posts_per_page’] = 150 ;
return $args;
}
add_filter( ‘bbp_before_has_topics_parse_args’, ‘bbp_increase_topic_per_page’ );If anyone needs it
In reply to: Hitting 50 forum limit? What can I do?Hi,
I use functionfrom Robin,
function bbp_increase_subforums_per_page( $args = array() ) {
$args[‘posts_per_page’] = 100 ;
return $args;
}
add_filter( ‘bbp_before_forum_get_subforums_parse_args’, ‘bbp_increase_subforums_per_page’ );Any ideas how I can increase the number of topics per page ?, it is set at 100 I need to increase this to 150, please