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 6 replies - 26 through 31 (of 31 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.

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