Index: /trunk/src/bp-templates/bp-legacy/buddypress-functions.php
===================================================================
--- /trunk/src/bp-templates/bp-legacy/buddypress-functions.php	(revision 12254)
+++ /trunk/src/bp-templates/bp-legacy/buddypress-functions.php	(revision 12255)
@@ -284,4 +284,13 @@
 
 		/**
+		 * Filters whether directory filter settings ('scope', etc) should be stored in a persistent cookie.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param bool $store_filter_settings Whether to store settings. Defaults to true for logged-in users.
+		 */
+		$store_filter_settings = apply_filters( 'bp_legacy_store_filter_settings', is_user_logged_in() );
+
+		/**
 		 * Filters core JavaScript strings for internationalization before AJAX usage.
 		 *
@@ -291,4 +300,5 @@
 		 */
 		$params = apply_filters( 'bp_core_get_js_strings', array(
+			// Strings for display.
 			'accepted'            => __( 'Accepted', 'buddypress' ),
 			'close'               => __( 'Close', 'buddypress' ),
@@ -304,4 +314,7 @@
 			'unsaved_changes'     => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
 			'view'                => __( 'View', 'buddypress' ),
+
+			// Settings.
+			'store_filter_settings' => $store_filter_settings,
 		) );
 		wp_localize_script( $asset['handle'], 'BP_DTheme', $params );
Index: /trunk/src/bp-templates/bp-legacy/js/buddypress.js
===================================================================
--- /trunk/src/bp-templates/bp-legacy/js/buddypress.js	(revision 12254)
+++ /trunk/src/bp-templates/bp-legacy/js/buddypress.js	(revision 12255)
@@ -10,4 +10,6 @@
 var newest_activities = '';
 var activity_last_recorded  = 0;
+
+var directoryPreferences = {}
 
 jq(document).ready( function() {
@@ -849,5 +851,9 @@
 			}
 
-			bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras'), null, template );
+			var scope  = bp_get_directory_preference( object, 'scope' );
+			var filter = bp_get_directory_preference( object, 'filter' );
+			var extras = bp_get_directory_preference( object, 'extras' );
+
+			bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, extras, null, template );
 
 			return false;
@@ -884,5 +890,7 @@
 			search_terms = jq('#' + object + '_search').val();
 
-			bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
+			var extras = bp_get_directory_preference( object, 'extras' );
+
+			bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, extras );
 
 			return false;
@@ -932,5 +940,7 @@
 		}
 
-		bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras'), null, template );
+		var extras = bp_get_directory_preference( object, 'extras' );
+
+		bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, extras, null, template );
 
 		return false;
@@ -1020,5 +1030,9 @@
 			}
 
-			bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras'), caller, template );
+			var scope  = bp_get_directory_preference( object, 'scope' );
+			var filter = bp_get_directory_preference( object, 'filter' );
+			var extras = bp_get_directory_preference( object, 'extras' );
+
+			bp_filter_request( object, filter, scope, 'div.' + object, search_terms, page_number, extras, caller, template );
 
 			return false;
@@ -1388,11 +1402,15 @@
 			object = 'messages';
 
+			var scope  = bp_get_directory_preference( object, 'scope' );
+			var filter = bp_get_directory_preference( object, 'filter' );
+			var extras = bp_get_directory_preference( object, 'extras' );
+
 			bp_filter_request(
 				object,
-				jq.cookie('bp-' + object + '-filter'),
-				jq.cookie('bp-' + object + '-scope'),
+				filter,
+				scope,
 				'div.' + object, jq('#messages_search').val(),
 				1,
-				jq.cookie('bp-' + object + '-extras')
+				extras
 			);
 
@@ -1724,16 +1742,76 @@
 });
 
