Forum Replies Created
-
@r-a-y Thanks! You are right, I’m not using an object cache. That function isn’t in the WordPress codex, so I missed it. It looks very much like what I wanted, except that I’m a bit worried, because if I follow the Buddypress logic correctly, Buddypress gets the data, puts it into the cache, and then reads it from the cache to give it to the caller. Hope I misread that or something. Anyway I’ll give it a try when I get a chance and let you know. Otherwise I have a workaround, just pull the old version of the function into the plugin I’m using and use that. Just a workaround though.
John,
Thanks. I’m sure caching that data speeds things up in normal use, however I do regularly need to export all the extended profile fields, and it doesn’t make sense to try and cache that.
What exactly do you need to know? I’ve got 13302 users, with roughly 115 extended profile fields (many of which tend to be blank for a given user). My little test script is below, although what I actually use is the “Export User Data” plugin.
<?php /* Template Name: test template */ ?> <h2>TEST of BP_XProfile_ProfileData::get_all_for_user</h2> <?php global $bp; $start_time=microtime(true); $memory_use = memory_get_usage(true) / 1024 / 1024; echo "<br/>Start Memory Use = $memory_use MB"; for ($userid = 1; $userid <= 5000; $userid++) { BP_XProfile_ProfileData::get_all_for_user($userid); } $times_run = $userid -1; $finish_time = microtime(true); $elapsed_time = $finish_time - $start_time; $avg_time = $elapsed_time / $times_run; echo "<br/>Ran get_all_for_user for $times_run users"; echo "<br/>Elapsed time = $elapsed_time seconds"; echo "<br/>Avg time = $avg_time seconds"; $memory_use = memory_get_usage(true) / 1024 / 1024; echo "<br/>End Memory Use = $memory_use MB"; echo "</p>"; ?>
I sat down and tried it and if I do modify bp-settings-actions.php then I can get it to enforce strong passwords just fine. Of course that will break every time Buddypress comes out with a new version, so it’s not really a solution. Sigh.
Fabius219, I never could quite figure this out. I got as far as figuring out how to modify my theme’s function.php file to add a filter to bp_core_general_settings_before_submit to add the password strength bar to the buddypress settings page, but I couldn’t figure out how to get the “Force Strong Passwords” plugin to enforce that the password must be a certain strength. For the regular WordPress Profile page, that plugin hooks into ‘user_profile_update_errors’, but I don’t see an equivalent hook in buddypress/bp-settings/bp-settings-actions.php, which I think is the right place to look. Googling around I don’t see that anyone else has done it either, which is too bad.
Instead of the template change suggested above, it works better to add the following
/* set default BP to profile page instead of activity page */ define( 'BP_DEFAULT_COMPONENT', 'profile' );
in your wp-content/plugins/bp-custom.php file (create that file if it does not exist – see https://codex.buddypress.org/plugindev/bp-custom-php/ for more about that file).
It may be that you need to set:
/* set default BP to profile page instead of activity page */ define( 'BP_DEFAULT_COMPONENT', 'profile' );
in your wp-content/plugins/bp-custom.php file (create that file if it does not exist – see https://codex.buddypress.org/plugindev/bp-custom-php/ for more about that file).
Yes, however since that is a WordPress page, the existing WordPress plugins for enforcing strong passwords should handle that case. I have checked the “enforce strong passwords” plugin and it does enforce strong passwords for the password reset page. It just doesn’t know about the Buddypress “General Settings” page.
So what I’d like to know is if there are any strong password plugins, or other solutions, that work well with Buddypress.
I looked into this further, and looks like the “last_updated” field for just the profile fields in the same group gets updated. The “last_updated” field for profile fields in other groups doesn’t get touched. So I should be able to do what I need as long as I create a separate group for each type of information I want to track the update time on separately.