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);
}

Comments

jjoves’s picture

FYI. 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

icecreamyou’s picture

Status: Active » Needs review

Change lines 72 and 147 to

      $fbs_user = db_result(db_query("SELECT u.uid, u.name FROM {users} u LEFT JOIN {node} n ON n.uid = u.uid WHERE n.nid = %d", arg(1)));

...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.

jjoves’s picture

StatusFileSize
new71.38 KB

Thanks 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.

icecreamyou’s picture

Try changing those two lines (72 and 147) again, to this:

        $fbs_user = db_fetch_array(db_query("SELECT u.uid, u.name FROM {users} u LEFT JOIN {node} n ON n.uid = u.uid WHERE n.nid = u.uid AND n.nid = %d", arg(1)));

...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.

jjoves’s picture

StatusFileSize
new119.66 KB

IceCreamYou,

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

icecreamyou’s picture

Wait a minute. Are you allowing anonymous users to submit statuses? Bad idea. Very bad idea.

All the same, try changing line 59 to:

        || (arg(0) == 'node' && is_numeric(arg(1)) && db_result(db_query("SELECT uid FROM node WHERE nid = %d", arg(1))) == $user->uid))

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.

jjoves’s picture

IceCreamYou,

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.

icecreamyou’s picture

I 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.

icecreamyou’s picture

Status: Needs review » Fixed

Marking 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

jjoves’s picture

Excellent. I'll check it out once it's through. When's the expected timeframe for the 6.x version?

icecreamyou’s picture

The 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.

jjoves’s picture

IceCreamYou,

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 = '

icecreamyou’s picture

Keeping 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. :-/)

icecreamyou’s picture

The 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.).

jjoves’s picture

Thanks, IceCreamYou.

I'll reference #295622 for future use.

Till then,

Regards,
James

Anonymous’s picture

Status: Fixed » Closed (fixed)

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