Check cache for count functions that return zero.

Some of our count functions were previously setting counts of zero
correctly, but the functions themselves were not referencing the cache
properly when the count returned zero.  This led to unnecessary database
queries and we hate extra queries!

This commit addresses the problem and adds unit tests.

Props r-a-y, boonebgorges.

Fixes #6012.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9231 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
bp-legacy: For member groups template, use same `<select>` ID as the groups directory template.

This is done for consistency from a theme developer's perspective.

Props lenasterg.  Fixes #5998.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9232 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Add tests for bp_make_spam/ham_user and make_spam/ham_user filters.

Filters names were originally assigned to a passed in variable but
they were separated out for documentation purposes.

See #5944.


git-svn-id: https://buddypress.svn.wordpress.org/trunk@9233 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Tests: after using our `grant_super_admin` helper, use `restore_admins` after the assertion to tidy up the `$super_admins` global.

This was otherwise breaking the seemingly unrelated tests added in r9233 when run in multisite. See #5944

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9234 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Hide 'Field Name' screen-reader-text on xProfile field edit when a title exists.

This ensures that we don't see overlapping text in the case of existing fields.

See [9084].

Fixes #6073.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9235 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Add actions on the Profile Fields admin page.

Also cleans up a bit of code formatting for the `<legend>` elemnts on this
screen.

Props slaFFik.
Fixes #5673.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9236 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Travis: run tests on PHP 5.6 and WP 4.1 branch.

WP 4.1's been released, and PHP 5.6 has been out for several months now.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9237 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Travis: attempting to fix a test failure for WP 3.7 + PHP 5.6.

We had a similar fix in for PHP, this change makes that comparision a little more general so we don't run into this problem in the future.

See r9237 and https://travis-ci.org/buddypress/BuddyPress/jobs/44511661

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9238 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Bump "tested up to" version to 4.1.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9239 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Improve `<label>` markup for mesage search form.

* Associate the label properly with the labeled element.
* Add bp-screen-reader-text class for better consistency with other similar text in BP templates.

Props hnla.
Fixes #6010.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9240 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Make sure activities about a friendship are removed when this friendship is cancelled

Fixes #6055

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9241 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Core, Suggestions: use `bp_parse_args` to pre-filter `$args` for `bp_core_get_suggestions`.

See #5934

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9242 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Suggestions: move the blog checks in `bp_activity_maybe_load_mentions_scripts` to a filter in the core component.

This reorganisation keeps the component-specific mentions checks in those specific components, rather than bundling everything into the Activity component as it had been.

See #5934

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9243 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Templates: add class to bp-legacy's single forum reply template (legacy bbPress) to enable @mentions.

Further core changes are required before this will work. See #5934

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9244 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Revert r9244: "Templates: add class to bp-legacy's single forum reply template (legacy bbPress) to enable @mentions."

Further consideration is needed before adding features to the legacy Group Forums support. See #5934


git-svn-id: https://buddypress.svn.wordpress.org/trunk@9245 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Update atwho.js and caret.js to versions 0.5.2 and 0.2.1, respectively.

These libraries are used in the @mentions suggestions UI.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9246 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Make sure custom language files (if they exist) are taking precedence over GlotPress language packs

There can be cases where a community needs cutom language files. In order to make sure these custom language files are loaded, BuddyPress will first check 2 locations before loading the GlotPress language packs :
- {{{WP_LANG_DIR . '/buddypress'}}}
- {{{WP_LANG_DIR}}}

Using the {{{WP_LANG_DIR . '/buddypress'}}} location for the custom language files avoids the mo file name to be listed into the site's language setting of the WordPress general options.

We are also introducing a new filter {{{'buddypress_locale_locations'}}} so that it's possible to add a custom location to the ones listed above.

Props r-a-y, boonebgorges,danbp,DJPaul

Fixes #5887

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9247 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Messages: update autocomplete script to better handle long cookie values.

See #4606 for previous similiar fixes.

Fixes #5959, props psycleuk

git-svn-id: https://buddypress.svn.wordpress.org/trunk@9248 cdf35c40-ae34-48e0-9cc9-0c9da1808c22