I want to help in D7 port. I followed the instructions at http://fbss.icecreamyou.com/sprint-d7-port . And forked the repository. But, what should I do next?
I can understand what a particular code does.I can also create patches and help in testing them. But, to be true, I have never written any code till now. How to know which code needs to be changed ? I don't understand which file should I begin with.
It will be great if you could guide me.

CommentFileSizeAuthor
#13 fbss.PNG3.25 KBnikkubhai

Comments

icecreamyou’s picture

Awesome! I'm glad you're interested in contributing back.

Basically there are two ways to approach upgrading the code.

  • Just try to install it. Fix any WSODs or obvious issues that appear.
  • Look for changes that Coder made and make sure they're right. DB query changes will usually be wrong, for example, and Coder leaves TODO comments on things it's not sure about.

I haven't tested the upgrade yet, but in terms of what I know for sure is currently not working -- Views integration, AJAX submitting, and all submodules are the big things. The AJAX stuff is very complicated because FBSS 6.x overrides some of Drupal core's AJAX handling and I haven't looked at how that translates to D7 yet but the AJAX system has changed a lot. If you want an easier target, once you can get the module to install without WSODs, just turn off AJAX submitting in the module's settings and see if you can get Views integration to work. Since Views is really how statuses are displayed it will be pretty hard to find other bugs until we have that. I suspect that Views hasn't changed that much, it's more of a matter of accommodating the new database API in Drupal 7.

It's a big module, so I understand if you feel kind of lost. Please do reach out to me and ask if you have an questions though -- and thank you for contributing!

nikkubhai’s picture

Is it ok if I ask you further questions in this issue itself ? I hope I won't increase your trouble you instead of helping.

So here is the first problem.
As soon as I enable the main module: Facebook-style Statuses . I get WSOD saying,
" Parse error: parse error in C:\wamp\www\drupal\sites\all\modules\Statuses\facebook_status.module on line 274 "

I found that in the file facebook_status.module , there is a syntax error on every line which has the words: $account->uid

So definitely the expression "$account->uid" needs to be changed. What can be the solution for it or how shall I find the solution?
Thanks

icecreamyou’s picture

Is it ok if I ask you further questions in this issue itself ?

Sure.

What can be the solution for it or how shall I find the solution?

Usually if I don't see the error immediately the best approach is to figure out what values the relevant variables hold (using your IDE or by printing them to the screen using the dsm() function if you have Devel installed or drupal_set_message(var_export($variable, TRUE)) if you don't) and then figure out how they got those values by tracing back through the code. If that doesn't reveal anything, break the relevant code down into smaller parts and try each part one by one to see if you can identify the problematic part. Sometimes this means running code outside of the module, e.g. using the "Execute PHP" page provided by the Devel module at /devel/php to run statements and see if they have errors or return the expected values. Often the problem is with the code immediately before the error that PHP reports -- PHP will throw an error when it encounters something unexpected which usually happens when something in the code just before that is missing some syntax.

nikkubhai’s picture

With the help from DamienMcKenna , I commited changes to https://github.com/IceCreamYou/Statuses/ and sent you a pull request at Github. Please Check.
The changes are same as mentioned in patch in http://drupal.org/node/671822#comment-4842274

icecreamyou’s picture

Awesome! Thanks! Merged your pull request.

damienmckenna’s picture

The patch I supplied has an extra syntax fix for fbss_comments.module:

diff --git a/submodules/fbss_comments/fbss_comments.module b/submodules/fbss_comments/fbss_comments.module
index 26f01f2..73d86e3 100644
--- a/submodules/fbss_comments/fbss_comments.module
+++ b/submodules/fbss_comments/fbss_comments.module
@@ -88,7 +88,7 @@ function fbss_comments_user_cancel($edit, $account, $method) {
   if ($method == 'user_cancel_reassign') {
     db_update('fbss_comments')
       ->fields(array('uid' => 0))
-      ->condition('uid' => $account->uid)
+      ->condition('uid', $account->uid)
       ->execute();
   }
 }
nikkubhai’s picture

Thanks Damien. I will send a pull request for this too.

nikkubhai’s picture

I sent one more pull request.
I have a doubt here. You made a commit " Minor code style fix " to https://github.com/IceCreamYou/Statuses . but , this wasn't committed to my branch. So , how do I keep my branch up to date with yours? Understood it.

nikkubhai’s picture

Hi. I am completely stuck at this.

Fatal error: Call to undefined function db_prefix_tables() in C:\wamp\www\drupal\sites\all\modules\Statuses\includes\views\handlers\facebook_status_views_handler_filter_autotype.inc on line 17

I asked for suggestions in irc , and got help from chx. Here is our conversation.

<chx> nikkubhai: in D6, this  $query = db_prefix_tables("{$this->table}.recipient = %d AND {$this->table}.type = '%s'"); should be $query = '{$this->table}.recipient = %d AND {$this->table}.type = '%s'");
[15:56] <chx> so D6: $query = '{' . $this->table .'}.recipient = %d AND ...
[15:56] <chx> no need to call prefix tables yourself
[15:56] <chx> in d7 this is a bit trickier
[15:57] <nikkubhai> trickier? how?
[15:58] <chx> i probably would blast this apart
[15:58] <chx> and write something akin to
[15:58] <chx>     $this->query->add_where($this->options['group'], "$this->table_alias.$this->real_field", array_values($this->value), $this->operator);
[15:58] <chx> so
[15:58] <chx>     $this->query->add_where($this->options['group'], "$this->table_alias.receipient", $recipient, '=');
[15:58] <chx>     $this->query->add_where($this->options['group'], "$this->table_alias.type", $type, '=');
[15:58] <chx> this would work on both
[15:59] <chx> d6 & d7

