Allow users to post on the walls of friends.

Comments

fleck74’s picture

Hi,

So I've made something to allow you to do that.

But you have to make some config in drupal before before I don't know how create a field programmatically.
So go in your content type drupal_wall and create a field Target.
The system name have to be field_target and it's a number.

After that you can change in your files :
drupal_wall.tpl.php :
Line 54 to 56 :

if (isset(<strong>$wall_post[$i]->author['picture']</strong>)) :
  print '<a href="' . $base_url . '/user/' . <strong>$wall_post[$i]->author['uid']</strong> . '" ><img src="' . <strong>$wall_post[$i]->author['picture']</strong> . '" width="50px" /></a>';
endif;

Line 66 to 68 :

if (isset(<strong>$wall_post[$i]->author['name']</strong>)) :
  print '<a href="' . $base_url . '/user/' . <strong>$wall_post[$i]->author['uid']</strong> . '" >' . ucwords(<strong>$wall_post[$i]->author['name']</strong>) . '</a>';
endif;

drupal_wall.module :
Around the line 140 :

  $query = db_select('node', 'n');
  $query->leftjoin('field_data_body', 'b', 'n.nid=b.entity_id');
  <strong>$query->leftjoin('field_data_field_target', 't', 'n.nid=t.entity_id');</strong>
  $query = $query
    ->fields('n', array('nid', 'uid', 'created', 'comment', 'title', 'type'))
    ->fields('b', array('body_value'))
    <strong>->fields('t', array('field_target_value'))</strong>
    ->condition('<strong>t.field_target_value</strong>', $uid)
    ->condition('n.status', 1);

Around the line 166 :

  $query = $query->execute()->fetchAll();
  <strong>foreach( $query as $q){
	$author = user_load($q->uid);
	$q->author = array(
		'uid' => $author->uid,
		'name' => $author->name,
		'mail' => $author->mail,
		'picture' => _drupal_wall_user_profile_picture($author->uid),
	);
  }</strong>

drupal_wall.page.inc
Around the line 138 :

      $new_node->type = 'drupal_wall';
      node_object_prepare($new_node);
      <strong>$uservieweduid = arg(1, drupal_get_path_alias());
      $new_node->field_target['und'][0]['value'] = $uservieweduid;</strong>
      $new_node->uid = $user->uid;
      $new_node->name = $user->name;

Hope I've given all my modification for this tips.

fleck74’s picture

After that you have to change the text "created a new", "updates its status"...
It's between the lines 73 and 83.

vineet.osscube’s picture

Status: Active » Closed (fixed)
deeray’s picture

I have the same problem, I cannot post comments on friends wall, however I am using version 7.x-1.4, will this solution work for me?

deeray’s picture

Status: Closed (fixed) » Needs work
deeray’s picture

I tried the solution giving by fleck74 on 7.x-1.4 and I tried to see if the issue was taking care of in 7.x-2.x-dev but I got the same problem, I hope this issue is resolved as quickly as possible,
THanks

vineet.osscube’s picture

Status: Needs work » Closed (fixed)

Thank you for your suggestion!

But we will look into this, and see what we can do!