I upgraded Drupal for Facebook to 6.x.2-beta7 yesterday. Now, for users logged into my site Drupal for Facebook is the title of almost every page. I cannot figure out where this is coming from. But it goes away if I uninstall the fb module.

Comments

Dave Cohen’s picture

Did you run the update.php script?

Dave Cohen’s picture

haha! I just saw this too! Very stange. I'm sure its a bug in Drupal's menu module, but I'll try to work around it. Thanks for reporting it.

Will post back when I have a fix.

Dave Cohen’s picture

Assigned: Unassigned » Dave Cohen

This was a misunderstanding on my part about when menu title callbacks are called and how they work.

For now, simplest change is to comment out any line in fb.module, fb_menu function that starts with 'title callback' or 'title arguments'.

I'll work on a fix.

Dave Cohen’s picture

Status: Active » Needs review

Working remotely, so difficult to attach a proper patch here, easier to paste it....

apply this patch and flush all caches to fix the problem.

Index: fb.module                                                                                                  
===================================================================
--- fb.module   (revision 2340)                                                                                   
+++ fb.module   (working copy)                                                                                    
@@ -404,7 +404,15 @@
  * Helper tells other modules when to load admin hooks.                                                          
  */                                                                                                              
 function fb_is_fb_admin_page() {                                                                                 
-  return (arg(0) == 'admin' && (arg(1) == 'fb' || arg(2) == 'fb'));                                              
+  if (arg(0) == 'admin' && (arg(1) == 'fb' || arg(2) == 'fb')) {                                                 
+    // Keep consistant titles across tabs served by multiple modules.                                            
+    if ($label = arg(FB_PATH_ADMIN_APPS_ARGS))                                                                   
+      drupal_set_title($label);                                                                                  
+    else                                                                                                         
+      drupal_set_title(t('Drupal for Facebook'));                                                                
+                                                                                                                 
+    return TRUE;                                                                                                 
+  }                                                                                                              
 }                                                                                                                
                                                                                                                  
 /**                                                                                                              
@@ -677,7 +685,6 @@
   // Admin pages overview.                                                                                       
   $items[FB_PATH_ADMIN] = array(                                                                                 
     'title' => 'Facebook Applications',                                                                          
-    'title callback' => '_fb_menu_title_helper',                                                                 
     'description' => 'Facebook Applications',                                                                    
     'page callback' => 'fb_admin_page',                                                                          
     'access arguments' => array(FB_PERM_ADMINISTER),                                                             
@@ -690,11 +697,8 @@
     'type' => MENU_DEFAULT_LOCAL_TASK,                                                                           
   );                                                                                                             
                                                                                                                  
-  // Admin pages for each app.  For some reason, drupal does not                                                 
-  // consider this an ancestor of FB_PATH_ADMIN.  Breadcrumbs fail.                                              
+  // Admin pages for each app.                                                                                   
   $items[FB_PATH_ADMIN_APPS . '/%fb'] = array(                                                                   
-    'title callback' => 'fb_admin_page_title',                                                                   
-    'title arguments' => array(FB_PATH_ADMIN_APPS_ARGS),                                                         
     'title' => 'Application Detail',                                                                             
     'description' => 'Facebook Applications',                                                                    
     'page callback' => 'fb_admin_app_page',                                                                      
@@ -722,11 +726,6 @@
   return $items;                                                                                                 
 }                                                                                                                
                                                                                                                  
-function _fb_menu_title_helper($title) {                                                                         
-  drupal_set_title(t('Drupal for Facebook')); // Title of page.                                                  
-  return t($title); // Title in menu.                                                                            
-}                                                                                                                
-                                                                                                                 
 /**                                                                                                              
  * Implementation of a %wildcard_load(). http://drupal.org/node/224170                                           
  */                                                                                                              








Durrok’s picture

After applying your patch manually:

Fatal error: Call to undefined function _fb_menu_title_helper() in public_html/includes/menu.inc on line 504

EDIT:

Fixed it. Leave in:

function _fb_menu_title_helper($title) {
  drupal_set_title(t('Drupal for Facebook')); // Title of page.
  return t($title); // Title in menu.
}

and then clear you cache. Titles go back to normal.

Dave Cohen’s picture

Oh weird. It's like the fatal error even prevents the cache from clearing. I think running update.php will also work.

Dave Cohen’s picture

Status: Needs review » Fixed
rsbecker’s picture

I applied the patch. It got a little scary when I went to the site to run update.php and had to log in as admin to do it. But after update.php ran and I got the message below:

user warning: Table './spjdco5_drpl/drpl_cache_page' is marked as crashed and should be repaired query: DELETE FROM drpl_cache_page WHERE expire != 0 AND expire < 1269606335 in /home/spjdco5/public_html/drupal/includes/cache.inc on line 166.

I cleared the cache and all appears to be well again.

Thanks for the prompt response.

Durrok’s picture

Thanks for the quick responses Dave. Great module. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.