WordPress.org

Ready to get started?Download WordPress

Forums

bbPress Email Notifications
[resolved] Request: Subscribe to my topics and replies by default (7 posts)

  1. Erlend Sogge Heggen
    Member
    Posted 1 year ago #

    I find that more often than not, I'd like to subscribe to the threads I create or reply to. It would be very handy to have a simple option in your notification settings that said:
    "Subscribe to your own topics and replies by default?" yes/no.

    Using your plugin on jmonkeyengine.org right now, it appears to be working excellently :)

    (aside: also looking forward to threaded replies in core!)

    http://wordpress.org/extend/plugins/bbpress-email-notifications/

  2. Jennifer M. Dodd
    Member
    Plugin Author

    Posted 1 year ago #

    That is an interesting idea, especially since it could interface with bbPress's built-in subscription mechanism to autosubscribe a user (per their bbPress Email Notifications preferences) instead of relying on the checkbox. As long as it is clear to the user that the setting overrides the checkbox no matter what, I think that would make a good addition.

    Threading replies has been bumped to 2.4 to avoid scope creep. New features for 2.3 require some additional patching, and I need to resolve pagination caching issues.

  3. Erlend Sogge Heggen
    Member
    Posted 1 year ago #

    Well, wouldn't it be better if all this option did was check the checkbox for you? That way you could always opt out from subscribing in those edge cases when you don't need to.

    (Too bad about the bump, but there's plenty to look forward to still.)

  4. Jennifer M. Dodd
    Member
    Plugin Author

    Posted 1 year ago #

    We're running the following to set the opt-in to checked for our users, but I can see where a universal option would be nice.

    function ucc_bbp_get_form_topic_subscribed( $checked, $topic_subscribed ) {
            return checked( true, true );
    }
    add_filter( 'bbp_get_form_topic_subscribed', 'ucc_bbp_get_form_topic_subscribed', 10, 2 );
  5. focallocal
    Member
    Posted 8 months ago #

    if you are still monitoring this Jennifer could you please provide details about where to put that code, its exactly what i've been looking for.

    thanks

  6. focallocal
    Member
    Posted 8 months ago #

    function bbp_enqueue_style( $handle = '', $file = '', $dependencies = array(), $version = false, $media = 'all' ) {
    
    	// No file found yet
    	$located = false;
    
    	// Trim off any slashes from the template name
    	$file = ltrim( $file, '/' );
    
    	// Make sure there is always a version
    	if ( empty( $version ) ) {
    		$version = bbp_get_version();
    	}
    
    	// Loop through template stack
    	foreach ( (array) bbp_get_template_stack() as $template_location ) {
    
    		// Continue if $template_location is empty
    		if ( empty( $template_location ) ) {
    			continue;
    		}
    
    		// Check child theme first
    		if ( file_exists( trailingslashit( $template_location ) . $file ) ) {
    			$located = trailingslashit( $template_location ) . $file;
    			break;
    		}
    	}
    
    	// Enqueue if located
    	if ( !empty( $located ) ) {
    
                    $content_dir = constant( 'WP_CONTENT_DIR' );
    
                    // IIS (Windows) here
                    // Replace back slashes with forward slash
                    if ( strpos( $located, '\\' ) !== false ) {
                            $located     = str_replace( '\\', '/', $located );
                            $content_dir = str_replace( '\\', '/', $content_dir );
                    }
    
    		// Make path to file relative to site URL
    		$located = str_replace( $content_dir, WP_CONTENT_URL, $located );
    
    		// Enqueue the style
    		wp_enqueue_style( $handle, $located, $dependencies, $version, $media );
    	}
    
    	return $located;
    }
    
    /**
     * Enqueue a script from the highest priority location in the template stack.
     *
     * Registers the style if file provided (does NOT overwrite) and enqueues.
     *
     * @since bbPress (r5180)
     *
     * @param string      $handle    Name of the script.
     * @param string|bool $file      Relative path to the script. Example: '/js/myscript.js'.
     * @param array       $deps      An array of registered handles this script depends on. Default empty array.
     * @param string|bool $ver       Optional. String specifying the script version number, if it has one. This parameter
     *                               is used to ensure that the correct version is sent to the client regardless of caching,
     *                               and so should be included if a version number is available and makes sense for the script.
     * @param bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
     *                               Default 'false'. Accepts 'false' or 'true'.
     *
     * @return string The script filename if one is located.
     */
    function bbp_enqueue_script( $handle = '', $file = '', $dependencies = array(), $version = false, $in_footer = 'all' ) {
    
    	// No file found yet
    	$located = false;
    
    	// Trim off any slashes from the template name
    	$file = ltrim( $file, '/' );
    
    	// Make sure there is always a version
    	if ( empty( $version ) ) {
    		$version = bbp_get_version();
    	}
    
    	// Loop through template stack
    	foreach ( (array) bbp_get_template_stack() as $template_location ) {
    
    		// Continue if $template_location is empty
    		if ( empty( $template_location ) ) {
    			continue;
    		}
    
    		// Check child theme first
    		if ( file_exists( trailingslashit( $template_location ) . $file ) ) {
    			$located = trailingslashit( $template_location ) . $file;
    			break;
    		}
    	}
    
    	// Enqueue if located
    	if ( !empty( $located ) ) {
    
    				$content_dir = constant( 'WP_CONTENT_DIR' );
    		                // IIS (Windows) here
     		                // Replace back slashes with forward slash
     		                if ( strpos( $located, '\\' ) !== false ) {
     		                        $located     = str_replace( '\\', '/', $located );
     		                        $content_dir = str_replace( '\\', '/', $content_dir );
     		                } 
    
    		// Make path to file relative to site URL
    		$located = str_replace( $content_dir, WP_CONTENT_URL, $located );
    
    		// Enqueue the style
    		wp_enqueue_script( $handle, $located, $dependencies, $version, $in_footer );
    	}
    
    	return $located;
    }
    
    /**
     * This is really cool. This function
  7. focallocal
    Member
    Posted 8 months ago #

    sorry for the code. i clicked the wrong tab and cant see a way to delete it

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic