Forum Replies Created
-
>Has this changed from BP 1.5.6?
Not sure, but it didn’t do that in 1.5.5
In reply to: Buddypress actions and group activity streamAddressing just the do_action part of your question.
add_action is used to call a particular function
do_action is used to provide a hook to and specify when/where that function is calledFor example, in groups/single/activity.php, you should see this:
``
So, in your theme functions.php, you could do this
`
add_action( ‘bp_before_group_activity_content’, ‘my_function’);
function my_function() {
echo “my_function was called“;
}
`You should see “my_function was called” after the form and before the activity listings on all group activity pages – because that is where the do_action is located.
You need to read up on do_action / add_action and apply_filters / add_filter.
These concepts are essential to creating any WP codeIn reply to: problem in display order – bp_has_memberProbably won’t work, but try these and let us know:
`
if (bp_has_members (‘include =’. $ id . ‘&per_page = 30&type=NULL’)):
``
if (bp_has_members (‘include =’. $ id . ‘&per_page = 30&type=dummy’)):
`In reply to: problem in display order – bp_has_memberThe returned users are always sorted by the ‘type’.
I’ve never tried setting ‘type’ to null …?It would be great to have a ‘type = unsorted’ (enhancement ?)
I’ve had tasks where that would be very handy.>I think you would have to re-order the results of the query after it is made.
That’s tough to do – and still use the members-loop and pagination.In reply to: problem in display order – bp_has_memberAfaik, bp_has_members will default to sorting the returned array by ‘last_active’, thereby wiping out the order of your $id string.
Using populate_extras might stop that:
`
if (bp_has_members (‘include =’. $ id. ‘& per_page = 30& populate_extras=false’)):
`Have you looked at this?
https://buddypress.trac.wordpress.org/ticket/4060>2. Right now we only have the following tables set to use MyISAM, the rest being InnoDB:
Yup, it’s a compromise – but for us the benefit of row-locking in InnoDB outweighed the fulltext issue.
We don’t generally allow text searches.And thanks for sharing your setup info.
Now that BP is being used for sites with larger and more active memberships, more devs are having these problems.
I think collecting info re tuning, caching, etc. approaches on a page somewhere in buddypress.org would be very useful and would generate some helpful ( and confusing ) discussion by us non-DBAs.In reply to: function to send a private messageThe function is messages_new_message()
> when an image is denied an email is sent out to the user
So you have a function or some code that does that, yes?
Then you could use parts of the below in that code or call it as a function`
function bp_send_image_denied_message() {
global $bp;//check_admin_referer(message_check”); // adjust if needed
$sender_id = $bp->loggedin_user->id; // moderator id ?
$recip_id = $bp->displayed_user->id; // denied image user id ?if ( $thread_id = messages_new_message( array(‘sender_id’ => $sender_id, ‘subject’ => ‘Image Denied, ‘content’ => ‘why it was denied], ‘recipients’ => $recip_id ) ) ) {
bp_core_add_message( __( ‘Image Denied Message was sent.’, ‘buddypress’ ) );
bp_core_redirect( $bp->displayed_user->domain ); // adjust as needed
} else {
bp_core_add_message( __( ‘There was an error sending that Private Message.’, ‘buddypress’ ), ‘error’ );
}}
add_action( ‘wp’, ‘bp_send_image_denied_message’, 3 );
`Myself and others have also had the issues you describe.
I believe BP 1.6 will reduce those issues.
Meanwhile, we’ve done these things to mitigate the issue, maybe you’ve already done some of them:
1. Use a caching plugin like W3 Total Cache – don’t use the page cache
2. Switch from MyISAM to InnoDB
3. Use tmpsf on your db server – this really helpsWe thought about going to a master/slave db setup – but doing the above allowed us to handle peak traffic for a site with 30k users. Prior to that, our slowlog looked like the one attached to your ticket.
I don’t see the members loop in your code.
I see this:
`$retval = ““; `
where you open 2 divs and don’t close them as part of an if statement that you don’t terminate.try this:
`
if (bp_has_members($get_these_members))
$retval = ‘Yes – members were found.
‘;
else
$retval = ‘Sorry, no members were found.
‘;
echo $retval;
`
If that works, then look at
https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/>Could I use an if statement to load the members loop at the end of post content on these pages?
Probably.
You have a better chance of getting help if you use pastie or gist.github to show your code.
In reply to: Activity stream to longTake a look at
https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/Find your activity-loop.php, probably somewhere like:
/wp-content/themes/your-theme-child/activity/activity-loop.phpthen try this:
``
You don’t need the entire loop – just the parts you want.
Using the members loop will be easier than building your own.“not working” is too general a comment.
What parts are working?
You need to methodically narrow down to the problem areas.
echo out your $vars to see if it’s what you expect.
For example:`
$filtered_users=buat_gather_user_ids($type);
echo “
filtered_users: ” . $filtered_users . “
“;$the_members_you_want = “include=” . $filtered_users . “&max=” . $dm_number . “&type=random”;
echo “
members-you-want: ” . $the_members_you_want . “
“;`
And how does $dm_number get from buat_shortcode_grabber() to buat_get_user_template()?
You probably want to generate it in buat_get_user_template() instead of buat_shortcode_grabber()
etc.
What does this mean “matches the page” ?
You need to know the field_id (numeric) of the profile field(s) you want to match.
Take a look at this:
https://buddypress.org/community/groups/creating-extending/forum/topic/search-member-profile-fields-by-url/Your syntax is wrong. Variables can’t be in quotes. You have to build your parameter string.
Sometimes it’s less confusing to build it ‘outside’`
$the_members_you_want = “include=” . $filtered_users . “&max=” . $dm_number . “&type=random”;
if ( bp_has_members( $the_members_you_want ) )
`In reply to: check if field has new value in buddypress xprofileUntested, but try this:
`
add_action (‘xprofile_updated_profile’, ‘profile_change_notify’);
function profile_change_notify ($id, $posted_field_ids, $errors) {
$global $wpdb;if( $errors )
return;$names = ”;
foreach( (array)$posted_field_ids as $field_id ) {
$sql = ” SELECT name FROM wp_bp_xprofile_fields WHERE id = ‘$field_id’ “;
$name = $wpdb->get_var( $sql );
if( $name == ‘Country’ || $name == ‘City’ )
$names .= ‘ ‘ . $name;}
if( $names != ” ) {
$user = new WP_User ($id);
wp_mail (‘myname@mydomain.com’, ‘Subject ( ‘ . $user->user_login . ‘ just updated the Profile )’, $names);
}
}
`In reply to: Server requirements for 100K active usersYou’ll probably be better off talking to hosting providers that have managed cloud servers.
Managed – meaning the package includes server admin service.
If they have managed cloud servers then they’ll have managed dedicated servers.
Be clear about the difference between 100k users and 100k blogs.For 100k users, you’ll need several servers. It will be expensive.
In reply to: Users can’t upload their avatar when on MacUploads aren’t supported in browsers on those devices, afaik.
To get around that for avatars and galleries for apple users, we used the free version of this
http://www.aurigma.com/mobile/Use of aurigma and similar apps has been discussed before on these forums – not sure how you can find them though.
The BuddyBoss theme has a ‘wall’ similar to facebook
If you’re trying to load members-overview.php as a separate page, take a look at this plugin:
https://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/If not, then use the bp-custom approach I mentioned above – you’ll need to learn it anyway.
Basically, you need to ask better questions, ie. what, where – exactly, why etc.
Use http://pastie.org/ and show your code.No problem.
Don’t forget that you’re trying to learn two code bases – WP and BP – so you’ll have to look web-wide.do_action is a WP thing. Tons of info on it. Google it.
Given all the things you’re trying to do ( based on your posts to these forums ) you’ll be a lot more effective if you start learning about the environment you’re coding in.Are you sure members-overview.php is loading ?
Do a simple echo in that file to check.also try : locate_template( array( ‘members/single/members-overview.php’), true );
So overview.php creates some html that you want to reuse in various template pages ?
You probably better off just creating a function in bp-custom.php.
Then call that function wherever you like.