Hi,
I just installed the 2.0 branch and whenever I update the status, I get a popup with the following message:
An HTTP error 500 occurred.
/facebook_status/js

I have disabled the slide effect and I get this error with Garland and any other theme. I also disabled all legacy functions in the configuration section. Has anyone else had this problem? I get the error with both firefox and Chrome.

Comments

ionchannels’s picture

I should also add the following:
I am updating the status from a block. The status is still updating, but only after I reload the page. The following entry appears in my /var/log/httpd/access_log:
"POST /facebook_status/js HTTP/1.1" 500 - "http://www....

icecreamyou’s picture

Do you have the Twitter module installed? I made a mistake in the Twitter integration that can cause this to happen...

What version of PHP do you have? What type and version of SQL? Do you have any JavaScript-related modules installed?

What pages is this happening on? Are there multiple status update forms on the same page?

Did you upgrade from a previous version of FBSS or install it for the first time? If you upgraded, did you run update.php?

This is a really vague error (status code 500 basically means "something's wrong but the server doesn't know what") and I haven't experienced your problem (unless it's related to Twitter) so I will need to know as much information as you can give me about your system in order to solve this problem.

icecreamyou’s picture

Assigned: Unassigned » icecreamyou
Status: Active » Postponed (maintainer needs more info)
ionchannels’s picture

Hi, thanks for the reply and help. I do have the twitter module installed. I have disabled posting to twitter, but the error still comes up. I am using PHP 5.2 and MySQL 5. I have a number of AJAX modules installed including most of the AJAX integration modules. I had popups and popups_reference installed, but I've removed these with no effect.

This error is occurring on all pages and I am posting through the block and I have only 1 status update on the page. I have been upgrading since the first 1.0 release. When I upgraded to the 2.x branch, I completely uninstalled the module and reinstalled and yes, I ran update.php like clockwork.

I am posting the results from the javascript console via firebug in hopes that it might shed light on the problem. It looks like jquery might be part of the problem??:

Here are the response headers:

Response Headers
Date
Tue, 19 May 2009 14:59:58 GMT
Server
Apache/2.2.3 (CentOS)

X-Powered-By
PHP/5.2.4
Expires
Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified
Tue, 19 May 2009 14:59:58 GMT

Cache-Control
store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-Length
0

Connection

close

Content-Type

text/html; charset=utf-8

Request Headers
Host

www.labpage.org

User-Agent

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10

Accept

