Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Plugin updates

Also fixed bug 746317 - improved contrast
  • Loading branch information...
commit f258ed6e9528cd9d2e5b2cb08a44861d11f7c249 1 parent 8d90d05
Craig Cook craigcook authored
Showing with 2,413 additions and 7,449 deletions.
  1. +20 −18 plugins/buddypress/bp-activity/bp-activity-classes.php
  2. +2 −2 plugins/buddypress/bp-activity/bp-activity-functions.php
  3. +7 −7 plugins/buddypress/bp-blogs/bp-blogs-classes.php
  4. +1 −1  plugins/buddypress/bp-blogs/bp-blogs-functions.php
  5. +0 −637 plugins/buddypress/bp-core/admin/bp-core-admin.php
  6. +1 −1  plugins/buddypress/bp-core/admin/bp-core-functions.php
  7. +1 −0  plugins/buddypress/bp-core/admin/css/wizard.dev.css
  8. +28 −10 plugins/buddypress/bp-core/bp-core-avatars.php
  9. +1 −1  plugins/buddypress/bp-core/bp-core-cache.php
  10. +3 −0  plugins/buddypress/bp-core/bp-core-catchuri.php
  11. +7 −7 plugins/buddypress/bp-core/bp-core-classes.php
  12. +8 −6 plugins/buddypress/bp-core/bp-core-cssjs.php
  13. +1 −1  plugins/buddypress/bp-core/bp-core-filters.php
  14. +2 −2 plugins/buddypress/bp-core/bp-core-functions.php
  15. +0 −114 plugins/buddypress/bp-core/bp-core-hooks.php
  16. +1 −1  plugins/buddypress/bp-core/bp-core-options.php
  17. +1 −0  plugins/buddypress/bp-core/bp-core-widgets.php
  18. +0 −1  plugins/buddypress/bp-core/css/admin.css
  19. +0 −160 plugins/buddypress/bp-core/css/admin.dev.css
  20. +14 −0 plugins/buddypress/bp-core/deprecated/1.5.php
  21. BIN  plugins/buddypress/bp-core/images/admin-bar-sprite-rtl.png
  22. BIN  plugins/buddypress/bp-core/images/admin-bar-sprite.png
  23. BIN  plugins/buddypress/bp-core/images/admin_menu_icon.png
  24. BIN  plugins/buddypress/bp-core/images/completed.gif
  25. BIN  plugins/buddypress/bp-core/images/find.png
  26. BIN  plugins/buddypress/bp-core/images/icons32.png
  27. BIN  plugins/buddypress/bp-core/images/installed.gif
  28. BIN  plugins/buddypress/bp-core/images/logo-column-header.png
  29. BIN  plugins/buddypress/bp-core/images/logo.png
  30. +3 −5 plugins/buddypress/bp-forums/bp-forums-filters.php
  31. +5 −5 plugins/buddypress/bp-forums/bp-forums-functions.php
  32. +12 −12 plugins/buddypress/bp-friends/bp-friends-classes.php
  33. +16 −16 plugins/buddypress/bp-groups/bp-groups-classes.php
  34. +8 −8 plugins/buddypress/bp-groups/bp-groups-functions.php
  35. +3 −3 plugins/buddypress/bp-groups/bp-groups-loader.php
  36. +1 −0  plugins/buddypress/bp-groups/bp-groups-widgets.php
  37. +58 −58 plugins/buddypress/bp-languages/buddypress.pot
  38. BIN  plugins/buddypress/bp-languages/default.mo
  39. +0 −5,236 plugins/buddypress/bp-languages/default.po
  40. +2 −4 plugins/buddypress/bp-loader.php
  41. +60 −10 plugins/buddypress/bp-members/bp-members-functions.php
  42. +3 −2 plugins/buddypress/bp-members/bp-members-template.php
  43. +9 −9 plugins/buddypress/bp-messages/bp-messages-classes.php
  44. +19 −19 plugins/buddypress/bp-messages/js/autocomplete/license.bgiframe.txt
  45. +11 −17 plugins/buddypress/bp-settings/bp-settings-actions.php
  46. +1 −2  plugins/buddypress/bp-themes/bp-default/blogs/create.php
  47. +1 −2  plugins/buddypress/bp-themes/bp-default/groups/index.php
  48. +1 −2  plugins/buddypress/bp-themes/bp-default/groups/single/forum.php
  49. +280 −280 plugins/buddypress/bp-themes/bp-default/license.txt
  50. +21 −21 plugins/buddypress/bp-themes/bp-default/readme.txt
  51. +2 −2 plugins/buddypress/bp-themes/bp-default/rtl.css
  52. +2 −2 plugins/buddypress/bp-themes/bp-default/style.css
  53. +7 −7 plugins/buddypress/bp-xprofile/bp-xprofile-classes.php
  54. +8 −8 plugins/buddypress/bp-xprofile/bp-xprofile-functions.php
  55. +7 −1 plugins/buddypress/readme.txt
  56. +588 −147 plugins/cms-tree-page-view/functions.php
  57. +6 −3 plugins/cms-tree-page-view/index.php
  58. +135 −73 plugins/cms-tree-page-view/languages/cms-tree-page-view.pot
  59. +42 −6 plugins/cms-tree-page-view/readme.txt
  60. +521 −247 plugins/cms-tree-page-view/scripts/cms_tree_page_view.js
  61. +0 −9 plugins/cms-tree-page-view/scripts/jquery.hoverIntent.minified.js
  62. +3 −0  plugins/cms-tree-page-view/scripts/jquery.jstree.js
  63. +9 −5 plugins/cms-tree-page-view/scripts/themes/wordpress/style.css
  64. BIN  plugins/cms-tree-page-view/styles/images/arrow-top.gif
  65. +206 −68 plugins/cms-tree-page-view/styles/styles.css
  66. +5 −3 plugins/flexi-pages-widget/flexi-pages-widget.php
  67. +7 −4 plugins/my-link-order/mylinkorder.php
  68. +75 −69 plugins/page-tagger/README.txt
  69. +57 −0 plugins/page-tagger/languages/page-tagger.pot
  70. +1 −1  plugins/page-tagger/page-tagger.js
  71. +102 −96 plugins/page-tagger/page-tagger.php
  72. +2 −2 plugins/recently-updated-pages/recently_updated_pages.php
  73. +1 −1  themes/QMO4/members/members-loop.php
  74. +15 −15 themes/QMO4/style.css
