I am the author of the Facebook Status module, which allows each user to have a Facebook-style Status. I added the status to my advforum posts by putting this code in advf-forum-user.tpl.php:

    //A custom snippet which prints the user's status.
    global $user;
    if ($account->uid != $user->uid && module_exists('user_relationships')) {
      $friends = db_result(db_query("SELECT COUNT(requester_id) FROM {user_relationships} WHERE (requester_id = %d OR requestee_id = %d) AND (requester_id = %d OR requestee_id = %d) AND rtid = 2 AND approved = 1", $account->uid, $account->uid, $user->uid, $user->uid));
    }
    else {
      $friends = TRUE;
    }
    if ($user->uid && $friends) {
      $status = facebook_status_get_status($account->uid);
      if (drupal_strlen($status[0]['status_fb']) > 30) {
        $status[0]['status_fb'] = drupal_substr($status[0]['status_fb'], 0, 30) .'...';
      }
      print '<p class="submitted">'. check_plain($status[0]['fbs_name']) .' '. htmlspecialchars($status[0]['status_fb'], ENT_NOQUOTES) .'</p>';
    }

You'll note that I also integrated this with User Relationships, so that the status only displays for users that are "friends" (rtid=2) of each other. For this to be integrated into the advforum module, a variable (probably status) should be defined in the function template_preprocess_forum_user() and a setting should be added to the advforum settings page to allow the user to choose which relationship type(s) are available. You can build that element like this:

    $fbsur_result = db_query("SELECT plural_name, rtid FROM {user_relationship_types}");
    while ($row = db_fetch_array($fbsur_result)) {
      $i = $row['rtid'];
      $fbsur[$i] = $row['plural_name'];
    }
    $form['fbs_misc']['facebook_status_ur_type'] = array(
      '#type' => 'select',
      '#title' => t('User Relationship type to use for this block'),
      '#default_value' => variable_get('advanced_forum_facebook_status_user_relationships_type', array(1)),
      '#description' => t("This block works exactly like the Facebook Status Recent Updates block except that it only shows the latest status updates for users with whom the currently logged in user has a relationship."),
      '#options' => $fbsur,
      '#multiple' => TRUE;
    );

I can answer any questions, but I don't really have time to write a formal patch for this.

Comments

michelle’s picture

Thanks for this. I'm currently out of town on an emergency trip with limited computer access. I will look at this ASAP.

Michelle

icecreamyou’s picture

I just realized there's a bug in the second snippet I posted which was a result of me overlooking things when I altered a copy-paste from facebook_status.module. The variable name has to be the same as the form element name in order for it to be updated.

michelle’s picture

Ok, looked at this a bit more. I'm not sure if it would be better for me to put a setting for this in advforum or for you to put it in yours. I would like to try to get some of the contrib module code into the contrib modules themselves. I'm going to hold off on this for a bit. As tempting as it is, I need to get things fixed up and get new alphas out before I go adding any new goodies.

Thanks,

Michelle

icecreamyou’s picture

I already have that setting, actually, it's just not currently on the global settings page. And if you'd like, I'll add a function to Facebook Status that outputs the status as it should be shown in Advanced Forum. Then, all you'd need to do would be to add this code to advf-forum-user.tpl.php:

facebook_status_advf();

...would that be better?

michelle’s picture

That would be perfect, actually. :)

Thanks,

Michelle

icecreamyou’s picture

Assigned: Unassigned » icecreamyou
Status: Needs work » Needs review

Both the 5.x and 6.x branches of facebook_status will have this code in their next -dev release.

So now, to add this into advanced_forum, you need to add this code to advf-forum-user.tpl.php:

<?php print facebook_status_advf($account); ?>

michelle’s picture

Awesome! I'm working on advforum tonight. You've made it so easy, I'll make sure this gets in. :)

Thanks,

Michelle

michelle’s picture

Well, I added it but I cant' tell if it works. The dev of f_s has facebook_status_user defined twice and keeps crashing.

Will leave this open until I know it works.

Michelle

icecreamyou’s picture

Oops! :-/

...fixed. Sorry. And thanks for including this in your module.

michelle’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Fixed

Ok, got the new tarball and confirmed it worked. Well, in 6.x, anyway... I'm being lazy and didn't test the 5.x port yet.

Thanks again!

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

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