Only load component action and screen code when we're on the component's page
|Reported by:||r-a-y||Owned by:|
We should only load a component's action and screen code when we're on the component's page.
This can save us some memory.
Attached patch does this for the activity component. I've introduced a new method called late_includes() that runs on the 'bp_setup_canonical_stack' hook because that is the place where we've ensured that $bp->current_component and $bp->current_action is fully set up.
In the patch, I've moved some code that is not specific to the activity component's action or screen code to bp-activity-functions.php temporarily until I can figure out a better place to put them. Perhaps, create a new file called bp-activity-hooks.php?