application/json, text/javascript, */*

Accept-Language

en-us,en;q=0.5

Accept-Encoding

gzip,deflate

Accept-Charset

ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive

300

Connection

keep-alive

Content-Type

application/x-www-form-urlencoded; charset=UTF-8

X-Requested-With

XMLHttpRequest

Referer

http://www.labpage.org/

Content-Length

153

Cookie

cacherouter=1; __utma=246001945.1161013349.1240243248.1242741455.1242743445.98; __utmv=246001945.authenticated
%20user%2CLab%20Member; SESSd3a16e7ef61686af0f93e987d218898b=09c1vlumbtb71cqtdqnnp88p22; __utmz=246001945
.1240243250.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __gads=ID=f870cb1cf7aa9692:T=1240241562
:S=ALNI_MaxLbe1DNpmeb_lYmUmyDvT5yye9w; has_js=1; __utmc=246001945; __utmb=246001945.4.10.1242743445

and then the post:

form_build_id form-7872534c847dfe89cdc10ce49684e79d
form_id _facebook_status_status
form_token 473ee457e479e9313f98cc22034bbc35
op Save
status is testing

and then the response:
POST http://www.labpage.org/facebook_status/js http://www.labpage.org/facebook_status/js 500 Internal Server Error 343ms jquery.js?g (line 13)
Params

ionchannels’s picture

One thing, I am using jquery update, but it seems to be using jquery 1.2.6. I'm not sure why. Should I change to jquery 1.3.2?

icecreamyou’s picture

I'm not sure how you know that it's using JQuery 1.2.6, but if you think this is the case even though you're using JQuery Update, this is probably a bug with JQuery Update (or you may not have installed it correctly). FBSS handles very little of its own JavaScript; most of it is default Drupal behavior, so I'd say the issue likely rests with one of the JQuery modules you're using.

Of course, there could be a conflict between FBSS and one of those modules, rather than the fault lying entirely on those modules.

At this point I recommend that you uninstall all JQuery-related modules one by one, reversing whatever steps you took to install them (for instance, you're supposed to replace core Drupal files when you install JQuery Update) and test FBSS after each one to see if it works. If you find the one that's the conflict, reinstall it, carefully following the install/upgrade instructions. If the conflict is still there, at least we know which module to address.

ionchannels’s picture

I have disabled all extraneous javascript modules and I still get the error... I'm now using jquery 1.3.2. I have noticed the following coding problem in the status update form:

<div class="content">
    <div id="facebook_status_update" class="clear-block"><form action="/"  accept-charset="UTF-8" method="post" id="-facebook-status-status" style="margin-bottom: 0;">

See the id in the form action is "-facebook-status-status". I've never seen an id starting with a dash - is this correct for this module?

icecreamyou’s picture

Yes, the ID is fine. It's just the name of the function that defines the form, _facebook_status_status, with underscores converted to hyphens.

If you're using JQuery 1.3.2, you haven't disabled all extraneous JavaScript modules; you're still using JQuery Update, even if the module itself is disabled. Please try to revert to the state of JavaScript you'd have with a clean Drupal install (JQuery 1.2.6 with no JS modules enabled).

ionchannels’s picture

Thanks for the advice. I disabled all modules and started enabling them one at a time. Turns out it was the activity module http://www.drupal.org/project/Activity that seems to conflict. Ironically these were the 2 modules that I wanted to work together. I was using 6.x-2.x of the activity module. I will try the 6.x.1.x branch of the activity module and report back.

ionchannels’s picture

I also get the same error when I try to post my status to twitter. Very strange....

icecreamyou’s picture

Title: Strange javascript error (http 500) when updating status » Support Activity 6.2
Category: support » feature
Status: Postponed (maintainer needs more info) » Postponed

Wow, I definitely didn't expect that... thanks for being so cooperative in helping to track this down. I'm really busy this week but I'll try to look into it also. Actually now that I think about it, I'm not surprised it doesn't work, because I'm pretty sure I wrote the integration for Activity 1.x. Hmm. It used to be that I would have problems with people being on Activity 4.x instead of the stable 3.x branch... people just aren't getting what they need out of that module yet evidently, heh. It's getting there though...

Anyway, it should be possible for me to provide integration with both branches, but it will be a little bit until I have time to figure that one out, so marking as postponed. Do let me know if the Activity 1.x integration works though, because the testing I did on that was very light compared to how much I've tested all the other features, and I'm probably missing some steps (like if a status is deleted, the corresponding Activity record isn't deleted with it).

ionchannels’s picture

OK, I've installed activity 6.1.1 and I no longer get the javascript error. However, status updates don't seem to be recorded as I expected. That's OK for us right now. We plan on upgrading to the activity 2 branch once the javascript error is resolved. Thanks again for your help.

mrjavum’s picture

Integration with Activity 2.x is rather simple (at first look). The module has good developer documentation and the good example of integration is flag_friend module. I undrestand code but have poor experience to integrate both branches together.

icecreamyou’s picture

My experience working with Activity has been that the developers are great people who are nice to work with, but documentation used to be pretty sparse. I haven't checked in awhile though and I'll try to get to that this weekend if possible although it may be the following weekend before I have a chance.

dicreat’s picture

Subscribe.
I have the same error after installing Activity 2 module.

icecreamyou’s picture

Status: Postponed » Needs work
Issue tags: +activity2-integration

Activity 6.2 integration is partially fixed locally (will be in CVS soon). Basically, there are no errors anywhere, and setting up Activity messages basically works, but they don't get recorded when a status is submitted. I'm not sure why that is, but it's quite befuddling. I think part of the problem is that the new access control system seems really limiting.

Marking with the activity2-integration tag to hopefully get some eyes on this from the Activity maintainers...

icecreamyou’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev

Alright, so there was an obstacle: Trigger integration was broken and I didn't know it. But it's fixed now, and Activity 2 integration works, albeit with an error about being unable to insert a row into {activity_targets}, and with the caveat that FBSS tokens aren't getting run for some reason.

This is the last thing on my to-do list before RC, unless other bug reports pop up, so I'd love some help on this if anyone is capable of helping.

Having said that, the DB error seems to be related to the fact the Activity doesn't seem to want to take two "user" parameters in the $context from the trigger functions, so fixing that might have to be postponed until Activity 2 is more mature. I really have no idea about the token replacement, but it's not going anywhere fast.

I'll be AFK next week. If no one does any work on this before I get back, I'm going to mark back to postponed and just go ahead and release the RC.

subho007’s picture

Category: feature » bug
icecreamyou’s picture

Category: bug » feature

This is a feature that needs work and isn't completely in yet, not a bug report on an existing feature. This is particularly true because I don't know whether the problem is in FBSS or Activity.

subho007’s picture

Category: feature » task

looking at the codes in facebook_status.module the function

 /**
     * Implementation of hook_activity_info().
     */
    function flag_friend_activity_info() {
      $token_types['facebook_status'] = t('Facebook-style Statuses');
  return array(
    'ops' => array('update' => t('Submit Status Update')),
    'types' => $token_types,
    'roles' => array(
      'owner' => array(
        '#name' => t('Owner'),
        '#description' => t('The user whose profile the status was posted on.'),
        '#default' => 'You have a new post on your profile.',
      ),
      'poster' => array(
        '#name' => t('Poster'),
        '#description' => t('The user who posted the status.'),
        '#default' => "You posted a status on [owner]'s profile.",
      ),
      'all' => array(
        '#name' => t('All'),
        '#description' => t('Everyone who can see status updates.'),
        '#default' => "[poster] posted on [owner]'s profile.",
      ),
    ),
  );
}


