og_menu_access_unsubscribe is called from menu_get_item from the manage membership views field handler, meaning it could be called many, many times per page load (was being called 50 due to having 40 user membership view).

Even if that handler changed to not do the ugly fugly menu_get_item, it'd likely need to call this function, so not requiring a fully loaded user object (when none of the logic actually needs that) would be swell.

Comments

Grayside’s picture

Status: Needs review » Needs work

Looks pretty solid.

Minor point:

+++ b/og.module
@@ -298,34 +298,32 @@ function og_activity_info() {
+  // Make sure user is valid. user_load is not cached, so don't bother ¶

Don't bother what? Don't bother with user_load()? Also, whitespace instead of period.

hefox’s picture

Re-roll that tries optimizing it further; no check if current user and adds a bypass check if calling it when know user exists (e.g. for [#7054328])

hefox’s picture

Status: Needs work » Needs review
StatusFileSize
new2.95 KB
claudiu.cristea’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

This version of Drupal is not supported anymore. If this is still an issue in the 8.x-1.x branch, please open a new up-to-date ticket. Closing.