Re: How to get userid regardless of context
Thanks for your help everyone!
OK, I think I have it working, however its not super desirable. I had to add 4 filters (and corresponding custom functions) in bp-custom.php and I also had to modify bp_core_get_user_displayname in bp-core.php. Adding a filter for it doesn’t do the trick because the passed in $user_id_or_username gets modified by the function the first time it is run in the core, and when using the filter $user_id_or_username actually contains the displayname, not the id or username.
so I now have the following entries in bp-custom.php:
// also had to modify bp_core_get_user_displayname in bp-core.php
add_filter('bp_get_member_name','my_bp_get_member_name');
add_filter('bp_get_group_member_link','my_bp_get_group_member_link');
add_filter('bp_get_the_topic_last_poster_name','my_bp_get_the_topic_last_poster_name');
add_filter('bp_get_the_topic_post_poster_name','my_bp_get_the_topic_post_poster_name');
It would be great if:
1. bp_core_get_user_displayname was used by all other functions that need a display name (currently I have to re-define the 4 additional functions above).
2. bp_core_get_user_displayname could be changed in the filter and not the core (as explained above).
Thoughts?