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 17 replies - 26 through 42 (of 42 total)

  • newtech1
    Participant

    @newtech1

    To clarify in regard to images. I do not want users to have the ability to access the media folder and thus all my images. Without the image custom field they could go to post a topic, click on ‘Add Media’ and they would be able to access images from my entire media folder.

    So I removed access to the “Add Media” link and created a custom field image so that they have to upload an image from their device. The problem is the image they upload to the topic does not display in the email notification. It just says ‘array’. Any workaround?

    I wish there was a way they could click ‘Add Media’ and they could add media but not access my media folder.


    webcreations907
    Participant

    @webcreations907

    For the fish caught sounds like you want the label name, you’d want the code to check the value before that $acf_replace array. Something like below..

    
    
    $fish_caught = get_field('fish_caught');
    
    if( is_array( $fish_caught ) && isset( $fish_caught['label'] ) ){
    	$fish_caught = $fish_caught['label'];
    }else{
    	$fish_caught = '';
    }
    
    $afc_replace = array(
    	'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    	'{anglers}'         => get_field( 'anglers', $topic_id ),
    	'{fish_caught}'     => $fish_caught
    	);
    
    

    Same thing for the image I imagine, so you’d want the ‘url’ of the array, like above you’d want to check if it exists/uploaded before the replace array.

    
    
    $image = get_field('image');
    
    if( is_array( $image ) && isset( $image['url'] ) && !empty( $image['url'] ) ){
    	$image = '<img src="'.esc_attr($image['url']).'" alt="'.esc_attr( $image['alt'] ).'">';
    }else{
    	$image = '';
    }
    
    $afc_replace = array(
    	'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    	'{anglers}'         => get_field( 'anglers', $topic_id ),
    	'{image}'           => $image
    	);
    
    

    Hope that helps, sorry for the delay back. I’m just a user on here so was trying to help out some while I was logged in. I’d go to ACF documention and check out their field types as they have them listed there on getting the values.


    newtech1
    Participant

    @newtech1

    Thank you for your ongoing help we are almost there.
    But I am sorry I am not understanding this new information regarding the fish_caught field.
    I understand I would replace
    `$afc_replace = array(
    ‘{catch_date_time}’ => get_field( ‘catch_date_time’, $topic_id),
    ‘{anglers}’ => get_field( ‘anglers’, $topic_id )
    );`

    with this code
    `$afc_replace = array(
    ‘{catch_date_time}’ => get_field( ‘catch_date_time’, $topic_id),
    ‘{anglers}’ => get_field( ‘anglers’, $topic_id )
    ‘{fish_caught}’ => $fish_caught
    );`

    But not understanding where I would put this code

    $fish_caught = get_field('fish_caught');
    
    if( is_array( $fish_caught ) && isset( $fish_caught['label'] ) ){
    	$fish_caught = $fish_caught['label'];
    }else{
    	$fish_caught = '';
    }

    in the midst of this code. I am sure I am getting ( ) { } in the wrong places.

    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 ) {

    webcreations907
    Participant

    @webcreations907

    Just meant you need to have the that code before the afc_replace array, like below

    
    
    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 ) {
    			
    			// Part for fish caught before the afc_replace
    			$fish_caught = get_field('fish_caught');
    
    			if( is_array( $fish_caught ) && isset( $fish_caught['label'] ) ){
    				$fish_caught = $fish_caught['label'];
    			}else{
    				$fish_caught = '';
    			}
    
    			// Part for image, before the afc_replace
    			$image = get_field('image');
    
    			if( is_array( $image ) && isset( $image['url'] ) && !empty( $image['url'] ) ){
    				$image = '<img src="'.esc_attr($image['url']).'" alt="'.esc_attr( $image['alt'] ).'">';
    			}else{
    				$image = '';
    			}
    
    			
    			$afc_replace = array(
    				'{catch_date_time}' => get_field( 'catch_date_time', $topic_id),
    				'{anglers}'         => get_field( 'anglers', $topic_id ),
    				'{fish_caught}'     => $fish_caught,
    				'{image}'           => $image
    				);
    
    			$message = strtr( $message , $afc_replace);
    		}
    
    		return $message;
    	}
    	add_filter( 'bbp_forum_subscription_mail_message' , 'acf_email_bbp_subscription_mail', 100 , 4 );
    }
    
    

    newtech1
    Participant

    @newtech1

    I just got around to testing the above. I copied the code into themes function.php. Under fish caught it still says array instead of the fish species chosen in the dropdown. Also the image still does not show up.

    Any other suggestions? the Fish caught I can change it so that the user has to type in the fish species caught. Just much easier for them to choose the dropdown when entering, especially if on the lake when posting.

    It is important for the image to show up in the email because that draws much more interest than no image showing up.


    webcreations907
    Participant

    @webcreations907

    If you can look at the raw data of the email(within email client) and see what is set for the src of the img tag when testing.


    Julianna
    Participant

    @juliannasculpts

    Hi

    I’m having the same issue with notifications of replies and new topics not being sent by email.

    Plugins installed:
    Simple WordPress Membership
    bbPress
    bbp style pack (notifications enabled)
    bbPress Members Only (forum set to members only with all other pages visible)
    bbPress Notify (No Spam)
    Check & log email (nothing logged in tests)
    Code Snippets (original code above added)
    Easy WP SMTP (confirmed that other emails are sending successfully, eg notification of new member registrations via Simple Membership)
    WP Notification Bell (new replies ARE showing up here)

    I’ve run tests with replies and new topics for a test user subscribed to everything (and directly to the topic used to test replies), and am still not getting any emails. Have, of course, checked the spam folder.

    I’d appreciate any suggestions for troubleshooting.

    Thank you!


    Robin W
    Moderator

    @robin-w

    so does sending a test email from Check & log email (nothing logged in tests) work?


    Julianna
    Participant

    @juliannasculpts

    I just sent a test email from Check & log email and successfully received it


    Robin W
    Moderator

    @robin-w

    ok the code above will not help, and should be removed.

    I’d guess that because the subscription messages are being sent from ‘noreply@’ you website, your email system is rejecting this as an invalid address.

    Try installing

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Subscription Emails

    and change the address in item 1 to the email address that you are getting valid site emails from, and see if that solves.


    Julianna
    Participant

    @juliannasculpts

    Thanks–I already had bbp style pack installed.

    Did some more testing and ended up also installing “bbPress Notify (No Spam)”.

    When I had the bbPress Notify plugin override the subscription to forums & replies settings, the emails are now sending as expected.

    Appreciate the help!


    Robin W
    Moderator

    @robin-w

    great – glad you are fixed


    newtech1
    Participant

    @newtech1

    I changed the fish caught to a text field since I could not get the radio button to work. I could not get the image to show up in an email so have just accepted that the email receiver has to log in to see the image and the map.

    NEW ISSUE SUDDENLY CAME UP, WAS NOT HAPPENING BEFORE
    Subscribers are receiving two email notifications. One email notification has all the custom fields blank and the second email has all the custom fields filled out. What could be going on?


    Robin W
    Moderator

    @robin-w

    ok, so you need to work out what is causing this by disabling your code and plugins til you work out what combination is the issue


    Robin W
    Moderator

    @robin-w

    @newtech1 – did you find the issue?


    newtech1
    Participant

    @newtech1

    When I inserted the customized code for all my custom fields that are created by the ACF plugin, I forgot to delete the original code that makes the subscription email notification to work. So I had that customized code and the customized code for my custom fields. Thus sending out two emails.

    I removed this code.

    
    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 );
    }

    Robin W
    Moderator

    @robin-w

    ah great – thanks for the update 🙂

Viewing 17 replies - 26 through 42 (of 42 total)
  • You must be logged in to reply to this topic.
Skip to toolbar