should be installed for basic information exchange with activity 2 which is same as activity 1, and is already present.

Then

/** 
 * Implementation of hook_activityapi().
 * I have no idea why this is actually necessary.
 */
function facebook_status_activityapi(&$activity, $op) {
  if ($op == 'load') {
    if ($activity['data']['module'] == 'facebook_status' && user_access('view all statuses')) {
      $activity = array();
    }
  }
}

is replaced with the name function

function facebook_status_activityapi(&$activity, $op) with
function facebook_status_activity_access_api(&$activity, $op)

then again looking at this block

/**
 * Handles recording activity messages.
 *
 * @param $account
 *   The $user object of the owner of the status.
 * @param $status
 *   The status object containing the status to record. Requires at least the
 *   status and status_time.
 */
function facebook_status_activity($owner, $poster, $status) {
  if (!module_exists('activity')) {
    return FALSE;
  }
  //Privacy setting check.
  //if (activity_user_privacy_optout($account)) {
  //  return FALSE;
  //}
  $data = array(
    'operation' => 'update',
    'owner' => theme('username', $owner),
    'poster' => theme('username', $poster),
    'status' => check_plain($status->status),
    'status_time' => $status->status_time,
  );
  $target_users_roles = array(
    ACTIVITY_ALL => 'all',
    $owner->uid => 'owner',
  );
  if ($owner->uid != $poster->uid) {
    $target_users_roles[$poster->uid] = 'poster';
  }
  activity_insert($account->uid, 'facebook_status', 'status', 'update', $data, $target_users_roles);
}

i found you need to replace the function name with:

function facebook_status_activity($owner, $poster, $status)
to
function facebook_status_activity_grants($owner, $poster, $status)

comment out this lines because in activity2 we dont need this

//Privacy setting check.
  //if (activity_user_privacy_optout($account)) {
  //  return FALSE;
  //}

need to search what
activity_insert($account->uid, 'facebook_status', 'status', 'update', $data, $target_users_roles);

can be replaced with. I think you need more instances of activity function... a little help from here:>>

function activity_record($object, $context) 

will be used instead....

I was just going through and checking up
Never Mind that i made the status to bug-fix because i thought activity2 is now used by many!!
Sorry!! ;)

icecreamyou’s picture

Thanks for your help!

A few things: first of all it looks like you're looking at the Beta 4 release instead of the most recent dev (which has the almost-complete integration in it). Also, my goal is not to replace Activity 1 integration with Activity 2, it's to integrate with both. To that end, we get functions like this:

/**
 * Implementation of hook_activity_info().
 * Activity 1 and 2.
 */
