Forum Replies Created
-
In reply to: display only one group activity stream on homepage.
Please use the
codebutton when posting code.The codex has the information you need.
Try:
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&object=groups&primary_id=31' ) ) : ?>Whats happens with this?
if ( bp_has_members( 'include=4112,1543,119' ) ) :Maybe $matches is an array of strings?
Try:
$matches[] = (int) $ticket["member"];In reply to: How to link custom posts type (CPT) with BP groupsI would like to link those SPT with some buddypress groups.
What do you mean by link?
Using
bp_has_members()in a foreach loop is a bad idea.Try something like this:
$friend_ids = friends_get_friend_user_ids( bp_loggedin_user_id() ); $matches = array(); foreach($tickets as $ticket) { if( in_array( $ticket["member"], $friend_ids ) ) $matches[] = $ticket["member"]; } if ( bp_has_members( 'include=' . $matches ) ) : //etcThis is a bit nicer:
$content = wp_trim_words( $content, 15 );https://codex.wordpress.org/Function_Reference/wp_trim_words
In reply to: Settings -> Profile Visibility does not displayThere is not a profile.php file in …BuddyPress/Members/Single/Settings as I expected.
Look here:
bp-templates\bp-legacy\buddypress\members\single\settings\profile.phpIn reply to: Commons in a Box CompatibilityI have a client using CBOX with latest BP & WP.
Works fine.Best place to ask questions:
https://wordpress.org/support/plugin/commons-in-a-box
or
http://commonsinabox.org/groups/help-support/@hnla – maybe a sticky ?
Or you could keep creating replies…In reply to: Groups loop in user profileI’ve updated the groups loop codex page to include that usage.
In reply to: Groups loop in user profileTry
bp_has_groups( 'user_id=NULL' )and ‘only admins’ to be able to edit the page.
Do you mean site admins?
If so, why enable group creation on the front end?If you need front end creation, you’ll need to manipulate the create steps.
Use these hooks infunction groups_action_create_group()in \bp-groups\bp-groups-actions.phpdo_action( 'groups_create_group_step_save_' . bp_get_groups_current_create_step() ); do_action( 'groups_create_group_step_complete' );Or completely by-pass the BP create groups code with your own – not recommended.
In reply to: new BuddyPress plugin: BP Local AvatarsNow in the WP plugin repo:
https://wordpress.org/plugins/bp-local-avatars/And still available here: PhiloPress
In reply to: Get group user ids from while loopbp_group_member_id()will echo the id.
You wantbp_get_group_member_id().In reply to: Only 25 Members per Group? How to Increase this?There is no limit on members per group.
If you have a limit, then it is something particular to your installation.To manage any group, including add/remove users, go to DashBoard > Groups and roll-over a group name and click ‘Edit’.
In reply to: activation urlAs you can tell by looking at the ticket in that thread, it was solved and closed 3 years ago.
If you are having an issue, please be specific and follow these guidelines:
How to Ask for SupportIn reply to: How to add date?afaik, that data is not shown by default.
It is something your theme is adding.
You should ask the theme author how to change the display.In reply to: Adding new ‘Order By’ on members loopThe
per_pagesql is actually in$object->uid_clauses['limit']as you can see by studying the BP_User_Query class.To get pagination to work, you need to filter on
bp_ajax_querystringThere is probably an easier way to do this, but this works for me: gist
Note that
per_pageis hardcoded to 2, in two places.In reply to: How to remove sub nav only for displayed userWhat plugin are you using to enable ‘followers’ ?
What version of BP are you using?You could try this:
function addy_remove_profile_nav($nav_array) { if( is_super_admin() ) return $nav_array; if ( ! bp_is_my_profile() ) $nav_array = ''; return $nav_array; } add_filter('bp_get_displayed_user_nav_followers', 'addy_remove_profile_nav', 10, 1 );In reply to: Adding new ‘Order By’ on members loopThis works for me. It’s basically just a cleaner version of what eberger3 did.
You’ll have to hack the ‘where’ clauses if you want to include search terms.function add_sortby_price() { ?> <option value="price">Price</option> <?php } add_action( 'bp_members_directory_order_options', 'add_sortby_price' ); function users_sortby_price( $object ) { global $wpdb, $bp; // Only run this if price option is selected if ( ! in_array( $object->query_vars['type'], array( 'price' ) ) ) return; $field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", $object->query_vars['type'] ) ); $object->uid_name = 'user_id'; $object->uid_table = $bp->profile->table_name_data; $object->uid_clauses['select'] = "SELECT u.{$object->uid_name} as id FROM {$object->uid_table} u"; $object->uid_clauses['where'] = " WHERE " . $wpdb->prepare( "u.field_id = %d", $field_id ); $object->uid_clauses['orderby'] = "ORDER BY u.value"; $object->uid_clauses['order'] = "ASC"; } add_action( 'bp_pre_user_query', 'users_sortby_price' );In reply to: Adding new ‘Order By’ on members loopNote that right before the return, I switch to
$ch_querystring['type'] = 'alphabetical';
There is no['type'] = 'price';in the class.Not sure about this, but instead of
$ch_querystring['include'] = $users_str;
Try
$ch_querystring['user_ids'] = $users_str;In reply to: Users newer than 8 months not in directoryDid you try using the tools?
In wp-admin, Tools > BuddyPressDid you look thru the files for BuddyPress Profile Search ?
Did you notice this action in bp-profile-search\bps-search.php ? And what it does?
add_action ('bp_after_members_loop', 'bps_remove_filter');Might be a clue.
In reply to: Adding new ‘Order By’ on members loopYou don’t need to touch any core files to add an Order By.
Example for adding a Contributor option, put in bp-custom.php or theme/functions.php
// add order options to members loop function ch_member_order_options() { ?> <option value="contributing"><?php _e( 'Contributing Members', 'buddypress' ); ?></option> <?php } add_action( 'bp_members_directory_order_options', 'ch_member_order_options' ); // filter ajax members by contributing function ch_filter_ajax_querystring( $querystring = '', $object = '' ) { if( $object != 'members' ) return $querystring; $defaults = array( 'type' => 'active', 'action' => 'active', 'scope' => 'all', 'page' => 1, 'user_id' => 0, 'search_terms' => '', 'exclude' => false, ); $ch_querystring = wp_parse_args( $querystring, $defaults ); if( $ch_querystring['type'] == 'contributing' ) { // to get members by xprofile field, you need some custom sql here // here's an example: //https://codex.buddypress.org/developer/loops-reference/the-members-loop/#code-examples $users = get_users( array( 'fields' => array( 'ID' ), 'role' => 'contributor' ) ); $users_str = ''; foreach ( $users as $user ) { $users_str .= $user->ID . ','; } $users_str = rtrim($users_str, ","); $ch_querystring['include'] = $users_str; $ch_querystring['type'] = 'alphabetical'; return $ch_querystring; } else return $querystring; } add_filter( 'bp_ajax_querystring', 'ch_filter_ajax_querystring', 20, 2 );In reply to: Get recipients id while composing messageUse this hook:
do_action_ref_array( 'messages_message_before_save', array( &$this ) );
Infunction send()in this file:
buddypress\bp-messages\bp-messages-classes.php