Skip to:
Content
Pages
Categories
Search
Top
Bottom

Subscribe to Forum


  • newtech1
    Participant

    @newtech1

    I and other forum users have clicked on the ‘Subscribe’ link under forums but we are not getting any email notifications of posted topics in the forum. What can be the issue? Where do you set up the settings for forum subscription emails? Note: Subscriptions are turned on in forum settings.

    BTW my WP site smtp mail feature is fully functional.

    PS My forum is setup so that topics are posted via the backend, not the front end.

Viewing 25 replies - 1 through 25 (of 25 total)

  • newtech1
    Participant

    @newtech1

    Also, is it feasible to make it so the default for all users is to be subscribed?


    newtech1
    Participant

    @newtech1

    What could be causing notifications to not be received, notifications not being sent. I am using GoSMTP and other emails are sent out with no problem. Where is the coding for this feature?

    Does it matter if topic posts are made from the frontend or the backend for the subscribe notification to work? In our forum topics are created only in the backend by moderators.


    Robin W
    Moderator

    @robin-w

    so if you install the ‘check and log email’ plugin and set up logging, you can see if they are being sent

    Check & Log Email


    ibnat
    Participant

    @ibnat

    If you install the bbpress style pack plugin by Robin W you can set all new members to be automatically subscribed in the subscription management tab of the plugin. There are also settings for how email notifications are handled in the subscription emails tab.

    To be honest, I find that the style pack plugin is essential for running bbpress.


    newtech1
    Participant

    @newtech1

    Finally getting back to this topic.
    I have installed the ‘check and log email’ plugin. It shows all other plugins are sending out emails, but bbpress is not sending out emails to subscribers. What could be the issue.

    The way we use bbpress is that the topics are posted via the backend. All users are posting as moderators. Would there be any reason that would be preventing email notifications from being sent. I do not see any reason that would be the case.


    newtech1
    Participant

    @newtech1

    I should mention I installed the style pack. I have verified users that are subscribed to the forum.
    I went into Subscription Emails and ran ‘Sent Test Topic Email’. The test email was sent out with no problem. I then posted a topic in the forum. No email notification was sent out.

    I am thinking if topics are posted from the backend, or maybe from moderators, that email notifications do not work. Can someone test this? I cannot test it because we do not have topic creation on the front end. (We have customized fields that we could never get to work on the frontend so made topic creation via backend.)


    webcreations907
    Participant

    @webcreations907

    Hello,

    I’m just a user here, but curious if you checked your spam folder? Also do you have lots of subscribers on the forums you are posting topics to?


    newtech1
    Participant

    @newtech1

    Currently only have a few sunscribeessubscribers since it is not working.

    Not going into spam I know because check and login plug-in shows no emails going out.


    webcreations907
    Participant

    @webcreations907

    The code I just posted isn’t showing @robin-w ?


    webcreations907
    Participant

    @webcreations907

    Will try posting again..

    You can try the below code, either add it to your theme’s functions.php file, or use the code snippets plugin.

    Make sure to select your “Forum” when creating a topic and make sure the forum has subscribers to test it out on.

    
    if( function_exists( 'bbp_get_topic_post_type' ) ){
    	function newtech1_bbpress_new_topic( $post ) {
    		if( isset( $post->post_type ) && $post->post_type == bbp_get_topic_post_type() ){
    			do_action( 'bbp_new_'.bbp_get_topic_post_type(), $post->ID , $post->post_parent, [] , $post->post_author );
    		}
    	}
    	add_action(  'draft_to_publish' ,  'newtech1_bbpress_new_topic', 10 );
    }
    

    newtech1
    Participant

    @newtech1

    What do I replace newtech1 with?


    webcreations907
    Participant

    @webcreations907

    You don’t replace it with anything, unless you want to.. It’s just a prefix to avoid conflicts when functions are named the same.


    webcreations907
    Participant

    @webcreations907

    That work you for you? I was trying to post the code snippets link, but maybe it wouldn’t go through. You can find that plugin on WordPress plugins


    newtech1
    Participant

    @newtech1

    I put the following code within my theme’s functions.php file. I created a topic under the only forum I have on the site. I published it. Subscribers never received the notification. I checked emails log. It does not show any email being sent out. I am still wondering if the issue can be that if a topic is created within the backend instead of frontend could be causing the problem.

    /**
    *begin edit for subscribe notification to work
    */
    if( function_exists( 'bbp_get_topic_post_type' ) ){
    	function newtech1_bbpress_new_topic( $post ) {
    		if( isset( $post->post_type ) && $post->post_type == bbp_get_topic_post_type() ){
    			do_action( 'bbp_new_'.bbp_get_topic_post_type(), $post->ID , $post->post_parent, [] , $post->post_author );
    		}
    	}
    	add_action(  'draft_to_publish' ,  'newtech1_bbpress_new_topic', 10 );
    }
    /**
    *end edit for subscribe notification to work
    */

    newtech1
    Participant

    @newtech1

    Whoops. I am wrong. IT IS NOW WORKING! I need to test auto login and some other features since this is a private forum.

    One issue that I do not think can be solved is I am using ACF plugin for Custom fields within topics. The email notification only has the topic text, it does not include any of the custom field results. Assume no one know how to resolve this. ACF plugin support will not help because they know nothing about bbpress.

    The reason I have forum users posting in the backend is because I could never get the ACF plugin to work properly on the frontend.

    Thanks!


    webcreations907
    Participant

    @webcreations907

    Glad that worked out for you, that function was to enable the subscriptions in the backend.

    As for the email message, I think bbp Style Pack has a email template spot to modify the template used that is sent out in email.


    newtech1
    Participant

    @newtech1

    Yes I can create a customized template for the email. Here is what is my current issue:

    In the backend when a user posts a topic there are several custom fields created with the ACF plugin, ie. date, time, water depth, fish caught, etc.

    When the email notification is sent, the information in the content filled shows up in the email, but any custom fields data does not show up in the email.

    So my question is, what file is being used for the email notification. The file where topic content is entered? I may be able to enter the correct coding to display ACF field results in the emmail.


    webcreations907
    Participant

    @webcreations907

    They are not in a template but in a functions run through filters, so if you were using bbpress without any plugins for email templates then the function it’s being called from is bbp_notify_topic_subscribers and the filter to change the message is bbp_subscription_mail_message.

    You can’t just added function with the same name, because it will cause your site to throw errors. But you can use the filter to change the message.

    Are you using bbp style pack template? If so give me the field name of one of you custom ACF fields for when you create topics, and I’ll see if I can come up with something for you.


    newtech1
    Participant

    @newtech1

    I have the bbp style pack plugin installed but only using forSubscription Emails and Subscription Management. I have manually edited files for the customized fields to show up under adding new topics and to display results in the front end.

    Here are some customized fields in content-single-topic.php
    YOU CHOOSE HOW MUCH INFORMATION YOU ENTER<br>
    Catch Date & Time: <?php the_field( ‘catch_date_time’ ) ; ?><br>
    Anglers: <?php the_field( ‘anglers’ ) ; ?><br>


    webcreations907
    Participant

    @webcreations907

    If you’re using the style pack to edit your email template, add the below as a test to your email template.

    
    Catch Time: {catch_date_time}
    Anglers: {anglers}
    
    

    Then add this function to your functions.php file or code snippets plugin which ever your using.

    
    
    if( !function_exists('afc_email_bbp_subscription_mail') ){
    	function afc_email_bbp_subscription_mail( $message, $reply_id, $topic_id ) {
    		if ( function_exists( 'get_field' ) && $topic_id != 0 ) {
    
    			$afc_replace = array(
    				'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    				'{anglers}'         => get_field( 'anglers', $topic_id )
    				);
    
    			$message = strtr( $message , $afc_replace);
    		}
    		return $message;
    	}
    	add_filter( 'bbp_forum_subscription_mail_message' , 'afc_email_bbp_subscription_mail', 100 , 3 );
    }
    
    

    Then test it out by creating a topic in a forum that has subscribers you can test with, and make sure to set those values when creating your topic.


    webcreations907
    Participant

    @webcreations907

    I have some updated code for you to try, after installing that ACF plugin I realized it wasn’t saving the post meta(your custom fields) before the mail was being called.

    So you’ll need to remove all the code previously listed including the first function, and try the below instead.

    So all you should have added is the below in your code snippets plugin, or functions.php file.

    
    
    if( function_exists( 'bbp_get_topic_post_type' ) ){
    	function newtech2_bbpress_new_topic( $post_id, $post , $update, $post_before ){
    	
    		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) return;
    
    		if( !function_exists('bbp_get_topic_post_type') ){
    			return;
    		}
    
    		if ( bbp_get_topic_post_type() !== $post->post_type || ! is_admin() ) {
    			return;
    		}
    
    		if ( ! in_array( $post->post_status, [ 'private', 'publish' ] ) ) {
    			return;
    		}
    
    		if( isset( $post_before->post_status ) && $post_before->post_status == 'draft' ){
    			do_action( 'bbp_new_'.bbp_get_topic_post_type(), $post->ID , $post->post_parent, [] , $post->post_author );
    		}
    	}
    
    	add_action( 'wp_after_insert_post', 'newtech2_bbpress_new_topic', 10, 4);
    }
    
    if( !function_exists('acf_email_bbp_subscription_mail') ){
    	function acf_email_bbp_subscription_mail( $message, $topic_id, $forum_id, $user_id ) {
    		if ( function_exists( 'get_field' ) && $topic_id != 0 ) {
    			$afc_replace = array(
    				'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    				'{anglers}'         => get_field( 'anglers', $topic_id )
    				);
    
    			$message = strtr( $message , $afc_replace);
    		}
    
    		return $message;
    	}
    	add_filter( 'bbp_forum_subscription_mail_message' , 'acf_email_bbp_subscription_mail', 100 , 4 );
    }
    
    

    You’ll just leave the below in your email template as before.

    
    
    Catch Time: {catch_date_time}
    Anglers: {anglers}
    
    

    Hopefully that works out for you


    newtech1
    Participant

    @newtech1

    I am happy to report that code works great. The two custom fields show up in the email notification.

    Here are all the custom fields. I should be able to take what you have done and make all them work. Hopefully not break anything.

    <strong>YOU CHOOSE HOW MUCH INFORMATION YOU ENTER</strong><br>
    <strong>Catch Date & Time:</strong> <?php the_field( 'catch_date_time' ) ; ?><br>
    <strong>Anglers:</strong> <?php the_field( 'anglers' ) ; ?><br>
    <strong>Weather:</strong> <?php the_field( 'weather' ) ; ?><br>
    <strong>Fish Caught:</strong> <?php the_field( 'fish_caught' ) ; ?><br>
    <strong>Kept or Released:</strong> <?php the_field( 'kept_or_released' ) ; ?><br>
    <strong>Lake Point Marker:</strong> <?php the_field( 'lake_point_marker' ) ; ?><br>
    <strong>Water_Features:</strong> <?php the_field( 'water_features' ) ; ?><br>
    <strong>Speed:</strong> <?php the_field( 'speed' ) ; ?><br>
    <strong>Fish Depth:</strong> <?php the_field( 'fish_depth' ) ; ?><br>
    <strong>Lake Depth:</strong> <?php the_field( 'lake_depth' ) ; ?><br>
    <strong>Method Used:</strong> <?php the_field( 'method_used' ) ; ?><br>
    <strong>Lure & Color:</strong> <?php the_field( 'lure_color' ) ; ?><br>

    BUT there are two custom fields that are done differently, do not know how I would do them. It is the image field and the location field, but maybe they work the same way.

    <strong>Image:</strong>
    <?php 
    $image = get_field('image');
    if( !empty( $image ) ): ?>
        <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?> <br>
    
    <br>
    <br>
    <strong>Fishing Location: </strong> <?php the_field( 'location' ) ; ?><br>
    <?php 
    $location = get_field('location');
    if( $location ): ?>
        <div class="acf-map" data-zoom="13">
            <div class="marker" data-lat="<?php echo esc_attr($location['lat']); ?>" data-lng="<?php echo esc_attr($location['lng']); ?>"></div>
        </div>
    <?php endif; ?>

    webcreations907
    Participant

    @webcreations907

    That’s great, glad it worked out for you. For the map you may have to use a static image map since you won’t be able to load scripts in emails.


    newtech1
    Participant

    @newtech1

    Error-Fish Caught Field

    This field has radio buttons for each type of fish caught. So the poster does not have to type in the species of fish. Instead the choose the appropriate radio buttons.

    The email shows the result for this field as the word ‘array’.

    Is there a way to resolve that without having to change this to a text field where they type in each species of fish?


    newtech1
    Participant

    @newtech1

    Error-Image field
    In the email the image will not display. Most likely it is because of how I have the image field being created. I do not want posters to insert images into the website media gallery. So I have created a custom field for images. Here is the script for the image field. Is there a way to make it so images show up in the email notification? I am assuming the only work around is to allow them to access the media library.

    I know there was another way for posting images using custom field but I could never get it to work.

    <?php 
    $image = get_field('image');
    if( !empty( $image ) ): ?>
        <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?>
Viewing 25 replies - 1 through 25 (of 25 total)
  • You must be logged in to reply to this topic.
Skip to toolbar