function facebook_status_activity_info() {
  //This function only exists if Activity 2.x is in use.
  if (function_exists('activity_action_info')) {
    $info = new stdClass();
    $info->api = 2;
    $info->name = 'facebook_status';
    $info->object_type = 'facebook_status';
    $info->objects = array('owner' => 'facebook_status', 'poster' => 'user');
    $info->hooks = array('facebook_status' => array('fbss_submitted'));
    return $info;
  }
  //We're using Activity 1.x.
  return array(
    'ops' => array(
      'update' => t('Submit Status Update')
    ),
    'types' => array('facebook_status' => 'Facebook-style Statuses'),
    'roles' => array(
      'owner' => array(
        '#name' => t('Owner'),
        '#description' => t('The user whose profile the status was posted on.'),
        '#default' => array(
          'update' => 'You have a new post on your profile.',
        ),
      ),
      'poster' => array(
        '#name' => t('Poster'),
        '#description' => t('The user who posted the status.'),
        '#default' => array(
          'update' => "You posted a status on [owner]'s profile.",
        ),
      ),
      'all' => array(
        '#name' => t('All'),
        '#description' => t('Everyone who can see status updates.'),
        '#default' => array(
          'update' => "[poster] posted on [owner]'s profile.",
        ),
      ),
    ),
  );
}

That is in fact the only function required for Activity 2 integration. I've been through the developer docs several times and I can't figure out why this is not enough. I've tried using the optional hooks as well and the result doesn't change.

I've tracked the problem to the fact that the activity_record() function in Activity 2, which seems to somehow get called by the Trigger module, doesn't have the right UID in $context['facebook_status']->uid. That would be related to the Trigger integration in FBSS presumably, which looks like this:

/**
 * Implementation of hook_hook_info().
 */
function facebook_status_hook_info() {
  return array(
    'facebook_status' => array(
      'facebook_status' => array(
        'fbss_submitted' => array(
          'runs when' => t('The status update form has been submitted.'),
        ),
      ),
    ),
  );
}

/**
 * Implementation of hook_facebook_status().
 * or
 * Implementation of hook_trigger_name().
 */
function facebook_status_facebook_status($op, $owner, $poster) {
  if (!in_array($op, array('fbss_submitted'))) {
    return;
  }
  $aids = _trigger_get_hook_aids('facebook_status', $op);
  $context = array(
    'hook' => 'facebook_status',
    'op' => $op,
    'owner' => $owner,
    'poster' => $poster,
  );
  actions_do(array_keys($aids), $poster, $context);
}

...however, that works for Trigger, so I would have expected it to work for Activity as well. I'm quite confused about that right now.

Finally, the function facebook_status_activity is not part of Activity integration at all--it's a helper function I wrote to simplify the process for Activity 1.

Thanks for your help though! Hopefully this will get figured out soon.

Scott Reynolds’s picture

Subscribing and personally volunteer to fix it for ya. (/me one of the maintainers of Activity2)

4drian’s picture

This would be the icing on the cake for a personal project of mine. No input to make I'm afraid but figured this is better than just saying "subscribe". Best of luck with your efforts.

icecreamyou’s picture

@Scott: Awesome, thanks! As I said I'll be gone next week but of course let me know if there's anything I can do for you.

@adrianlewis: Thanks. :)

subho007’s picture

Ohkay i get it!! I am soo sorry!! i did not noticed the dev version..... well i will check it out and let you inform if i can help you ;)

icecreamyou’s picture

That's perfectly fine--it's always a good thing to try to help, even if that help is a little misguided. :-) Your effort is appreciated.

Scott Reynolds’s picture

Make this:

$info->objects = array('owner' => 'facebook_status', 'poster' => 'user');

Into

$info->objects = array('Author' => 'owner', 'Poster' => 'poster');

There will be a problem though with token replacements as your objects ('owner' and 'poster') are not standard drupal object names ('user', 'account'). This will cause Token to not know how to handle those.

icecreamyou’s picture

Status: Needs work » Fixed

Seems to work--thanks very much. I fixed the tokens too. Will commit momentarily.

icecreamyou’s picture

Committed, thanks again Scott! Leaving early tomorrow; will post an RC when I get back if there aren't any major bugs.

Status: Fixed » Closed (fixed)
Issue tags: -activity2-integration

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