When creating a node such as a blog, forum, story, etc, the facebook status will display your saved tagline. However, upon "SAVE", the status will say, "does not have a status yet" when the node is created. The resulting message is below:
* warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given in /hermes/web02/b2962/jovestec/seaandsnow/main/includes/database.mysqli.inc on line 178.
* user warning: Column 'uid' in field list is ambiguous query: SELECT uid, name FROM users LEFT JOIN node ON node.uid = users.uid WHERE node.nid = 591 in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 147.
* user warning: Column 'uid' in field list is ambiguous query: SELECT uid, name FROM users LEFT JOIN node ON node.uid = users.uid WHERE node.nid = 591 in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 72.
Lines 71-75
else if (arg(0) == 'node' && is_numeric(arg(1))) {
$fbs_user = db_result(db_query("SELECT uid, name FROM {users} LEFT JOIN node ON node.uid = users.uid WHERE node.nid = %d", arg(1)));
$fbs_name = htmlspecialchars($fbs_user['name'], ENT_NOQUOTES);
$sm = db_fetch_array(db_query_range("SELECT status_fb, status_time FROM {facebook_status} WHERE uid = %d ORDER BY status_time DESC", $fbs_user['uid'], 0, 1));
}
Lines 146-149
else if (arg(0) == 'node' && is_numeric(arg(1))) {
$fbs_user = db_result(db_query("SELECT uid, name FROM {users} LEFT JOIN node ON node.uid = users.uid WHERE node.nid = %d", arg(1)));
$xname = htmlspecialchars($fbs_user['name'], ENT_NOQUOTES);
}
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | QA_fb_status_20080814a_node_error_gone.JPG | 98.91 KB | jjoves |
| #7 | QA_fb_status_20080814b_click_on_java.JPG | 129.54 KB | jjoves |
| #7 | QA_fb_status_20080814c_post_save.JPG | 126.86 KB | jjoves |
| #7 | QA_fb_status_20080814d_other_node_not_update.JPG | 114.01 KB | jjoves |
| #5 | QA_fb_status_20080814.JPG | 119.66 KB | jjoves |
Comments
Comment #1
jjoves commentedFYI. The errors do come up while editing or viewing the nodes as well.
My Base:
Drupal 6.3
Access to update.php Protected
Configuration file Protected
Database updates Up to date
Drupal core update status Up to date
File system Writable (public download method)
GD library bundled (2.0.34 compatible)
Image module directories Exists (sites/default/files/images)
Image toolkit The gd toolkit is installed
Module and theme update status Up to date
MySQL database 5.0.45
PHP 5.2.2
PHP memory limit 10000M
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Update notifications Enabled
Web server Apache
Comment #2
icecreamyou commentedChange lines 72 and 147 to
...sorry about that, as you've discovered the 6.x version is not perfectly stable. I'm working on a major update for the 5.x branch and when that's done I'll port all the fixes and features to 6.x. The 5.x version should be done by tomorrow and the 6.x port by Sunday, hopefully.
Comment #3
jjoves commentedThanks IceCreamYou,
That took care of those lines, however, the end result is: (see attached)
1. The Status says, "1 is ..." instead of administrator. This seems to happen during the creation and view/editing of a node. This does not occur on /tid/ or / addresses...just on /node/. E.g. At the home page the status is fine. (www.seaandsnow.org)
2. The update is not reflected in the statuses block when at a /node/
3. It's calling a error to: warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given in /hermes/web02/b2962/jovestec/seaandsnow/main/includes/database.mysqli.inc on line 178.
lines 177-182
function db_result($result) {
if ($result && mysqli_num_rows($result) > 0) {
// The mysqli_fetch_row function has an optional second parameter $row
// but that can't be used for compatibility with Oracle, DB2, etc.
$array = mysqli_fetch_row($result);
return $array[0];
Thanks and Regards, James
Let me know if you want me to test something.
Comment #4
icecreamyou commentedTry changing those two lines (72 and 147) again, to this:
...db_result needed to be db_fetch_array, and n.nid=u.uid should have been in the WHERE clause.
Hopefully this fixes your problems--let me know if it doesn't. You've been helpful in figuring out the issues.
Comment #5
jjoves commentedIceCreamYou,
Thanks, that took care of #1. It leaves 2 and 3 still outstanding:
1. The Status says, "1 is ..." instead of administrator. This seems to happen during the creation and view/editing of a node. This does not occur on /tid/ or / addresses...just on /node/. E.g. At the home page the status is fine. (www.seaandsnow.org)2. The update is not reflected in the statuses block when at a /node/ (the status box will just say my default line of "is..." lines 95, 96 below)
//With Facebook Mode off, a suggestion might be " has not yet posted thoughts" or similar.
$block_content .= t(" is...");
When you click on the "is..." it opens up the form box which states the already saved status (see attached)
3. It's calling a error to: warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given in /hermes/web02/b2962/jovestec/seaandsnow/main/includes/database.mysqli.inc on line 178.
facebook_status_module
I'm taking a look at lines 130-~250ish, to find relations to the mysql
lines 177-182
function db_result($result) {
if ($result && mysqli_num_rows($result) > 0) {
// The mysqli_fetch_row function has an optional second parameter $row
// but that can't be used for compatibility with Oracle, DB2, etc.
$array = mysqli_fetch_row($result);
return $array[0];
seems like it's functioning like it's "off" or as a "guest" since content is primarily a node function. hmm. will let you know if i can see a code change or something. If you find a relation as well, let me know.
Thanks and Regards,
James
Comment #6
icecreamyou commentedWait a minute. Are you allowing anonymous users to submit statuses? Bad idea. Very bad idea.
All the same, try changing line 59 to:
I *think* that should fix it but I haven't tested anything.
Anyway, a lot of things will be fixed when I port the changes from the 5.x branch within the next few days.
Comment #7
jjoves commentedIceCreamYou,
Oh no, no. Guest are not allowed to changed statuses, only authenticated and moderators.
Here's the scoop and hopefully this could shed more light for you on the 5.x port to 6.x
1. No errors show up in the nodes. (Great) (See attachment A)
But.
2. Clicking on the java works, shows text field (See attachment B)
3. Saving new status on any page results in an error. The save proceeds but does not reflect in the recent status updates.(See attachment C)
4 Going to a new page does not reflect changes in either the current status nor recent status updates (See attachment D)
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 6' at line 1 query: DELETE FROM facebook_status WHERE uid = 1 ORDER BY status_time ASC LIMIT 0, 6 in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 232.
line 227-233 from facebook_status.module is:
if ( db_query("INSERT INTO {facebook_status} (status_fb, status_time, uid) VALUES('%s', %d, %d)", $form_state['values']['name'], time(), $uid) ) {
//Only save last $num_status updates; delete excess updates if there are too many. Zero is the equivalent of infinite.
if ( variable_get('facebook_status_number', 10) ) {
$count = db_result(db_query("SELECT COUNT(sid) FROM {facebook_status} WHERE uid = %d", $uid)) - variable_get('facebook_status_number', 10);
if ( $count > 0 ) {
db_query_range("DELETE FROM {facebook_status} WHERE uid = %d ORDER BY status_time ASC", $uid, 0, $count);
}
I hope this helps! Let me know if you want me to look into something/test.
Regards,
James
Update
To note, on nodes, the status is reflective of a "blank" user. See attachment B/C. Updating your status (user name is shown) happens on any other type of page.
Comment #8
icecreamyou commentedI am about to commit the updated 6.x version to CVS. I think it fixes the issues you're seeing. Let's see what happens with that.
There are still going to be some things that are broken--namely, integration with other modules--but overall it should work pretty well.
Comment #9
icecreamyou commentedMarking as fixed even though I haven't tested whether it's fixed or not because I've now committed changes to CVS that will probably fix it. Please re-open if you continue having this problem and I'll put a lot more attention into it; and feel free to submit any more bugs you find. :D
Comment #10
jjoves commentedExcellent. I'll check it out once it's through. When's the expected timeframe for the 6.x version?
Comment #11
icecreamyou commentedThe 5.x and 6.x version are now functionally equivalent; I updated the 6.x code much faster than I expected. The new tarballs have already been generated, so you can download the module at any time now to get the fixes and features associated with the new release.
Comment #12
jjoves commentedIceCreamYou,
Okay, uninstalled the previous version to the latest upgrade:
Intial errors are reported below post installation:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 122.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 542.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 171.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 215.
After adding a status results in:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 120.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 152.
warning: in_array() [function.in-array]: Wrong datatype for second argument in /hermes/web02/b2962/jovestec/seaandsnow/main/modules/facebook_status/facebook_status.module on line 557.
Status says "administrator" on all NON node pages
Status says "1" is ... on NODE Pages
These refer to 115 -127 for line 122 and 120
$block_content = '
//This gigantic 'if' statement decides whether we can show the update form or not. And if we don't show the form, we don't need the AJAX.
if ( (((arg(0) == 'user' && is_numeric(arg(1)) && arg(1) == $user->uid)
|| (arg(0) == 'node' && is_numeric(arg(1)) && db_result(db_query("SELECT uid FROM {node} WHERE nid = %d", arg(1))) == $user->uid))
&& user_access('edit own facebook_status')
&& !in_array(variable_get('facebook_status_clear_user', array(0)), $user->uid))
|| (user_access('edit all facebook_status')
&& !in_array(variable_get('facebook_status_clear_user', array(0)), $fbs_uid)) ) {
$block_content .= '
';
$x = TRUE;
$path = drupal_get_path('module', 'facebook_status');
if (variable_get('facebook_status_ajax', 1)) {
drupal_add_js($path .'/facebook_status.js');
These refer to 542-550 for line 542
if ( $fbs_uid > 0 && !in_array(variable_get('facebook_status_clear_user', array(0)), $fbs_uid) ) {
$result = array();
$i = 0;
while ($row = db_fetch_array($query)) {
$result[$i] = $row;
//Adding the name to the array is a convenience, but don't forget to add a space between it and the status.
$result[$i]['fbs_name'] = db_result(db_query("SELECT name FROM {users} WHERE uid = %d", $fbs_uid));
$result[$i]['fbs_uid'] = $fbs_uid;
$i++;
These refer to 170-174 for line 171
//If the user is not allowed to have a status.
else if (in_array(variable_get('facebook_status_clear_user', array(0)), $fbs_uid)) {
//If the status form is not the user's own, use different strings than if it is the user's own.
if ( $fbs_uid != $user->uid ) {
$block_content .= t('@username is not allowed to have a status.', array('@username' => $fbs_name));
These refer to 215-220 for line 215
if (!in_array(variable_get('facebook_status_clear_user', array(0)), $fbs_uid)) {
$c_array = facebook_status_get_status($x, variable_get('facebook_status_max_num_block_stats_all', 5));
$block_content = "
";
foreach ($c_array as $row) {
if (time() - $row['status_time'] < 60) {
$time = t("a moment");
These refer to 552-563 for line 557
}
else if ( $fbs_uid < 0 ) {
$result = array();
$i = 0;
while ($row = db_fetch_array($query_2)) {
if (!in_array(variable_get('facebook_status_clear_user', array(0)), $row['fbs_uid'])) {
if (drupal_strlen($row['status_fb']) > variable_get('facebook_status_max_block_len_all', variable_get('facebook_status_length', 192))) {
$row['status_fb'] = drupal_substr($row['status_fb'], 0, variable_get('facebook_status_max_block_len_all', variable_get('facebook_status_length', 192)));
//There are a couple of ways this method could be improved, but in a lot of fonts '...' is shorter than … and since the purpose of this is to shorten the string it's an arbitrary choice.
if ( drupal_strlen($row['status_fb']) == variable_get('facebook_status_max_block_len_all', variable_get('facebook_status_length', 192)) ) {
$row['status_fb'] .= "...";
}
Hope this helps, I'll report any other bugs as well.
Regards,
James
Comment #13
icecreamyou commentedKeeping this marked as fixed because your original problem was fixed; the issue for your new problems is #295622. (Sorry about the upgrade problems, I didn't try re-installing--I just overwrote the old files. :-/)
Comment #14
icecreamyou commentedThe errors you got should be fixed the next time CVS updates (dev builds update at noon and midnight GMT). Don't know about the last two bugs with the name problem. Will you open a new issue if you continue experiencing that problem? Specify whether you have Facebook Mode turned on or off, which user(s) is/are looking at the block to get the result you're seeing, what those users' permissions are, what block you're looking at, and what's going on in the page (i.e. does this happen before or after a status is submitted, a node is edited, etc.).
Comment #15
jjoves commentedThanks, IceCreamYou.
I'll reference #295622 for future use.
Till then,
Regards,
James
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.