I've got Facebook style statuses working in my user profiles but if I set the quicktabs to 'ajax' = TRUE, the statuses don't appear. Here is what I've done so far ->
1. I created a node and put this php snippet in it
<?php $account = user_load(array('uid' => arg(1)));
$size = variable_get('facebook_status_size_long', 40);
$view = 'facebook_status';
echo theme('facebook_status_form_display', $account, $size, $view);
?>
This node basically prints the facebook style statuses so I use it as one of the tabs in part 2.
2. In mytheme_preprocess_user_profile() I put the following code
<?php
$tabs['first'] = array(
'title' => t('Profile'),
'type' => 'node',
'nid' => $nid,
'hide_title' => FALSE,
);
$tabs['second'] = array(
'title' => t('Status'),
'type' => 'node',
'nid' => '30', // This is the nid of the node I created above to hold the facebook statuses
'hide_title' => TRUE,
);
$quicktabs['qtid'] = '1';
$quicktabs['tabs'] = $tabs;
$quicktabs['style'] = 'Zen';
$quicktabs['ajax'] = FALSE;
$quicktabs = theme('quicktabs', $quicktabs);
$vars['user_profile'] = $quicktabs;
?>
If I set $quicktabs['ajax'] = TRUE, the FBSS don't appear. I plan on adding some more tabs so I would really like to use ajax so I can reduce the load times on user profile pages. Am I doing something wrong? Is there a way to get FBSS working with ajax enabled Quicktabs?
The problem is when
Comments
Comment #1
pasqualleI guess you have found the answer here #544466: Programatically created QT with facebook style status.
Comment #2
ltwinner commentedI also posted this in FBSS issue queue, the maintainer IceCreamYou says there's nothing FBSS can do, he describes the issue below
Yeah, when you put FBSS in an AJAX quicktab, the tab is loaded via AHAH, so your call to arg(1) which is supposed to set the User ID for the status update form returns something that is not a UID and then the form fails.
I don't know if there is a good way around this. There's nothing FBSS can do about it; any workaround would involve you being able to pass variables to the AJAX tab so that the node is aware of the User ID context. One hack would be to use a $_SESSION variable but that will fail if you visit another user page before switching to the FBSS tab. The best way would be if QuickTabs passed the information in its AJAX callback -- if it doesn't already do that, you should open an issue for it in the QuickTabs queue.
The arg(1) he mentions, which should be the uid, is actually 'ajax' and it comes from this url that is requested when you click the 'Status' tab - GET http://localhost/mytheme/quicktabs/ajax/node/30/undefined/true
Quicktabs and FBSS are two must have modules for building modern social networks, it would be great if they could work seamlessly with each other. Any ideas how to fix this issue with ajax Quicktabs and FBSS?
Comment #3
ltwinner commentedSo pasqualle is this unfixable? Would it be possible to make a special case for FBSS? So you would have something like
going to this url - http://localhost/mytheme/quicktabs/ajax/fbss/5*/undefined/false
* = uid
And then quicktabs could handle displaying the fbss itself, like it does with nodes/blocks/views in the quicktabs_render_tabpage() function, using a variation on this code
What do you think?
EDIT: The more I think of it, the more logical it seems that fbss is a special case. To render blocks, quicktabs uses bid to get the correct block, for nodes it uses nid to get the correct node, for views it uses vid to get the correct view. Facebook statuses is separate in that it requires uid to render the correct fbss.
Comment #4
ltwinner commentedWell I went ahead and tried this and fbss statuses are now loading with ajax quicktabs. There is an issue though....
This code is for programatically creating quicktabs of they new type 'fbss'.
I've added the following 3 bits of code to quicktabs.module
Then in quicktabs.js I added the following
FBSS load up now with ajax enabled quicktabs and the ajax pager at the bottom of the FBSS also works fine. The problem is when you submit a new status the whole thing disappears. The status does actually get submitted though as you can see it when you refresh the page. So the issue is the FBSS dissappearing on submission of the FBSS form. Any ideas what could be causing this and how to fix it?
Comment #5
ltwinner commentedHere are patches for making ajax enabled quicktabs work with facebook style statuses. I didn't change the quicktab admin interface so you'll have to add them programmatically to make it work.
Comment #6
ltwinner commented...forgot to change status on this issue
Comment #7
katbailey commented