Should fb_post_init be invoked on every page or just on the entity edit pages where it is enabled?
In my logs I see the following:
Jun 19 11:24:36 dev https://www.mysite.com/admin/structure/types/manage/webform/panelizer/pa...|https://www.mysite.com/admin/config/content/panelizer/node/webform.page_...|1||hook_fb(fb_post_init) invoked with data: Array#012(#012 [fb_app] => Array#012 (#012 [client_id] => xxx#012 [name] => Online Open Studios DF#012 [namespace] => mytest#012 [fba] => ddd )#012#012)#012, and passed Array#012(#012)
This is also causing a slow down on my site.
line 95 in fb.post
// Let third parties know that fb.module is initialized.
fb_invoke(FB_OP_POST_INIT, array('fb_app' => $fb_app));
is this necessary on every page? I don't know enough about fb_post. Is fb_post_init referring to the fb_post.module or a function which is part of Facebook sdk?
Comments
Comment #1
socialnicheguru commentedComment #2
socialnicheguru commentedchanged title.
Comment #3
socialnicheguru commentedComment #4
Dave Cohen commentedIt has nothing to do with fb_post. It predates that module.
It's supposed to be just like drupal's hook_init(), except that if you invoke hook_init() it's hard to be sure your module's hook is called after fb_init(). So instead implement hook_fb and this op is called only after the fb api is ready to be used.
Even drupal's hook_init can be a performance problem, depending on how its implemented. I wonder if the performance problem is simply the existance of this hook, or what your module is doing when it is invoked. One way to improve performance might be to move this out of hook_fb() into it's own hook, say hook_fb_init(). hook_fb() is kind like an old-school drupal hook like hook_nodeapi(), it covers a bunch of operations.