webcreations907 (@webcreations907)

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 55 total)
  • In reply to: Subscribe to Forum

    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.


    webcreations907
    Participant

    @webcreations907

    Thanks Robin, been in the works for awhile just kept putting off finishing it.

    In reply to: Subscribe to Forum

    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 );
    }
    
    
    In reply to: Subscribe to Forum

    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.

    In reply to: Subscribe to Forum

    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.

    In reply to: Subscribe to Forum

    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

    In reply to: Subscribe to Forum

    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.

    In reply to: Subscribe to Forum

    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.

    In reply to: Subscribe to Forum

    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.


    webcreations907
    Participant

    @webcreations907

    I don’t have a multi site set up with bbpress, but try the below and see if that works for you. Would have to add to the code snippets plugin or your theme’s functions.php file

    
    
    if( !function_exists('mh_bbp_get_multi_site_total_users') ){
    	function mh_bbp_get_multi_site_total_users( $count ) {
    		if ( is_multisite() ) {
    			$args = array(
    				'blog_id'     => get_current_blog_id(),
    				'fields'      => 'ID'
    			);
    			$count = count( (array) get_users( $args ) );
    		}
    
    		return (int) $count;
    	}
    
    	add_filter( 'bbp_get_total_users' , 'mh_bbp_get_multi_site_total_users', 100 );
    }
    
    
    In reply to: Subscribe to Forum

    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


    webcreations907
    Participant

    @webcreations907

    Seems you should be able to add a filter and return that instead which would override the function you listed above.

    In reply to: Subscribe to Forum

    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.

    In reply to: Subscribe to Forum

    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 );
    }
    
    In reply to: Subscribe to Forum

    webcreations907
    Participant

    @webcreations907

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


    webcreations907
    Participant

    @webcreations907

    You could try the below

    
    .bbpress.topic-template-default .cs-entry__header{
      display: none;
    }
    
    In reply to: Subscribe to Forum

    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?


    webcreations907
    Participant

    @webcreations907

    Yeah it’s odd that it doesn’t have pagination build into it, I don’t use threaded either.

    You had put together a plugin for someone awhile back for this when using threaded replies, so not sure if that is still working or what the OP is looking for. Link to that reply of yours below.

    https://bbpress.org/forums/topic/trying-to-get-nested-replies-and-pagination-to-work/#post-214969


    webcreations907
    Participant

    @webcreations907

    In Settings > Forums try unchecking the box for “Reply Threading”.


    webcreations907
    Participant

    @webcreations907

    I had posted a solution awhile back for this, you can find it here on the support forums at link below. It would set it so you can have unlimited number of forums.

    https://bbpress.org/forums/topic/hitting-50-forum-limit-what-can-i-do/#post-234658


    webcreations907
    Participant

    @webcreations907

    The below code should set it to unlimited number of forums, either paste the code into your functions.php file within your theme, or use the Code Snippets plugin listed above.

    
    
    if(!function_exists('bbp_increase_forum_display_count')){
    	function bbp_increase_forum_display_count( $args = array() ){
    		$args['posts_per_page'] = -1;
    		return $args;
    	}
    }
    add_filter( 'bbp_after_has_forums_parse_args', 'bbp_increase_forum_display_count' );
    
    

    webcreations907
    Participant

    @webcreations907

    Should have mentioned that you should added that into a child theme functions.php file so that when you update the theme you won’t lose that code.


    @robin-w
    usually recommends a code snippet plugin for adding custom code, but I don’t recall the name of that plugin.


    webcreations907
    Participant

    @webcreations907

    Try adding the below code to your theme’s functions.php file, should make the userpages full width with no sidebar.

    
    
    if( !function_exists('enkoes_magbook_userpage_css_class') ){
    	function enkoes_magbook_userpage_css_class( $classes ){
    		if( function_exists('bbp_is_single_user') &&  bbp_is_single_user()){
    			$classes[] = 'magbook-no-sidebar';
    		}
    		return $classes;
    	}
    }
    add_filter('body_class', 'enkoes_magbook_userpage_css_class');
    
    if( !function_exists('enkoes_magbook_userpage_options') ){
    	function enkoes_magbook_userpage_options( $options = array() ){
    		
    		if( function_exists('bbp_is_single_user') &&  bbp_is_single_user()){
    			$options['magbook_sidebar_layout_options'] = 'nosidebar';
    			$options['magbook_blog_layout'] = '';
    		}
    		return $options;
    
    	}
    }
    add_filter('magbook_get_option_defaults_values', 'enkoes_magbook_userpage_options',100);
    
    

    You may have to get rid of that bbpress.php file you added.

    I haven’t used Magbook theme before, so let me know if that works out for you.

    😉


    webcreations907
    Participant

    @webcreations907

    You could use the below which should add your registration link to that form.

    Add to your functions.php file in your theme.

    
    if(!function_exists('dnk_add_registration_link')){
    	function dnk_add_registration_link(){
    		if( function_exists('is_bbpress') && is_bbpress() ){
    			echo '<p>Don\'t have an account? <a href="'.esc_attr( wp_registration_url() ).'">Register</a></p>';
    		}
    	}
    }
    add_action( 'login_form','dnk_add_registration_link' ,10 );
    
    

    webcreations907
    Participant

    @webcreations907

    Is it the default WordPress registration, or do you have a plugin for user registration?

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