Notifications: Fix typo for filter in bp_has_notifications().

See r7521

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8115 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Auto-fetch URL search parameters in bp_has_groups() before parsing $args array

Our previous method, of getting the search term out of $_REQUEST, had the
effect of overriding any search terms that were passed to the bp_has_groups()
function. Among other problems, this made it impossible to get an unfiltered
group list when looking at a page that was using an 's' parameter for something
else.

Fixes #5456

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8116 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Introduce BuddyPress Tools panel

Modeled on the bbPress panel, the BuddyPress Tools panel contains a number of
tools for repairing BuddyPress data. In this first iteration, the following
actions are supported:

- Recalculate total_friend_count for each user
- Recalculate total_group_count for each user
- Recalculate total site members

On non-Multisite (or when BP is only activated on a single site), the menu
appears as Tools > BuddyPress. When BP is network-activated, we create a stub
Tools menu on the Network Admin to account for the fact that one is not
normally there. If WP ever introduces a menu like this, we can use it instead.

Fixes #5296

Props cmmarslender, boonebgorges, imath

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8117 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
POT, generated from r8117

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8118 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Introduce Sign Ups Management

In Users Administration Screen, a new view is now available to manage the pending accounts of a site or of the network of sites. The following actions are supported:
- Resend the activation email
- Delete the pending account
- Activate the pending account
The corresponding bulk actions are also supported. A search box is available in order to let the administrator easily find some specific pending accounts.

The registration process have also been modified so that multisite and regular configs handles it in a similar way. A mechnanism is in place to ensure plugin backward compatibility concerning the regular configs.

See #5374

props boonebgorges, imath

Fixes #4651

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8119 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
POT, generated from r8119

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8120 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Don't use mysql_real_escape_string() in BP_Signup

This causes problems on PHP 5.5+, where the mysql_* functions have been
deprecated.

See #5374

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8121 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Better verbiage for "Pending Accounts". See #5374

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8122 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Register the signup table in the members global even if registration is disabled

Conditionally registering the table causes problems for our unit tests. It also
means that we have to worry about table creation when enabling registration
later on.

See #5374

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8123 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Introduce tool on Tools menu for repairing last_activity data

Fixes #5461

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8124 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Generate activity actions dynamically, instead of using static values stored in the database

Activity actions - like 'Joe became a registered member' - have always been
stored as static strings in the activity table. This has been a perennial thorn
in the side of BP site administrators. For one thing, static strings cannot be
translated for multilingual audiences (without unreasonable workarounds).
For another, information in these static strings becomes out of date as users
change their display names, groups change their names, and so on.

This changeset makes it possible for activity types to be registered with a
new $format_callback function, passed to bp_activity_set_action(), which BP
will use to generate the action dynamically when building the activity loop.
This makes the activity stream fully localizable, continually up-to-date, and
generally the bomb dot com.

Existing plugins that do not register format_callback functions will continue
to have their actions pulled directly from the database. Likewise, since a copy
of the static string is saved in the activity table, static strings can be
served if the given component is disabled at any point (and thus the callback
is no longer available).

The original argument for caching the action strings was that generating them
inline was too resource intensive; it often requires pulling up display names,
user permalinks, group links, blog post names, and so forth. To address this
problem, each component can now prefetch required data at the beginning of an
activity loop by hooking to bp_activity_prefetch_object_data, and loading any
relevant data into the cache. The Activity, Friends, Groups, and Blogs
component now do this natively. It's likely that this prefetching will have
other performance benefits, as plugin authors will now be able to access user
data etc inline without performance penalties.

The case of the Blogs component is a special one; it's not practical to
prefetch data from multiple blogs at the beginning of a loop, due to the
resources required by switch_to_blog(). For this reason, the format_callback
functions in the blog component cache some relevant data (like the post name)
in blogmeta, where it's readily accessible within the loop.

Fixes #3856

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8125 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Use WP Plugin API rather than call_user_func() to apply format_callback to activity actions

This allows plugin authors to modify or override default formatting callbacks
using the standard remove_filter() and add_filter() API functions.

Hat-tip to nacin for the idea

See #3856

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

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8127 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Fix incorrect variable name in test_bp_activity_format_activity_action_new_blog_comment_backpat()

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8128 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Don't improperly sanitize meta_key in _meta() functions

Many BP meta functions have always stripped certain characters from the
$meta_key parameter before performing their operations. This is a terrible idea
on a number of levels: it doesn't provide any feedback to the user, it silently
performs actions that are not equivalent to the ones intended by the user, and
it doesn't serve any real purpose (since any necessary sanitization happens at
the level of $wpdb). Moreover, it wasn't even applied consistently across all
functions. A truly delightful grab bag.

This changeset removes the sanitization, and updates the necessary unit tests
to reflect the change.

See #5399

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8129 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Don't trim whitespace from $meta_value param in _delete_meta() functions

The $meta_value parameter of BP's delete_meta() functions allows developers to
limit deletion to rows that match both the $meta_key *and* the specified
$meta_value. However, most of BP's delete_meta() functions have always had a
quirk whereby the $meta_value was run through trim() before matching against
the values in the database. This had the unacceptable side effect that passing
a $meta_value of '  foo  ' would delete rows with the value 'foo', but *not*
the value '  foo  '!

This changeset reverses the behavior, and modifies the relevant unit tests.

See #5399

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8130 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Return an empty string from get_meta() functions when no value is found

BP get_meta() functions have been inconsistent about the type of value returned
when no match is found for the object_id+meta_key combination. In some cases,
we followed WP's get_metadata() and returned an empty string. In others, we
returned false.

This changeset aligns all of our get_meta() functions with WP in this regard,
returning an empty string when no matching value is found. A boolean false is
still returned when invalid arguments are passed to the functions.

Relevant unit tests have been updated, including strict assertSame() checking
where appropriate.

See #5399

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8131 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
In update_meta() functions, return integer value if a new metadata is created

Previously, BP update_meta() functions returned true on a successful update
*or* on the successful creation of new metadata. This is not consistent with
WP's update_metadata(), which on the creation of new metadata acts as a wrapper
for add_metadata(), which in turn returns an integer (the ID of the newly
created database row).

This changeset aligns BP's behavior with WP's.

We don't have any tests that directly address the data type returned by these
functions, but we do have a number of assertTrue assertions to verify the
setup of various tests. Where appropriate, these have been changed to the more
generous assertNotEmpty.

See #5399

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8132 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
Use WP's array format for get_meta() functions when no $meta_key is provided

Passing only an object_id to a get_meta() function in WP will return an array
of arrays, keyed by meta_keys, each containing a list of meta_values for that
meta_key. BP's get_meta() functions were inconsistent in this regard: some
returned arrays of stdClass, some returned one-d arrays of meta_values. All
returned values that were practically of little use, because they didn't have
enough information about the located data to make it useful.

This changeset aligns BP's get_meta() functions with WP's. We now allow the
return value of get_metadata() to pass through untouched in all cases. Unit
tests have been updated as necessary.

See #5399

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8133 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
More consistent whitespace in meta functions

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