Even the above code didn't work. So, I don't know what to do here. Please resolve it so that I can proceed further.

icecreamyou’s picture

Does this commit resolve it for you?

My problem is that Views for D7 isn't documented. The "official" documentation for $query->add_where() is here, but it's the 6.x-2.x version, and I don't know whether it changed in D7.

FBSS provides a bunch of Views handlers and most of them probably need to be changed like this.

nikkubhai’s picture

The commit doesn't work. I get this error

'Exception: SQLSTATE[42000]: Syntax error or access violation: 1064 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 \'USER \'1\') ))) subquery\' at line 2'
in views_plugin_query_default->execute() (line 1386 of C:\wamp\www\drupal\sites\all\modules\views\plugins\views_plugin_query_default.inc).

So, what should I do now?

nikkubhai’s picture

I created an issue in views and got help from deriene and it works!!! :D
I have sent a pull request. Please apply only the last (most recent) commit.

Also, now there are no WSOD :D ( I have only fbss and fnss comment enabled)

But, the fbss block shows nothing but just the word "array"

nikkubhai’s picture

StatusFileSize
new3.25 KB

The attached screenshot. How should I deal with this?

icecreamyou’s picture

I have sent a pull request. Please apply only the last (most recent) commit.

I had to merge by hand because your changes weren't against HEAD, so I made a minor formatting change, but should be fixed now.

Also, now there are no WSOD

Yay! \o/

the fbss block shows nothing but just the word "array"

Rendering the block starts in hook_block_view() which calls theme('facebook_status_form_display'). Apparently that theme call is returning an array, probably because drupal_get_form() returns an array in D7 instead of an HTML string. I think that just wrapping that call in drupal_render() should fix that -- a change I've just committed.

nikkubhai’s picture

Now I get wsod with this error:
"Fatal error: [] operator not supported for strings in C:\wamp\www\p\includes\form.inc on line 3587 "

This error has also been found in webform module where they fixed it through this patch: http://drupal.org/files/issues/838016.patch

As we can see they have simply replaced
#attributes' => array('class' => '***'),
with
#attributes' => array('class' => array('***'))

Shall I do the same? If yes, which files should I look for?

I also get this warning

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in _form_set_class() (line 3988 of C:\wamp\www\p\includes\form.inc).

icecreamyou’s picture

Committed a fix for that. I just ran grep -rn array.'class' => ' to find places where the class attribute was defined as a string.

nikkubhai’s picture

Wow ! I saw the facebook share status block for the first time. :D
Now when I click on share button, I get this error.
" Fatal error: Call to undefined function facebook_status_box_validate() in C:\wamp\www\p\includes\form.inc on line 1409 "

Also I am thinking whether I am really helping? I haven't done anything except pointing out errors. :(

icecreamyou’s picture

Wow ! I saw the facebook share status block for the first time. :D

Yay! \o/

Fatal error: Call to undefined function facebook_status_box_validate() in C:\wamp\www\p\includes\form.inc on line 1409

Clues:

  • the error is in form.inc
  • the error happens when you submit the status update form
  • the error is about a missing ("undefined") function
  • that function actually is defined in includes/utility/facebook_status.form.inc

Those clues indicate that the problem is most likely that the status update form validate function isn't loaded at the stage in the submit process that it's needed. In other words, facebook_status.form.inc hasn't been included in the AJAX callback by the time the validate function needs to be run.

Also I am thinking whether I am really helping? I haven't done anything except pointing out errors. :(

You're definitely helping. You've helped prod me into making progress, and you also solved a few issues like the Views thing, saving me from having to go do the research on my own. Additionally if you are learning something from this process it is a good use of my time to help you understand the errors you encounter, because if I can foster a Drupal contributor, chances are you'll contribute back more than I can help you with. :) I hope that my explanations of the errors you've found will help you solve similar errors in the future.

nikkubhai’s picture

Thanks for your reply Ice!

I noticed that you have uploaded 7.x dev version of fbss to d.o. : http://drupal.org/node/1248570

So shall I continue with pull requests on github or create issues in fbss queue here from now on wards?

Also the dev version is not updated with git one's. It gives the same errors which we solved previously.

icecreamyou’s picture

So shall I continue with pull requests on github or create issues in fbss queue here from now on wards?

Also the dev version is not updated with git one's. It gives the same errors which we solved previously.

Development is still happening on github, and you should still submit pull requests there, but I created the dev release so that issues could be opened against it on drupal.org by people who are just testing and aren't able to do any development. I will move the code back to drupal.org soon but for now github is still where development is happening.

icecreamyou’s picture

Status: Active » Fixed

Now that the D7 port has its own issue queue, I think this issue can be marked as fixed now. :)

Status: Fixed » Closed (fixed)

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