38 plugins/buddypress/bp-activity/bp-activity-classes.php
View
@@ -56,7 +56,7 @@ function populate() {
}
function save() {
- global $wpdb, $bp, $current_user;
+ global $wpdb, $bp;
$this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) );
$this->item_id = apply_filters_ref_array( 'bp_activity_item_id_before_save', array( $this->item_id, &$this ) );
@@ -83,21 +83,23 @@ function save() {
$this->primary_link = bp_loggedin_user_domain();
// If we have an existing ID, update the activity item, otherwise insert it.
- if ( $this->id )
- $q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %s, secondary_item_id = %s, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id );
- else
- $q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
+ if ( $this->id ) {
+ $q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %d, secondary_item_id = %d, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id );
+ } else {
+ $q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam );
+ }
if ( false === $wpdb->query( $q ) )
return false;
// If this is a new activity item, set the $id property
- if ( empty( $this->id ) )
+ if ( empty( $this->id ) ) {
$this->id = $wpdb->insert_id;
// If an existing activity item, prevent any changes to the content generating new @mention notifications.
- else
+ } else {
add_filter( 'bp_activity_at_name_do_notifications', '__return_false' );
+ }
do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
@@ -216,7 +218,7 @@ function get( $args = array() ) {
}
if ( !empty( $the_index ) ) {
- $index_hint_sql = $wpdb->prepare( "USE INDEX ({$the_index})" );
+ $index_hint_sql = "USE INDEX ({$the_index})";
} else {
$index_hint_sql = '';
}
@@ -228,12 +230,12 @@ function get( $args = array() ) {
$per_page = absint( $per_page );
$pag_sql = $wpdb->prepare( "LIMIT %d, %d", absint( ( $page - 1 ) * $per_page ), $per_page );
- $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}" ), $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
+ $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
} else {
- $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}" ), $select_sql, $from_sql, $where_sql, $sort ) );
+ $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
}
- $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$where_sql} ORDER BY a.date_recorded {$sort}" ), $where_sql, $sort );
+ $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort );
$total_activities = $wpdb->get_var( $total_activities_sql );
@@ -247,7 +249,7 @@ function get( $args = array() ) {
$activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) );
if ( !empty( $activity_user_ids ) ) {
- if ( $names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) ) {
+ if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) {
foreach ( (array) $names as $name )
$tmp_names[$name->user_id] = $name->user_fullname;
@@ -401,9 +403,9 @@ function delete( $args ) {
return false;
// Fetch the activity IDs so we can delete any comments for this activity item
- $activity_ids = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ) );
+ $activity_ids = $wpdb->get_col( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" );
- if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} {$where_sql}" ) ) )
+ if ( !$wpdb->query( "DELETE FROM {$bp->activity->table_name} {$where_sql}" ) )
return false;
if ( $activity_ids ) {
@@ -424,7 +426,7 @@ function delete_activity_item_comments( $activity_ids ) {
else
$activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) );
- return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" ) );
+ return $wpdb->query( "DELETE FROM {$bp->activity->table_name} WHERE type = 'activity_comment' AND item_id IN ({$activity_ids})" );
}
function delete_activity_meta_entries( $activity_ids ) {
@@ -435,7 +437,7 @@ function delete_activity_meta_entries( $activity_ids ) {
else
$activity_ids = implode ( ',', array_map( 'absint', explode ( ',', $activity_ids ) ) );
- return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" ) );
+ return $wpdb->query( "DELETE FROM {$bp->activity->table_name_meta} WHERE activity_id IN ({$activity_ids})" );
}
/**
@@ -560,7 +562,7 @@ function get_child_comments( $parent_id ) {
function get_recorded_components() {
global $wpdb, $bp;
- return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" ) );
+ return $wpdb->get_col( "SELECT DISTINCT component FROM {$bp->activity->table_name} ORDER BY component ASC" );
}
function get_sitewide_items_for_feed( $limit = 35 ) {
@@ -647,7 +649,7 @@ function get_filter_sql( $filter_array ) {
function get_last_updated() {
global $bp, $wpdb;
- return $wpdb->get_var( $wpdb->prepare( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" ) );
+ return $wpdb->get_var( "SELECT date_recorded FROM {$bp->activity->table_name} ORDER BY date_recorded DESC LIMIT 1" );
}
function total_favorite_count( $user_id ) {
4 plugins/buddypress/bp-activity/bp-activity-functions.php
View
@@ -1182,6 +1182,8 @@ function bp_activity_delete( $args = '' ) {
$args = wp_parse_args( $args, $defaults );
+ do_action( 'bp_before_activity_delete', $args );
+
// Adjust the new mention count of any mentioned member
bp_activity_adjust_mention_count( $args['id'], 'delete' );
@@ -1194,8 +1196,6 @@ function bp_activity_delete( $args = '' ) {
else
$user_id = $args['user_id'];
- do_action( 'bp_before_activity_delete', $args );
-
$latest_update = bp_get_user_meta( $user_id, 'bp_latest_update', true );
if ( !empty( $latest_update ) ) {
if ( in_array( (int) $latest_update['id'], (array) $activity_ids_deleted ) ) {
14 plugins/buddypress/bp-blogs/bp-blogs-classes.php
View
@@ -113,8 +113,8 @@ function get( $type, $limit = false, $page = false, $user_id = 0, $search_terms
$paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' AND bm2.meta_value LIKE '%%$filter%%' {$user_sql} GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
$total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2 WHERE b.blog_id = wb.blog_id AND bm.blog_id = b.blog_id AND bm2.blog_id = b.blog_id AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'name' AND bm2.meta_key = 'description' AND ( bm.meta_value LIKE '%%$filter%%' || bm2.meta_value LIKE '%%$filter%%' ) {$user_sql}" );
} else {
- $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' GROUP BY b.blog_id {$order_sql} {$pag_sql}" ) );
- $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb WHERE b.blog_id = wb.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}" ) );
+ $paged_blogs = $wpdb->get_results( "SELECT b.blog_id, b.user_id as admin_user_id, u.user_email as admin_user_email, wb.domain, wb.path, bm.meta_value as last_activity, bm2.meta_value as name FROM {$bp->blogs->table_name} b, {$bp->blogs->table_name_blogmeta} bm, {$bp->blogs->table_name_blogmeta} bm2, {$wpdb->base_prefix}blogs wb, {$wpdb->users} u WHERE b.blog_id = wb.blog_id AND b.user_id = u.ID AND b.blog_id = bm.blog_id AND b.blog_id = bm2.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql} AND bm.meta_key = 'last_activity' AND bm2.meta_key = 'name' GROUP BY b.blog_id {$order_sql} {$pag_sql}" );
+ $total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b, {$wpdb->base_prefix}blogs wb WHERE b.blog_id = wb.blog_id {$user_sql} AND wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}" );
}
$blog_ids = array();
@@ -230,8 +230,8 @@ function get_all( $limit = null, $page = null ) {
$hidden_sql = !bp_current_user_can( 'bp_moderate' ) ? "AND wb.public = 1" : '';
$pag_sql = ( $limit && $page ) ? $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) ) : '';
- $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT b.blog_id FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$hidden_sql} {$pag_sql}" ) );
- $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$hidden_sql}" ) );
+ $paged_blogs = $wpdb->get_results( "SELECT DISTINCT b.blog_id FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$hidden_sql} {$pag_sql}" );
+ $total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 {$hidden_sql}" );
return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
}
@@ -247,8 +247,8 @@ function get_by_letter( $letter, $limit = null, $page = null ) {
if ( $limit && $page )
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
- $paged_blogs = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC{$pag_sql}" ) );
- $total_blogs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC" ) );
+ $paged_blogs = $wpdb->get_results( "SELECT DISTINCT bm.blog_id FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC{$pag_sql}" );
+ $total_blogs = $wpdb->get_var( "SELECT COUNT(DISTINCT bm.blog_id) FROM {$bp->blogs->table_name_blogmeta} bm LEFT JOIN {$wpdb->base_prefix}blogs wb ON bm.blog_id = wb.blog_id WHERE bm.meta_key = 'name' AND bm.meta_value LIKE '$letter%%' {$hidden_sql} AND wb.mature = 0 AND wb.spam = 0 AND wb.archived = '0' AND wb.deleted = 0 ORDER BY bm.meta_value ASC" );
return array( 'blogs' => $paged_blogs, 'total' => $total_blogs );
}
@@ -265,7 +265,7 @@ function get_blog_extras( &$paged_blogs, &$blog_ids, $type = false ) {
}
/* Fetch the blog description for each blog (as it may be empty we can't fetch it in the main query). */
- $blog_descs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, meta_value as description FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'description' AND blog_id IN ( {$blog_ids} )" ) );
+ $blog_descs = $wpdb->get_results( "SELECT blog_id, meta_value as description FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'description' AND blog_id IN ( {$blog_ids} )" );
for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) {
foreach ( (array) $blog_descs as $desc ) {
2  plugins/buddypress/bp-blogs/bp-blogs-functions.php
View
@@ -49,7 +49,7 @@ function bp_blogs_record_existing_blogs() {
$wpdb->query( "TRUNCATE TABLE {$bp->blogs->table_name}" );
if ( is_multisite() )
- $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" ) );
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0" );
else
$blog_ids = 1;
637 plugins/buddypress/bp-core/admin/bp-core-admin.php
View
@@ -1,637 +0,0 @@
-<?php
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-/**
- * Add an extra update message to the update plugin notification.
- *
- * @package BuddyPress Core
- */
-function bp_core_update_message() {
- echo '<p style="color: red; margin: 3px 0 0 0; border-top: 1px solid #ddd; padding-top: 3px">' . __( 'IMPORTANT: <a href="http://codex.buddypress.org/buddypress-site-administration/upgrading-buddypress/">Read this before attempting to update BuddyPress</a>', 'buddypress' ) . '</p>';
-}
-add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' );
-
-/**
- * Output the tabs in the admin area
- *
- * @since 1.5
- * @param string $active_tab Name of the tab that is active
- */
-function bp_core_admin_tabs( $active_tab = '' ) {
-
- // Declare local variables
- $tabs_html = '';
- $idle_class = 'nav-tab';
- $active_class = 'nav-tab nav-tab-active';
-
- // Setup core admin tabs
- $tabs = array(
- '0' => array(
- 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-general-settings' ), 'admin.php' ) ),
- 'name' => __( 'Components', 'buddypress' )
- ),
- '1' => array(
- 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
- 'name' => __( 'Pages', 'buddypress' )
- ),
- '2' => array(
- 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
- 'name' => __( 'Settings', 'buddypress' )
- )
- );
-
- // If forums component is active, add additional tab
- if ( bp_is_active( 'forums' ) ) {
- $tabs['3'] = array(
- 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-forums-setup' ), 'admin.php' ) ),
- 'name' => __( 'Forums', 'buddypress' )
- );
- }
-
- // Loop through tabs and build navigation
- foreach( $tabs as $tab_id => $tab_data ) {
- $is_current = (bool) ( $tab_data['name'] == $active_tab );
- $tab_class = $is_current ? $active_class : $idle_class;
- $tabs_html .= '<a href="' . $tab_data['href'] . '" class="' . $tab_class . '">' . $tab_data['name'] . '</a>';
- }
-
- // Output the tabs
- echo $tabs_html;
-
- // Do other fun things
- do_action( 'bp_admin_tabs' );
-}
-
-/**
- * Renders the Settings admin panel.
- *
- * @package BuddyPress Core
- * @since {@internal Unknown}}
- */
-function bp_core_admin_settings() {
- global $wpdb, $bp;
-
- $ud = get_userdata( $bp->loggedin_user->id );
-
- if ( isset( $_POST['bp-admin-submit'] ) && isset( $_POST['bp-admin'] ) ) {
- if ( !check_admin_referer('bp-admin') )
- return false;
-
- // Settings form submitted, now save the settings.
- foreach ( (array)$_POST['bp-admin'] as $key => $value )
- bp_update_option( $key, $value );
-
- } ?>
-
- <div class="wrap">
-
- <?php screen_icon( 'buddypress' ); ?>
-
- <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Settings', 'buddypress' ) ); ?></h2>
-
- <?php if ( isset( $_POST['bp-admin'] ) ) : ?>
-
- <div id="message" class="updated fade">
- <p><?php _e( 'Settings Saved', 'buddypress' ); ?></p>
- </div>
-
- <?php endif; ?>
-
- <form action="" method="post" id="bp-admin-form">
-
- <table class="form-table">
- <tbody>
-
- <?php if ( bp_is_active( 'xprofile' ) ) : ?>
-
- <tr>
- <th scope="row"><?php _e( 'Disable BuddyPress to WordPress profile syncing?', 'buddypress' ) ?></th>
- <td>
- <input type="radio" name="bp-admin[bp-disable-profile-sync]"<?php if ( (int)bp_get_option( 'bp-disable-profile-sync' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-profile-sync" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
- <input type="radio" name="bp-admin[bp-disable-profile-sync]"<?php if ( !(int)bp_get_option( 'bp-disable-profile-sync' ) || '' == bp_get_option( 'bp-disable-profile-sync' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-profile-sync" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
- </td>
- </tr>
-
- <?php endif; ?>
-
- <tr>
- <th scope="row"><?php _e( 'Hide admin bar for logged out users?', 'buddypress' ) ?></th>
- <td>
- <input type="radio" name="bp-admin[hide-loggedout-adminbar]"<?php if ( (int)bp_get_option( 'hide-loggedout-adminbar' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-hide-loggedout-adminbar-yes" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
- <input type="radio" name="bp-admin[hide-loggedout-adminbar]"<?php if ( !(int)bp_get_option( 'hide-loggedout-adminbar' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-hide-loggedout-adminbar-no" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
- </td>
- </tr>
-
- <tr>
- <th scope="row"><?php _e( 'Disable avatar uploads? (Gravatars will still work)', 'buddypress' ) ?></th>
- <td>
- <input type="radio" name="bp-admin[bp-disable-avatar-uploads]"<?php if ( (int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-disable-avatar-uploads-yes" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
- <input type="radio" name="bp-admin[bp-disable-avatar-uploads]"<?php if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) ) : ?> checked="checked"<?php endif; ?> id="bp-admin-disable-avatar-uploads-no" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
- </td>
- </tr>
-
- <tr>
- <th scope="row"><?php _e( 'Disable user account deletion?', 'buddypress' ) ?></th>
- <td>
- <input type="radio" name="bp-admin[bp-disable-account-deletion]"<?php if ( (int)bp_get_option( 'bp-disable-account-deletion' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-account-deletion" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
- <input type="radio" name="bp-admin[bp-disable-account-deletion]"<?php if ( !(int)bp_get_option( 'bp-disable-account-deletion' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-account-deletion" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
- </td>
- </tr>
-
- <?php if ( bp_is_active( 'activity' ) ) : ?>
-
- <tr>
- <th scope="row"><?php _e( 'Disable activity stream commenting on blog and forum posts?', 'buddypress' ) ?></th>
- <td>
- <input type="radio" name="bp-admin[bp-disable-blogforum-comments]"<?php if ( (int)bp_get_option( 'bp-disable-blogforum-comments' ) || false === bp_get_option( 'bp-disable-blogforum-comments' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-blogforum-comments" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
- <input type="radio" name="bp-admin[bp-disable-blogforum-comments]"<?php if ( !(int)bp_get_option( 'bp-disable-blogforum-comments' ) ) : ?> checked="checked"<?php endif; ?> id="bp-disable-blogforum-comments" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
- </td>
- </tr>
-
- <?php endif; ?>
-
- <?php if ( bp_is_active( 'groups' ) ) : ?>
-
- <tr>
- <th scope="row"><?php _e( 'Restrict group creation to Site Admins?', 'buddypress' ) ?></th>
- <td>
- <input type="radio" name="bp-admin[bp_restrict_group_creation]"<?php checked( '1', bp_get_option( 'bp_restrict_group_creation', '0' ) ); ?>id="bp-restrict-group-creation" value="1" /> <?php _e( 'Yes', 'buddypress' ) ?> &nbsp;
- <input type="radio" name="bp-admin[bp_restrict_group_creation]"<?php checked( '0', bp_get_option( 'bp_restrict_group_creation', '0' ) ); ?>id="bp-restrict-group-creation" value="0" /> <?php _e( 'No', 'buddypress' ) ?>
- </td>
- </tr>
-
- <?php endif; ?>
-
- <?php do_action( 'bp_core_admin_screen_fields' ) ?>
-
- </tbody>
- </table>
-
- <?php do_action( 'bp_core_admin_screen' ); ?>
-
- <p class="submit">
- <input class="button-primary" type="submit" name="bp-admin-submit" id="bp-admin-submit" value="<?php _e( 'Save Settings', 'buddypress' ); ?>" />
- </p>
-
- <?php wp_nonce_field( 'bp-admin' ); ?>
-
- </form>
-
- </div>
-
-<?php
-}
-
-function bp_core_admin_component_setup_handler() {
- global $wpdb, $bp;
-
- if ( isset( $_POST['bp-admin-component-submit'] ) ) {
- if ( !check_admin_referer('bp-admin-component-setup') )
- return false;
-
- // Settings form submitted, now save the settings. First, set active components
- if ( isset( $_POST['bp_components'] ) ) {
- // Save settings and upgrade schema
- require( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-update.php' );
- $bp->active_components = stripslashes_deep( $_POST['bp_components'] );
- bp_core_install( $bp->active_components );
-
- bp_update_option( 'bp-active-components', $bp->active_components );
- }
-
- $base_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-general-settings', 'updated' => 'true' ), 'admin.php' ) );
-
- wp_redirect( $base_url );
- }
-}
-add_action( 'admin_init', 'bp_core_admin_component_setup_handler' );
-
-function bp_core_admin_pages_setup_handler() {
- global $wpdb, $bp;
-
- if ( isset( $_POST['bp-admin-pages-submit'] ) || isset( $_POST['bp-admin-pages-single'] ) ) {
- if ( !check_admin_referer( 'bp-admin-pages-setup' ) )
- return false;
-
- // Then, update the directory pages
- if ( isset( $_POST['bp_pages'] ) ) {
-
- $directory_pages = array();
-
- foreach ( (array)$_POST['bp_pages'] as $key => $value ) {
- if ( !empty( $value ) ) {
- $directory_pages[$key] = (int)$value;
- }
- }
- bp_core_update_directory_page_ids( $directory_pages );
- }
-
- $base_url = bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings', 'updated' => 'true' ), 'admin.php' ) );
-
- wp_redirect( $base_url );
- }
-}
-add_action( 'admin_init', 'bp_core_admin_pages_setup_handler' );
-
-/**
- * Renders the Component Setup admin panel.
- *
- * @package BuddyPress Core
- * @since {@internal Unknown}}
- * @uses bp_core_admin_component_options()
- */
-function bp_core_admin_component_setup() {
-?>
-
- <div class="wrap">
-
- <?php screen_icon( 'buddypress'); ?>
-
- <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Components', 'buddypress' ) ); ?></h2>
-
- <?php if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] ) : ?>
-
- <div id="message" class="updated fade">
-
- <p><?php _e( 'Settings Saved', 'buddypress' ); ?></p>
-
- </div>
-
- <?php endif; ?>
-
- <form action="" method="post" id="bp-admin-component-form">
-
- <?php bp_core_admin_component_options(); ?>
-
- <p class="submit clear">
- <input class="button-primary" type="submit" name="bp-admin-component-submit" id="bp-admin-component-submit" value="<?php _e( 'Save Settings', 'buddypress' ) ?>"/>
- </p>
-
- <?php wp_nonce_field( 'bp-admin-component-setup' ); ?>
-
- </form>
- </div>
-
-<?php
-}
-
-/**
- * Renders the Component Setup admin panel.
- *
- * @package BuddyPress Core
- * @since {@internal Unknown}}
- * @uses bp_core_admin_component_options()
- */
-function bp_core_admin_page_setup() {
-?>
-
- <div class="wrap">
-
- <?php screen_icon( 'buddypress'); ?>
-
- <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Pages', 'buddypress' ) ); ?></h2>
-
- <?php if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] ) : ?>
-
- <div id="message" class="updated fade">
-
- <p><?php _e( 'Settings Saved', 'buddypress' ); ?></p>
-
- </div>
-
- <?php endif; ?>
-
- <form action="" method="post" id="bp-admin-page-form">
-
- <?php bp_core_admin_page_options(); ?>
-
- <p class="submit clear">
- <input class="button-primary" type="submit" name="bp-admin-pages-submit" id="bp-admin-pages-submit" value="<?php _e( 'Save All', 'buddypress' ) ?>"/>
- </p>
-
- <?php wp_nonce_field( 'bp-admin-pages-setup' ); ?>
-
- </form>
- </div>
-
-<?php
-}
-
-/**
- * Creates reusable markup for component setup on the Components and Pages dashboard panel.
- *
- * This markup has been abstracted so that it can be used both during the setup wizard as well as
- * when BP has been fully installed.
- *
- * @package BuddyPress Core
- * @since 1.5
- */
-function bp_core_admin_component_options() {
- global $bp_wizard;
-
- // Load core functions, if needed
- if ( !function_exists( 'bp_get_option' ) )
- require( BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php' );
-
- $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
-
- // An array of strings looped over to create component setup markup
- $optional_components = array(
- 'xprofile' => array(
- 'title' => __( 'Extended Profiles', 'buddypress' ),
- 'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' )
- ),
- 'settings' => array(
- 'title' => __( 'Account Settings', 'buddypress' ),
- 'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
- ),
- 'friends' => array(
- 'title' => __( 'Friend Connections', 'buddypress' ),
- 'description' => __( 'Let your users make connections so they can track the activity of others and focus on the people they care about the most.', 'buddypress' )
- ),
- 'messages' => array(
- 'title' => __( 'Private Messaging', 'buddypress' ),
- 'description' => __( 'Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.', 'buddypress' )
- ),
- 'activity' => array(
- 'title' => __( 'Activity Streams', 'buddypress' ),
- 'description' => __( 'Global, personal, and group activity streams with threaded commenting, direct posting, favoriting and @mentions, all with full RSS feed and email notification support.', 'buddypress' )
- ),
- 'groups' => array(
- 'title' => __( 'User Groups', 'buddypress' ),
- 'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
- ),
- 'forums' => array(
- 'title' => __( 'Discussion Forums', 'buddypress' ),
- 'description' => __( 'Full-powered discussion forums built directly into groups allow for more conventional in-depth conversations. NOTE: This will require an extra (but easy) setup step.', 'buddypress' )
- ),
- 'blogs' => array(
- 'title' => __( 'Site Tracking', 'buddypress' ),
- 'description' => __( 'Make BuddyPress aware of new posts and new comments from your site.', 'buddypress' )
- )
- );
-
- if ( is_multisite() )
- $optional_components['blogs']['description'] = __( 'Make BuddyPress aware of new sites, new posts and new comments from across your entire network.', 'buddypress' );
-
- // If this is an upgrade from before BuddyPress 1.5, we'll have to convert deactivated
- // components into activated ones
- if ( empty( $active_components ) ) {
- $deactivated_components = bp_get_option( 'bp-deactivated-components' );
-
- // Trim off namespace and filename
- $trimmed = array();
- foreach ( (array) $deactivated_components as $component => $value ) {
- $trimmed[] = str_replace( '.php', '', str_replace( 'bp-', '', $component ) );
- }
-
- // Loop through the optional components to create an active component array
- foreach ( (array) $optional_components as $ocomponent => $ovalue ) {
- if ( !in_array( $ocomponent, $trimmed ) ) {
- $active_components[$ocomponent] = 1;
- }
- }
- }
-
- // Required components
- $required_components = array(
- 'core' => array(
- 'title' => __( 'BuddyPress Core', 'buddypress' ),
- 'description' => __( 'It&#8216;s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' )
- ),
- 'members' => array(
- 'title' => __( 'Community Members', 'buddypress' ),
- 'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' )
- ),
- );
-
- // On new install, set all components to be active by default
- if ( !empty( $bp_wizard ) && 'install' == $bp_wizard->setup_type && empty( $active_components ) )
- $active_components = $optional_components;
-
- ?>
-
- <?php /* The setup wizard uses different, more descriptive text here */ ?>
- <?php if ( empty( $bp_wizard ) ) : ?>
-
- <h3><?php _e( 'Available Components', 'buddypress' ); ?></h3>
-
- <p><?php _e( 'Each component has a unique purpose, and your community may not need each one.', 'buddypress' ); ?></p>
-
- <?php endif ?>
-
- <table class="form-table">
- <tbody>
-
- <?php foreach ( $optional_components as $name => $labels ) : ?>
-
- <tr valign="top">
- <th scope="row"><?php echo esc_html( $labels['title'] ); ?></th>
-
- <td>
- <label for="bp_components[<?php echo esc_attr( $name ); ?>]">
- <input type="checkbox" id="bp_components[<?php echo esc_attr( $name ); ?>]" name="bp_components[<?php echo esc_attr( $name ); ?>]" value="1"<?php checked( isset( $active_components[esc_attr( $name )] ) ); ?> />
-
- <?php echo $labels['description']; ?>
-
- </label>
-
- </td>
- </tr>
-
- <?php endforeach ?>
-
- </tbody>
- </table>
-
- <?php if ( empty( $bp_wizard ) ) : ?>
-
- <h3><?php _e( 'Required Components', 'buddypress' ); ?></h3>
-
- <p><?php _e( 'The following components are required by BuddyPress and cannot be turned off.', 'buddypress' ); ?></p>
-
- <?php endif ?>
-
- <table class="form-table">
- <tbody>
-
- <?php foreach ( $required_components as $name => $labels ) : ?>
-
- <tr valign="top">
- <th scope="row"><?php echo esc_html( $labels['title'] ); ?></th>
-
- <td>
- <label for="bp_components[<?php echo esc_attr( $name ); ?>]">
- <input type="checkbox" id="bp_components[<?php echo esc_attr( $name ); ?>]" name="" disabled="disabled" value="1"<?php checked( true ); ?> />
-
- <?php echo $labels['description']; ?>
-
- </label>
-
- </td>
- </tr>
-
- <?php endforeach ?>
-
- </tbody>
- </table>
-
- <input type="hidden" name="bp_components[members]" value="1" />
-
- <?php
-}
-
-/**
- * Creates reusable markup for page setup on the Components and Pages dashboard panel.
- *
- * This markup has been abstracted so that it can be used both during the setup wizard as well as
- * when BP has been fully installed.
- *
- * @package BuddyPress Core
- * @since 1.5
- */
-function bp_core_admin_page_options() {
- global $bp;
-
- // Get the existing WP pages
- $existing_pages = bp_core_get_directory_page_ids();
-
- // Set up an array of components (along with component names) that have
- // directory pages.
- $directory_pages = array();
-
- foreach( $bp->loaded_components as $component_slug => $component_id ) {
-
- // Only components that need directories should be listed here
- if ( isset( $bp->{$component_id} ) && !empty( $bp->{$component_id}->has_directory ) ) {
-
- // component->name was introduced in BP 1.5, so we must provide a fallback
- $component_name = !empty( $bp->{$component_id}->name ) ? $bp->{$component_id}->name : ucwords( $component_id );
-
- $directory_pages[$component_id] = $component_name;
- }
- }
-
- $directory_pages = apply_filters( 'bp_directory_pages', $directory_pages );
-
- ?>
-
- <h3><?php _e( 'Directories', 'buddypress' ); ?></h3>
-
- <p><?php _e( 'Associate a WordPress Page with each BuddyPress component directory.', 'buddypress' ); ?></p>
-
- <table class="form-table">
- <tbody>
-
- <?php foreach ( $directory_pages as $name => $label ) : ?>
- <?php $disabled = !bp_is_active( $name ) ? ' disabled="disabled"' : ''; ?>
-
- <tr valign="top">
- <th scope="row">
- <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
- </th>
-
- <td>
- <?php if ( !bp_is_root_blog() )
- switch_to_blog( bp_get_root_blog_id() ) ?>
-
- <?php echo wp_dropdown_pages( array(
- 'name' => 'bp_pages[' . esc_attr( $name ) . ']',
- 'echo' => false,
- 'show_option_none' => __( '- None -', 'buddypress' ),
- 'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
- ) ); ?>
-
- <a href="<?php echo admin_url( add_query_arg( array( 'post_type' => 'page' ), 'post-new.php' ) ); ?>" class="button-secondary"><?php _e( 'New Page' ); ?></a>
- <input class="button-primary" type="submit" name="bp-admin-pages-single" value="<?php _e( 'Save', 'buddypress' ) ?>" />
-
- <?php if ( !empty( $existing_pages[$name] ) ) : ?>
-
- <a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View' ); ?></a>
-
- <?php endif; ?>
-
- <?php if ( !bp_is_root_blog() )
- restore_current_blog() ?>
-
- </td>
- </tr>
-
-
- <?php endforeach ?>
-
- <?php do_action( 'bp_active_external_directories' ); ?>
-
- </tbody>
- </table>
-
- <?php
-
- // Static pages
- $static_pages = array(
- 'register' => __( 'Register', 'buddypress' ),
- 'activate' => __( 'Activate', 'buddypress' ),
- ); ?>
-
- <h3><?php _e( 'Registration', 'buddypress' ); ?></h3>
-
- <p><?php _e( 'Associate WordPress Pages with the following BuddyPress Registration pages.', 'buddypress' ); ?></p>
-
- <table class="form-table">
- <tbody>
-
- <?php foreach ( $static_pages as $name => $label ) : ?>
-
- <tr valign="top">
- <th scope="row">
- <label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
- </th>
-
- <td>
- <?php echo wp_dropdown_pages( array(
- 'name' => 'bp_pages[' . esc_attr( $name ) . ']',
- 'echo' => false,
- 'show_option_none' => __( '- None -', 'buddypress' ),
- 'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
- ) ) ?>
-
- <a href="<?php echo admin_url( add_query_arg( array( 'post_type' => 'page' ), 'post-new.php' ) ); ?>" class="button-secondary"><?php _e( 'New Page' ); ?></a>
- <input class="button-primary" type="submit" name="bp-admin-pages-single" value="<?php _e( 'Save', 'buddypress' ) ?>" />
-
- <?php if ( !empty( $existing_pages[$name] ) ) : ?>
-
- <a href="<?php echo get_permalink( $existing_pages[$name] ); ?>" class="button-secondary" target="_bp"><?php _e( 'View' ); ?></a>
-
- <?php endif; ?>
-
- </td>
- </tr>
-
- <?php endforeach ?>
-
- <?php do_action( 'bp_active_external_pages' ); ?>
-
- </tbody>
- </table>
-
- <?php
-}
-
-/**
- * Loads admin panel styles and scripts.
- *
- * @package BuddyPress Core
- * @since {@internal Unknown}}
- */
-function bp_core_add_admin_menu_styles() {
- if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
- wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . '/bp-core/css/admin.dev.css' ), array(), '20110723' );
- else
- wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . '/bp-core/css/admin.css' ), array(), '20110723' );
-
- wp_enqueue_script( 'thickbox' );
- wp_enqueue_style( 'thickbox' );
-}
-
-?>
2  plugins/buddypress/bp-core/admin/bp-core-functions.php
View
@@ -217,7 +217,7 @@ function bp_core_activation_notice() {
* on the off chance that someone has activated the blogs component and then disabled MS
*/
if ( bp_is_active( 'blogs' ) ) {
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" ) );
+ $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$bp->blogs->table_name}" );
if ( empty( $count ) ) {
bp_blogs_record_existing_blogs();
1  plugins/buddypress/bp-core/admin/css/wizard.dev.css
View
@@ -140,6 +140,7 @@ div#bp-wizard table.form-table th {
div#bp-wizard table.form-table th img {
margin-top: 5px;
+ width: 300px;
}
div#bp-wizard table.form-table th p {
38 plugins/buddypress/bp-core/bp-core-avatars.php
View
@@ -475,7 +475,6 @@ function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
if ( !apply_filters( 'bp_core_pre_avatar_handle_upload', true, $file, $upload_dir_filter ) )
return true;
- require_once( ABSPATH . '/wp-admin/includes/image.php' );
require_once( ABSPATH . '/wp-admin/includes/file.php' );
$uploadErrors = array(
@@ -514,27 +513,46 @@ function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
}
// Get image size
- $size = @getimagesize( $bp->avatar_admin->original['file'] );
+ $size = @getimagesize( $bp->avatar_admin->original['file'] );
+ $error = false;
// Check image size and shrink if too large
if ( $size[0] > bp_core_avatar_original_max_width() ) {
- $thumb = wp_create_thumbnail( $bp->avatar_admin->original['file'], bp_core_avatar_original_max_width() );
+ $editor = wp_get_image_editor( $bp->avatar_admin->original['file'] );
- // Check for thumbnail creation errors
- if ( is_wp_error( $thumb ) ) {
- bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $thumb->get_error_message() ), 'error' );
- return false;
+ if ( ! is_wp_error( $editor ) ) {
+ $editor->set_quality( 100 );
+
+ $resized = $editor->resize( bp_core_avatar_original_max_width(), bp_core_avatar_original_max_width(), false );
+ if ( ! is_wp_error( $resized ) )
+ $thumb = $editor->save( $editor->generate_filename() );
+ else
+ $error = $resized;
+
+ // Check for thumbnail creation errors
+ if ( false === $error && is_wp_error( $thumb ) )
+ $error = $thumb;
+
+ if ( false === $error ) {
+ // Thumbnail is good so proceed
+ $bp->avatar_admin->resized = $thumb;
+ }
+
+ } else {
+ $error = $editor;
}
- // Thumbnail is good so proceed
- $bp->avatar_admin->resized = $thumb;
+ if ( false !== $error ) {
+ bp_core_add_message( sprintf( __( 'Upload Failed! Error was: %s', 'buddypress' ), $error->get_error_message() ), 'error' );
+ return false;
+ }
}
// We only want to handle one image after resize.
if ( empty( $bp->avatar_admin->resized ) )
$bp->avatar_admin->image->dir = str_replace( bp_core_avatar_upload_path(), '', $bp->avatar_admin->original['file'] );
else {
- $bp->avatar_admin->image->dir = str_replace( bp_core_avatar_upload_path(), '', $bp->avatar_admin->resized );
+ $bp->avatar_admin->image->dir = str_replace( bp_core_avatar_upload_path(), '', $bp->avatar_admin->resized['path'] );
@unlink( $bp->avatar_admin->original['file'] );
}
2  plugins/buddypress/bp-core/bp-core-cache.php
View
@@ -102,7 +102,7 @@ function bp_update_meta_cache( $args = array() ) {
// Get meta info
$id_list = join( ',', $object_ids );
- $meta_list = $wpdb->get_results( $wpdb->prepare( "SELECT $object_column, meta_key, meta_value FROM $meta_table WHERE $object_column IN ($id_list)" ), ARRAY_A );
+ $meta_list = $wpdb->get_results( "SELECT $object_column, meta_key, meta_value FROM $meta_table WHERE $object_column IN ($id_list)", ARRAY_A );
if ( !empty( $meta_list ) ) {
foreach ( $meta_list as $metarow ) {
3  plugins/buddypress/bp-core/bp-core-catchuri.php
View
@@ -136,6 +136,9 @@ function bp_core_set_uri_globals() {
// Keep the unfiltered URI safe
$bp->unfiltered_uri = $bp_uri;
+ // Don't use $bp_unfiltered_uri, this is only for backpat with old plugins. Use $bp->unfiltered_uri.
+ $GLOBALS['bp_unfiltered_uri'] = &$bp->unfiltered_uri;
+
// Get slugs of pages into array
foreach ( (array) $bp->pages as $page_key => $bp_page )
$key_slugs[$page_key] = trailingslashit( '/' . $bp_page->slug );
14 plugins/buddypress/bp-core/bp-core-classes.php
View
@@ -415,8 +415,8 @@ function get_users_by_letter( $letter, $limit = null, $page = 1, $populate_extra
$exclude_sql = ( !empty( $exclude ) ) ? " AND u.ID NOT IN ({$exclude})" : "";
- $total_users_sql = apply_filters( 'bp_core_users_by_letter_count_sql', $wpdb->prepare( "SELECT COUNT(DISTINCT u.ID) FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE {$status_sql} AND pf.name = %s {$exclude_sql} AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC", bp_xprofile_fullname_field_name() ), $letter );
- $paged_users_sql = apply_filters( 'bp_core_users_by_letter_sql', $wpdb->prepare( "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.user_email FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE {$status_sql} AND pf.name = %s {$exclude_sql} AND pd.value LIKE '$letter%%' ORDER BY pd.value ASC{$pag_sql}", bp_xprofile_fullname_field_name() ), $letter, $pag_sql );
+ $total_users_sql = apply_filters( 'bp_core_users_by_letter_count_sql', $wpdb->prepare( "SELECT COUNT(DISTINCT u.ID) FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE {$status_sql} AND pf.name = %s {$exclude_sql} AND pd.value LIKE '{$letter}%%' ORDER BY pd.value ASC", bp_xprofile_fullname_field_name() ), $letter );
+ $paged_users_sql = apply_filters( 'bp_core_users_by_letter_sql', $wpdb->prepare( "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.user_email FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id LEFT JOIN {$bp->profile->table_name_fields} pf ON pd.field_id = pf.id WHERE {$status_sql} AND pf.name = %s {$exclude_sql} AND pd.value LIKE '{$letter}%%' ORDER BY pd.value ASC{$pag_sql}", bp_xprofile_fullname_field_name() ), $letter, $pag_sql );
$total_users = $wpdb->get_var( $total_users_sql );
$paged_users = $wpdb->get_results( $paged_users_sql );
@@ -464,8 +464,8 @@ function get_specific_users( $user_ids, $limit = null, $page = 1, $populate_extr
$user_sql = " AND user_id IN ( " . $wpdb->escape( $user_ids ) . " ) ";
$status_sql = bp_core_get_status_sql();
- $total_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', $wpdb->prepare( "SELECT COUNT(DISTINCT ID) FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ( " . $wpdb->escape( $user_ids ) . " ) " ), $wpdb->escape( $user_ids ) );
- $paged_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', $wpdb->prepare( "SELECT DISTINCT ID as id, user_registered, user_nicename, user_login, user_email FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ( " . $wpdb->escape( $user_ids ) . " ) {$pag_sql}" ), $wpdb->escape( $user_ids ) );
+ $total_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', "SELECT COUNT(DISTINCT ID) FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ( " . $wpdb->escape( $user_ids ) . " ) ", $wpdb->escape( $user_ids ) );
+ $paged_users_sql = apply_filters( 'bp_core_get_specific_users_count_sql', "SELECT DISTINCT ID as id, user_registered, user_nicename, user_login, user_email FROM {$wpdb->users} WHERE {$status_sql} AND ID IN ( " . $wpdb->escape( $user_ids ) . " ) {$pag_sql}", $wpdb->escape( $user_ids ) );
$total_users = $wpdb->get_var( $total_users_sql );
$paged_users = $wpdb->get_results( $paged_users_sql );
@@ -507,8 +507,8 @@ function search_users( $search_terms, $limit = null, $page = 1, $populate_extras
$search_terms = like_escape( $wpdb->escape( $search_terms ) );
$status_sql = bp_core_get_status_sql( 'u.' );
- $total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT COUNT(DISTINCT u.ID) as id FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE {$status_sql} AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC", $search_terms );
- $paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.user_email FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE {$status_sql} AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}", $search_terms, $pag_sql );
+ $total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT COUNT(DISTINCT u.ID) as id FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE {$status_sql} AND pd.value LIKE '%%{$search_terms}%%' ORDER BY pd.value ASC", $search_terms );
+ $paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.user_email FROM {$wpdb->users} u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE {$status_sql} AND pd.value LIKE '%%{$search_terms}%%' ORDER BY pd.value ASC{$pag_sql}", $search_terms, $pag_sql );
$total_users = $wpdb->get_var( $total_users_sql );
$paged_users = $wpdb->get_results( $paged_users_sql );
@@ -625,7 +625,7 @@ function get_user_extras( &$paged_users, &$user_ids, $type = false ) {
function get_core_userdata( $user_id ) {
global $wpdb;
- if ( !$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id ) ) )
+ if ( !$user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE ID = %d LIMIT 1", $user_id ) ) )
return false;
return $user;
14 plugins/buddypress/bp-core/bp-core-cssjs.php
View
@@ -54,8 +54,7 @@ function bp_core_add_cropper_inline_js() {
$aspect_ratio = $full_width / $full_height;
$width = $image[0] / 2;
- $height = $image[1] / 2;
-?>
+ $height = $image[1] / 2; ?>
<script type="text/javascript">
jQuery(window).load( function(){
@@ -80,11 +79,15 @@ function showPreview(coords) {
if ( parseInt(coords.w) > 0 ) {
var rx = <?php echo $full_width; ?> / coords.w;
var ry = <?php echo $full_height; ?> / coords.h;
+ <?php if ( $image ) : ?>
+ var w = <?php echo $image[0]; ?>;
+ var h = <?php echo $image[1]; ?>;
+ <?php endif; ?>
jQuery('#avatar-crop-preview').css({
<?php if ( $image ) : ?>
- width: Math.round(rx * <?php echo $image[0]; ?>) + 'px',
- height: Math.round(ry * <?php echo $image[1]; ?>) + 'px',
+ width: Math.round(rx * w) + 'px',
+ height: Math.round(ry * h) + 'px',
<?php endif; ?>
marginLeft: '-' + Math.round(rx * coords.x) + 'px',
marginTop: '-' + Math.round(ry * coords.y) + 'px'
@@ -104,12 +107,11 @@ function showPreview(coords) {
* @package BuddyPress Core
*/
function bp_core_add_cropper_inline_css() {
- global $bp;
?>
<style type="text/css">
.jcrop-holder { float: left; margin: 0 20px 20px 0; text-align: left; }
- .jcrop-vline, .jcrop-hline { font-size: 0; position: absolute; background: white top left repeat url( <?php echo BP_PLUGIN_URL ?>/bp-core/images/Jcrop.gif ); }
+ .jcrop-vline, .jcrop-hline { font-size: 0; position: absolute; background: white top left repeat url('<?php echo BP_PLUGIN_URL ?>/bp-core/images/Jcrop.gif'); }
.jcrop-vline { height: 100%; width: 1px !important; }
.jcrop-hline { width: 100%; height: 1px !important; }
.jcrop-handle { font-size: 1px; width: 7px !important; height: 7px !important; border: 1px #eee solid; background-color: #333; *width: 9px; *height: 9px; }
2  plugins/buddypress/bp-core/bp-core-filters.php
View
@@ -95,7 +95,7 @@ function bp_core_filter_comments( $comments, $post_id ) {
$user_ids = implode( ',', $user_ids );
- if ( !$userdata = $wpdb->get_results( $wpdb->prepare( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) ) )
+ if ( !$userdata = $wpdb->get_results( "SELECT ID as user_id, user_login, user_nicename FROM {$wpdb->users} WHERE ID IN ({$user_ids})" ) )
return $comments;
foreach( (array) $userdata as $user )
4 plugins/buddypress/bp-core/bp-core-functions.php
View
@@ -173,7 +173,7 @@ function bp_core_get_directory_pages() {
// from the current blog
$posts_table_name = bp_is_multiblog_mode() ? $wpdb->posts : $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'posts';
$page_ids_sql = implode( ',', (array) $page_ids );
- $page_names = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_status = 'publish' " ) );
+ $page_names = $wpdb->get_results( "SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_status = 'publish' " );
foreach ( (array) $page_ids as $component_id => $page_id ) {
foreach ( (array) $page_names as $page_name ) {
@@ -309,7 +309,7 @@ function bp_core_setup_message() {
global $bp;
if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) )
- $bp->template_message = htmlentities($_COOKIE['bp-message']);
+ $bp->template_message = $_COOKIE['bp-message'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
if ( empty( $bp->template_message_type ) && isset( $_COOKIE['bp-message-type'] ) )
$bp->template_message_type = $_COOKIE['bp-message-type'];
114 plugins/buddypress/bp-core/bp-core-hooks.php
View
@@ -1,114 +0,0 @@
-<?php
-// Exit if accessed directly
-if ( !defined( 'ABSPATH' ) ) exit;
-
-/** Loaded ********************************************************************/
-
-add_action( 'plugins_loaded', 'bp_loaded', 10 );
-
-add_action( 'bp_loaded', 'bp_include', 2 );
-
-add_action( 'wp', 'bp_actions', 3 );
-
-add_action( 'wp', 'bp_screens', 4 );
-
-/** Init **********************************************************************/
-
-// Attach bp_init to WordPress init
-add_action( 'init', 'bp_init' );
-
-// Parse the URI and set globals
-add_action( 'bp_init', 'bp_core_set_uri_globals', 2 );
-
-// Setup component globals
-add_action( 'bp_init', 'bp_setup_globals', 4 );
-
-// Setup the navigation menu
-add_action( 'bp_init', 'bp_setup_nav', 7 );
-
-// Setup the navigation menu
-add_action( 'admin_bar_menu', 'bp_setup_admin_bar' );
-
-// Setup the title
-add_action( 'bp_init', 'bp_setup_title', 9 );
-
-// Setup widgets
-add_action( 'bp_loaded', 'bp_setup_widgets' );
-
-// Setup admin bar
-add_action( 'bp_loaded', 'bp_core_load_admin_bar' );
-
-/** The hooks *****************************************************************/
-
-/**
- * Include files on this action
- */
-function bp_include() {
- do_action( 'bp_include' );
-}
-
-/**
- * Setup global variables and objects
- */
-function bp_setup_globals() {
- do_action( 'bp_setup_globals' );
-}
-
-/**
- * Set navigation elements
- */
-function bp_setup_nav() {
- do_action( 'bp_setup_nav' );
-}
-
-/**
- * Set up BuddyPress implementation of the WP admin bar
- */
-function bp_setup_admin_bar() {
- if ( bp_use_wp_admin_bar() )
- do_action( 'bp_setup_admin_bar' );
-}
-
-/**
- * Set the page title
- */
-function bp_setup_title() {
- do_action( 'bp_setup_title' );
-}
-
-/**
- * Register widgets
- */
-function bp_setup_widgets() {
- do_action( 'bp_register_widgets' );
-}
-
-/**
- * Initlialize code
- */
-function bp_init() {
- do_action( 'bp_init' );
-}
-
-/**
- * Attached to plugins_loaded
- */
-function bp_loaded() {
- do_action( 'bp_loaded' );
-}
-
-/**
- * Attach potential template actions
- */
-function bp_actions() {
- do_action( 'bp_actions' );
-}
-
-/**
- * Attach potential template screens
- */
-function bp_screens() {
- do_action( 'bp_screens' );
-}
-
-?>
2  plugins/buddypress/bp-core/bp-core-options.php
View
@@ -290,7 +290,7 @@ function bp_core_get_root_options() {
// Do some magic to get all the root blog options in 1 swoop
$blog_options_keys = "'" . join( "', '", (array) $root_blog_option_keys ) . "'";
$blog_options_table = bp_is_multiblog_mode() ? $wpdb->options : $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'options';
- $blog_options_query = $wpdb->prepare( "SELECT option_name AS name, option_value AS value FROM {$blog_options_table} WHERE option_name IN ( {$blog_options_keys} )" );
+ $blog_options_query = "SELECT option_name AS name, option_value AS value FROM {$blog_options_table} WHERE option_name IN ( {$blog_options_keys} )";
$root_blog_options_meta = $wpdb->get_results( $blog_options_query );
// On Multisite installations, some options must always be fetched from sitemeta
1  plugins/buddypress/bp-core/bp-core-widgets.php
View
@@ -324,5 +324,6 @@ function bp_core_ajax_widget_members() {
<?php endif;
}
add_action( 'wp_ajax_widget_members', 'bp_core_ajax_widget_members' );
+add_action( 'wp_ajax_nopriv_widget_members', 'bp_core_ajax_widget_members' );
?>
1  plugins/buddypress/bp-core/css/admin.css
View
@@ -1 +0,0 @@
-div#icon-buddypress{background:url(../images/icons32.png) no-repeat -4px 0;}div#bp-admin{color:#555;min-width:680px;}div#bp-admin p{line-height:170%;}form#bp-admin-form{margin:0 10px;}div#bp-admin-nav{background:#e0e0e0;margin:15px -10px 10px;padding:10px 10px 0 10px;height:30px;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}div#bp-admin-nav div.submit{position:relative;float:right;margin-top:-36px!important;}div#bp-admin-nav div.submit input{padding:6px 10px;}div#bp-admin-nav ol{list-style-type:decimal;margin:0;padding:0;}div#bp-admin-nav ol li{float:left;margin:0 10px 0 0;color:#666;}div#bp-admin-nav ol li{padding:8px 12px;display:block;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;text-decoration:none;}div#bp-admin-nav ol li.current{background:#f9f9f9;color:#555;}div#bp-admin-nav ol li span.complete{background:url(../images/completed.gif) center left no-repeat;padding:6px;}div.component{width:323px;float:left;margin:15px 30px 0 0;}div.component div.radio{position:relative;background:#e0e0e0;padding:5px 10px;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;top:-6px;}div.component img{margin-top:10px;}div.component p{margin-left:4px;}div.component h5{font-size:18px;float:left;margin:0 0 0 4px;width:100px;}div.component div.radio{font-size:11px;float:right;top:5px;}div#bp-admin div.prev-next,div#bp-admin div.prev-next p,div#bp-admin div.submit,div#bp-admin div.submit p{margin:0;padding:0;}div#bp-admin div.submit{margin-top:30px;}div#bp-admin div.prev-next{text-align:right;margin-top:0;}div#bp-admin div.prev-next{margin:0 -20px;padding:0 20px 10px;}div#bp-admin table td{font-family:helvetica,arial,tahoma,sans-serif;vertical-align:top;}div#bp-admin table.form-table th{border-right:1px solid #eee;padding:15px 25px 15px 0;color:#555;vertical-align:top;}div#bp-admin table.form-table tr{border-bottom:1px dotted #f0f0f0;}div#bp-admin table.form-table td{padding-left:25px;font-size:12px;}div#bp-admin table.form-table th h5{font-size:14px;margin:0;line-height:150%;}div#bp-admin table.form-table th img{margin-top:5px;}div#bp-admin table.form-table th p{margin:3px 0 0 0;}div#bp-admin code,div#bp-admin kbd{font-size:12px;background:#f0f0f0;}div#bp-admin div#message code,div#bp-admin div#message kbd{background:#ffe293;}a.button{padding-top:4px;}a.installed,a.installed:hover,a.installed:active{padding-left:15px;color:#888;border-color:#ccc;cursor:default;}a.installed span{background:url(../images/installed.gif) left center no-repeat;padding:6px 10px 7px 6px;margin-left:-5px;}
160 plugins/buddypress/bp-core/css/admin.dev.css
View
@@ -1,160 +0,0 @@
-div#icon-buddypress {
- background: url( ../images/icons32.png ) no-repeat -4px 0px;
-}
-
-div#bp-admin {
- color: #555;
- min-width: 680px;
- }
- div#bp-admin p { line-height: 170%; }
-
-form#bp-admin-form {
- margin: 0 10px;
-}
-
-div#bp-admin-nav {
- background: #e0e0e0;
- margin: 15px -10px 10px;
- padding: 10px 10px 0 10px;
- height: 30px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
- border-radius: 6px;
-}
-div#bp-admin-nav div.submit {
- position: relative;
- float: right;
- margin-top: -36px !important;
-}
-div#bp-admin-nav div.submit input {
- padding: 6px 10px;
-}
- div#bp-admin-nav ol {
- list-style-type: decimal;
- margin: 0;
- padding: 0;
- }
- div#bp-admin-nav ol li {
- float: left;
- margin: 0 10px 0 0;
- color: #666;
- }
- div#bp-admin-nav ol li {
- padding: 8px 12px;
- display: block;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- text-decoration: none;
- }
- div#bp-admin-nav ol li.current {
- background: #f9f9f9;
- color: #555;
- }
- div#bp-admin-nav ol li span.complete {
- background: url( ../images/completed.gif ) center left no-repeat;
- padding: 6px;
- }
-
-div.component {
- width: 323px;
- float: left;
- margin: 15px 30px 0 0;
-}
- div.component div.radio {
- position: relative;
- background: #e0e0e0;
- padding: 5px 10px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
- border-radius: 6px;
- top: -6px;
- }
-
- div.component img {
- margin-top: 10px;
- }
-
- div.component p {
- margin-left: 4px;
- }
-
- div.component h5 {
- font-size: 18px;
- float: left;
- margin: 0 0 0 4px;
- width: 100px;
- }
-
- div.component div.radio {
- font-size: 11px;
- float: right;
- top: 5px;
- }
-
-div#bp-admin div.prev-next, div#bp-admin div.prev-next p,
-div#bp-admin div.submit, div#bp-admin div.submit p {
- margin: 0;
- padding: 0;
-}
-div#bp-admin div.submit { margin-top: 30px; }
-div#bp-admin div.prev-next { text-align: right; margin-top: 0; }
-
-div#bp-admin div.prev-next {
- margin: 0 -20px;
- padding: 0 20px 10px;
-}
-
-div#bp-admin table td {
- font-family: helvetica, arial, tahoma, sans-serif;
- vertical-align: top;
-}
-
-div#bp-admin table.form-table th {
- border-right: 1px solid #eee;
- padding: 15px 25px 15px 0;
- color: #555;
- vertical-align: top;
-}
- div#bp-admin table.form-table tr {
- border-bottom: 1px dotted #f0f0f0;
- }
- div#bp-admin table.form-table td { padding-left: 25px; font-size: 12px; }
-
- div#bp-admin table.form-table th h5 {
- font-size: 14px;
- margin: 0;
- line-height: 150%;
- }
-
- div#bp-admin table.form-table th img {
- margin-top: 5px;
- }
-
- div#bp-admin table.form-table th p { margin: 3px 0 0 0; }
-
-div#bp-admin code, div#bp-admin kbd {
- font-size: 12px;
- background: #f0f0f0;
-}
-
-div#bp-admin div#message code, div#bp-admin div#message kbd {
- background: #ffe293;
-}
-
-a.button {
- padding-top: 4px;
-}
-
-a.installed, a.installed:hover, a.installed:active {
- padding-left: 15px;
- color: #888;
- border-color: #ccc;
- cursor: default;
-}
-
-a.installed span {
- background: url( ../images/installed.gif) left center no-repeat;
- padding: 6px 10px 7px 6px;
- margin-left: -5px;
-}
14 plugins/buddypress/bp-core/deprecated/1.5.php
View
@@ -420,6 +420,20 @@ function bp_is_friend_requests() {
return bp_is_user_friend_requests();
}
+/**
+ * Checks to see if a component's URL should be in the root, not under a member page:
+ * eg: http://domain.com/groups/the-group NOT http://domain.com/members/andy/groups/the-group
+ * You should be using bp_is_root_component().
+ *
+ * @deprecated 1.5
+ * @deprecated bp_is_root_component()
+ * @return true if root component, else false.
+ */
+function bp_core_is_root_component( $component_name ) {
+ _deprecated_function( __FUNCTION__, '1.5', 'bp_is_root_component()' );
+ return bp_is_root_component( $component_name );
+}
+
/** Theme *********************************************************************/
/**
BIN  plugins/buddypress/bp-core/images/admin-bar-sprite-rtl.png
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/admin-bar-sprite.png
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/admin_menu_icon.png
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/completed.gif
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/find.png
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/icons32.png
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/installed.gif
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/logo-column-header.png
View
Deleted file not rendered
BIN  plugins/buddypress/bp-core/images/logo.png
View
Deleted file not rendered
8 plugins/buddypress/bp-forums/bp-forums-filters.php
View
@@ -155,9 +155,7 @@ function bp_forums_strip_mentions_on_post_edit( $content ) {
* @return string $sql
*/
function bp_forums_add_replied_distinct_sql( $sql ) {
- global $wpdb;
-
- $sql = $wpdb->prepare( "DISTINCT t.topic_id, " );
+ $sql = "DISTINCT t.topic_id, ";
return $sql;
}
@@ -176,9 +174,9 @@ function bp_forums_add_replied_distinct_sql( $sql ) {
* @return string $sql
*/
function bp_forums_add_replied_join_sql( $sql ) {
- global $bbdb, $wpdb;
+ global $bbdb;
- $sql .= $wpdb->prepare( " LEFT JOIN $bbdb->posts p ON p.topic_id = t.topic_id " );
+ $sql .= " LEFT JOIN $bbdb->posts p ON p.topic_id = t.topic_id ";
return $sql;
}
10 plugins/buddypress/bp-forums/bp-forums-functions.php
View
@@ -332,7 +332,7 @@ function bp_forums_total_topic_count() {
$groups_table_sql = '';
$groups_where_sql = "t.topic_status = 0";
}
- $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t {$groups_table_sql} WHERE {$groups_where_sql}" ) );
+ $count = $bbdb->get_results( "SELECT t.topic_id FROM {$bbdb->topics} AS t {$groups_table_sql} WHERE {$groups_where_sql}" );
$count = count( (array) $count );
} else {
$count = 0;
@@ -470,7 +470,7 @@ function bp_forums_get_topic_extras( $topics ) {
$topic_ids = $wpdb->escape( join( ',', (array) $topic_ids ) );
// Fetch the topic's last poster details
- $poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" ) );
+ $poster_details = $wpdb->get_results( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" );
for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
foreach ( (array) $poster_details as $poster ) {
if ( $poster->topic_id == $topics[$i]->topic_id ) {
@@ -484,7 +484,7 @@ function bp_forums_get_topic_extras( $topics ) {
// Fetch fullname for the topic's last poster
if ( bp_is_active( 'xprofile' ) ) {
- $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" ) );
+ $poster_names = $wpdb->get_results( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" );
for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
foreach ( (array) $poster_names as $name ) {
if ( $name->topic_id == $topics[$i]->topic_id )
@@ -609,7 +609,7 @@ function bp_forums_get_post_extras( $posts ) {
$user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );
// Fetch the poster's user_email, user_nicename and user_login
- $poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u WHERE u.ID IN ( {$user_ids} )" ) );
+ $poster_details = $wpdb->get_results( "SELECT u.ID as user_id, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u WHERE u.ID IN ( {$user_ids} )" );
for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
foreach ( (array) $poster_details as $poster ) {
@@ -624,7 +624,7 @@ function bp_forums_get_post_extras( $posts ) {
// Fetch fullname for each poster.
if ( bp_is_active( 'xprofile' ) ) {
- $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id, pd.value FROM {$bp->profile->table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )" ) );
+ $poster_names = $wpdb->get_results( "SELECT pd.user_id, pd.value FROM {$bp->profile->table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )" );
for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
foreach ( (array) $poster_names as $name ) {
if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id )
24 plugins/buddypress/bp-friends/bp-friends-classes.php
View
@@ -84,14 +84,14 @@ function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_ar
global $wpdb, $bp;
if ( !empty( $friend_requests_only ) ) {
- $oc_sql = $wpdb->prepare( "AND is_confirmed = 0" );
+ $oc_sql = "AND is_confirmed = 0";
$friend_sql = $wpdb->prepare ( " WHERE friend_user_id = %d", $user_id );
} else {
- $oc_sql = $wpdb->prepare( "AND is_confirmed = 1" );
+ $oc_sql = "AND is_confirmed = 1";
$friend_sql = $wpdb->prepare ( " WHERE (initiator_user_id = %d OR friend_user_id = %d)", $user_id, $user_id );
}
- $friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" ) );
+ $friends = $wpdb->get_results( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} {$friend_sql} {$oc_sql} ORDER BY date_created DESC" );
$fids = array();
for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) {
@@ -160,11 +160,11 @@ function search_friends( $filter, $user_id, $limit = null, $page = null ) {
// filter the user_ids based on the search criteria.
if ( bp_is_active( 'xprofile' ) ) {
- $sql = "SELECT DISTINCT user_id FROM {$bp->profile->table_name_data} WHERE user_id IN ($fids) AND value LIKE '$filter%%' {$pag_sql}";
- $total_sql = "SELECT COUNT(DISTINCT user_id) FROM {$bp->profile->table_name_data} WHERE user_id IN ($fids) AND value LIKE '$filter%%'";
+ $sql = "SELECT DISTINCT user_id FROM {$bp->profile->table_name_data} WHERE user_id IN ({$fids}) AND value LIKE '{$filter}%%' {$pag_sql}";
+ $total_sql = "SELECT COUNT(DISTINCT user_id) FROM {$bp->profile->table_name_data} WHERE user_id IN ({$fids}) AND value LIKE '{$filter}%%'";
} else {
- $sql = "SELECT DISTINCT user_id FROM {$wpdb->usermeta} WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%' {$pag_sql}";
- $total_sql = "SELECT COUNT(DISTINCT user_id) FROM {$wpdb->usermeta} WHERE user_id IN ($fids) AND meta_key = 'nickname' AND meta_value LIKE '$filter%%'";
+ $sql = "SELECT DISTINCT user_id FROM {$wpdb->usermeta} WHERE user_id IN ({$fids}) AND meta_key = 'nickname' AND meta_value LIKE '{$filter}%%' {$pag_sql}";
+ $total_sql = "SELECT COUNT(DISTINCT user_id) FROM {$wpdb->usermeta} WHERE user_id IN ({$fids}) AND meta_key = 'nickname' AND meta_value LIKE '{$filter}%%'";
}
$filtered_friend_ids = $wpdb->get_col( $sql );
@@ -220,7 +220,7 @@ function reject($friendship_id) {
}
function search_users( $filter, $user_id, $limit = null, $page = null ) {
- global $wpdb;
+ global $wpdb, $bp;
$filter = like_escape( $wpdb->escape( $filter ) );
@@ -232,9 +232,9 @@ function search_users( $filter, $user_id, $limit = null, $page = null ) {
// filter the user_ids based on the search criteria.
if ( bp_is_active( 'xprofile' ) ) {
- $sql = $wpdb->prepare( "SELECT DISTINCT d.user_id as id FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
+ $sql = "SELECT DISTINCT d.user_id as id FROM {$bp->profile->table_name_data} d, {$users_table} u WHERE d.user_id = u.id AND d.value LIKE '{$filter}%%' ORDER BY d.value DESC {$pag_sql}";
} else {
- $sql = $wpdb->prepare( "SELECT DISTINCT user_id as id FROM $usermeta_table WHERE meta_value LIKE '$filter%%' ORDER BY d.value DESC $pag_sql" );
+ $sql = "SELECT DISTINCT user_id as id FROM {$usermeta_table} WHERE meta_value LIKE '{$filter}%%' ORDER BY d.value DESC {$pag_sql}";
}
$filtered_fids = $wpdb->get_col($sql);
@@ -255,9 +255,9 @@ function search_users_count( $filter ) {
// filter the user_ids based on the search criteria.
if ( bp_is_active( 'xprofile' ) ) {
- $sql = $wpdb->prepare( "SELECT COUNT(DISTINCT d.user_id) FROM {$bp->profile->table_name_data} d, $users_table u WHERE d.user_id = u.id AND d.value LIKE '$filter%%'" );
+ $sql = "SELECT COUNT(DISTINCT d.user_id) FROM {$bp->profile->table_name_data} d, {$users_table} u WHERE d.user_id = u.id AND d.value LIKE '{$filter}%%'";
} else {
- $sql = $wpdb->prepare( "SELECT COUNT(DISTINCT user_id) FROM $usermeta_table WHERE meta_value LIKE '$filter%%'" );
+ $sql = "SELECT COUNT(DISTINCT user_id) FROM {$usermeta_table} WHERE meta_value LIKE '{$filter}%%'";
}
$user_count = $wpdb->get_col($sql);
32 plugins/buddypress/bp-groups/bp-groups-classes.php
View
@@ -176,7 +176,7 @@ function delete() {
$user_id_str = implode( ',', (array) $user_ids );
// Modify group count usermeta for members
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_id_str} )" ) );
+ $wpdb->query( "UPDATE {$wpdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_id_str} )" );
// Now delete all group member entries
BP_Groups_Member::delete_all( $this->id );
@@ -234,8 +234,8 @@ function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = nul
$gids = implode( ',', $gids['groups'] );
- $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" ) );
- $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" ) );
+ $paged_groups = $wpdb->get_results( "SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids}) {$pag_sql}" );
+ $total_groups = $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} WHERE ( name LIKE '{$filter}%%' OR description LIKE '{$filter}%%' ) AND id IN ({$gids})" );
return array( 'groups' => $paged_groups, 'total' => $total_groups );
}
@@ -532,16 +532,16 @@ function get_by_letter( $letter, $limit = null, $page = null, $populate_extras =
}
if ( !bp_current_user_can( 'bp_moderate' ) )
- $hidden_sql = $wpdb->prepare( " AND status != 'hidden'");
+ $hidden_sql = " AND status != 'hidden'";
$letter = like_escape( $wpdb->escape( $letter ) );
if ( !empty( $limit ) && !empty( $page ) ) {
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
- $total_groups = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} {$exclude_sql}" ) );
+ $total_groups = $wpdb->get_var( "SELECT COUNT(DISTINCT g.id) FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} {$exclude_sql}" );
}
- $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} {$exclude_sql} ORDER BY g.name ASC {$pag_sql}" ) );
+ $paged_groups = $wpdb->get_results( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} {$exclude_sql} ORDER BY g.name ASC {$pag_sql}" );
if ( !empty( $populate_extras ) ) {
foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
@@ -636,7 +636,7 @@ function get_total_group_count() {
if ( !bp_current_user_can( 'bp_moderate' ) )
$hidden_sql = "WHERE status != 'hidden'";
- return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" ) );
+ return $wpdb->get_var( "SELECT COUNT(id) FROM {$bp->groups->table_name} {$hidden_sql}" );
}
function get_global_forum_topic_count( $type ) {
@@ -691,16 +691,16 @@ function get_global_topic_count( $status = 'public', $search_terms = false ) {
break;
case 'hidden' :
- $status_sql = $wpdb->prepare( "AND g.status = 'hidden'" );
+ $status_sql = "AND g.status = 'hidden'";
break;
case 'private' :
- $status_sql = $wpdb->prepare( "AND g.status = 'private'" );
+ $status_sql = "AND g.status = 'private'";
break;
case 'public' :
default :
- $status_sql = $wpdb->prepare( "AND g.status = 'public'" );
+ $status_sql = "AND g.status = 'public'";
break;
}
@@ -808,7 +808,7 @@ function save() {
$sql = $wpdb->prepare( "UPDATE {$bp->groups->table_name_members} SET inviter_id = %d, is_admin = %d, is_mod = %d, is_banned = %d, user_title = %s, date_modified = %s, is_confirmed = %d, comments = %s, invite_sent = %d WHERE id = %d", $this->inviter_id, $this->is_admin, $this->is_mod, $this->is_banned, $this->user_title, $this->date_modified, $this->is_confirmed, $this->comments, $this->invite_sent, $this->id );
} else {
// Ensure that user is not already a member of the group before inserting
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d LIMIT 1", $this->user_id, $this->group_id ) ) ) {
+ if ( $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d AND is_confirmed = 1 LIMIT 1", $this->user_id, $this->group_id ) ) ) {
return false;
}
@@ -1134,9 +1134,9 @@ function get_random_groups( $user_id, $total_groups = 5 ) {
// If the user is logged in and viewing their random groups, we can show hidden and private groups
if ( bp_is_my_profile() ) {
- return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );
+ return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 1 AND is_banned = 0 ORDER BY rand() LIMIT {$total_groups}", $user_id ) );
} else {
- return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g WHERE m.group_id = g.id AND g.status != 'hidden' AND m.user_id = %d AND m.is_confirmed = 1 AND m.is_banned = 0 ORDER BY rand() LIMIT $total_groups", $user_id ) );
+ return $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT m.group_id FROM {$bp->groups->table_name_members} m, {$bp->groups->table_name} g