+/**
+ * Gets the user's current preference for a directory option.
+ */
+function bp_get_directory_preference( directoryType, pref ) {
+	var defaultPrefs = {
+		filter: '',
+		scope: '',
+		extras: ''
+	}
+
+	if ( ! directoryPreferences.hasOwnProperty( directoryType ) ) {
+		var newPreferences = {};
+		for ( var prefName in defaultPrefs ) {
+			if ( defaultPrefs.hasOwnProperty( prefName ) ) {
+				newPreferences[ prefName ] = defaultPrefs[ prefName ];
+			}
+		}
+		directoryPreferences[ directoryType ] = newPreferences;
+	}
+
+	if ( BP_DTheme.store_filter_settings ) {
+		directoryPreferences[ directoryType ][ pref ] = jq.cookie( 'bp-' + directoryType + '-' + pref );
+	}
+
+	return directoryPreferences[ directoryType ][ pref ];
+}
+
+/**
+ * Sets the user's current preference for a directory option.
+ */
+function bp_set_directory_preference( directoryType, pref, value ) {
+	var defaultPrefs = {
+		filter: '',
+		scope: '',
+		extras: ''
+	}
+
+	if ( ! directoryPreferences.hasOwnProperty( directoryType ) ) {
+		var newPreferences = {};
+		for ( var prefName in defaultPrefs ) {
+			if ( defaultPrefs.hasOwnProperty( prefName ) ) {
+				newPreferences[ prefName ] = defaultPrefs[ prefName ];
+			}
+		}
+		directoryPreferences[ directoryType ] = newPreferences;
+	}
+
+	if ( BP_DTheme.store_filter_settings ) {
+		jq.cookie( 'bp-' + directoryType + '-' + pref, value, {
+			path: '/',
+			secure: ( 'https:' === window.location.protocol )
+		} );
+	}
+
+	directoryPreferences[ directoryType ][ pref ] = value
+}
+
 /* Setup activity scope and filter based on the current cookie settings. */
 function bp_init_activity() {
-	if ( undefined !== jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length ) {
-		jq('#activity-filter-select select option[value="' + jq.cookie('bp-activity-filter') + '"]').prop( 'selected', true );
+	var scope  = bp_get_directory_preference( 'activity', 'scope' );
+	var filter = bp_get_directory_preference( 'activity', 'filter' );
+
+	if ( undefined !== filter && jq('#activity-filter-select').length ) {
+		jq('#activity-filter-select select option[value="' + filter + '"]').prop( 'selected', true );
 	}
 
 	/* Activity Tab Set */
-	if ( undefined !== jq.cookie('bp-activity-scope') && jq('.activity-type-tabs').length ) {
+	if ( undefined !== scope && jq('.activity-type-tabs').length ) {
 		jq('.activity-type-tabs li').each( function() {
 			jq(this).removeClass('selected');
 		});
-		jq('#activity-' + jq.cookie('bp-activity-scope') + ', .item-list-tabs li.current').addClass('selected');
+		jq('#activity-' + scope + ', .item-list-tabs li.current').addClass('selected');
 	}
 }
@@ -1742,13 +1820,16 @@
 function bp_init_objects(objects) {
 	jq(objects).each( function(i) {
-		if ( undefined !== jq.cookie('bp-' + objects[i] + '-filter') && jq('#' + objects[i] + '-order-select select').length ) {
-			jq('#' + objects[i] + '-order-select select option[value="' + jq.cookie('bp-' + objects[i] + '-filter') + '"]').prop( 'selected', true );
-		}
-
-		if ( undefined !== jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) {
+		var scope  = bp_get_directory_preference( objects[i], 'scope' );
+		var filter = bp_get_directory_preference( objects[i], 'filter' );
+
+		if ( undefined !== filter && jq('#' + objects[i] + '-order-select select').length ) {
+			jq('#' + objects[i] + '-order-select select option[value="' + filter + '"]').prop( 'selected', true );
+		}
+
+		if ( undefined !== scope && jq('div.' + objects[i]).length ) {
 			jq('.item-list-tabs li').each( function() {
 				jq(this).removeClass('selected');
 			});
-			jq('#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', #object-nav li.current').addClass('selected');
+			jq('#' + objects[i] + '-' + scope + ', #object-nav li.current').addClass('selected');
 		}
 	});
@@ -1765,17 +1846,8 @@
 	}
 
-	/* Save the settings we want to remain persistent to a cookie */
-	jq.cookie( 'bp-' + object + '-scope', scope, {
-		path: '/',
-		secure: ( 'https:' === window.location.protocol )
-	} );
-	jq.cookie( 'bp-' + object + '-filter', filter, {
-		path: '/',
-		secure: ( 'https:' === window.location.protocol )
-	} );
-	jq.cookie( 'bp-' + object + '-extras', extras, {
-		path: '/',
-		secure: ( 'https:' === window.location.protocol )
-	} );
+	/* Save the settings we want to remain persistent */
+	bp_set_directory_preference( object, 'scope', scope );
+	bp_set_directory_preference( object, 'filter', filter );
+	bp_set_directory_preference( object, 'extras', extras );
 
 	/* Set the correct selected nav and filter */
