Re: custom plugin : hook bp_setup_globals is not fired
On top of everyone’s ideas, be sure to check out how to correctly attach your plugin to bp_init:
https://codex.buddypress.org/how-to-guides/make-your-plugin-buddypress-aware-v1-2/
Because of the way that WordPress loads plugins, its possible that bp_init is firing before your plugin has added the hook. If that’s the case, your function is safe to run and needs to be called directly as a fall-back.