I updated to newest dev Version.

The tokens used in Activity Templates produce the same [owner] = [poster] for a status posted to another users profile. (uses in public message)

CommentFileSizeAuthor
#5 d00c68b1.txt191.01 KBbaff
#3 template.jpg157.54 KBbaff
#2 screenshot.jpg164.3 KBbaff

Comments

baff’s picture

Maybe this info helps. The same tokens used in Fbsmp template works.
Newest dev Version of 6.x-2.x-dev

baff’s picture

StatusFileSize
new164.3 KB

Here the scrrenshot of the result

baff’s picture

StatusFileSize
new157.54 KB

And here the according template

icecreamyou’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this, and I find it very difficult to believe that this is happening. The values for the owner and poster are directly pulled right out of the {facebook_status} table in the database for all tokens in the Activity templates, so if the status is recorded correctly, what you're reporting shouldn't be possible. And it sounds like the status is recorded correctly.

I don't understand what you mean by this:

Maybe this info helps. The same tokens used in Fbsmp template works.

By the way, you should be using [status-unformatted] instead of [status-raw]. [status-raw] is unfiltered and could contain dangerous output.

baff’s picture

StatusFileSize
new191.01 KB

I checked the status table - the entries are correct.

Then I checked the activity_message table, the entries are wrong.

Here the template:


[poster] hat folgende Kurzmitteilung an [owner] gesendet :

"[status-unformatted]"



Besuchen Sie das Profil von [owner]

um einen Kommentar zu erstellen.



Here the entry in activity_message table



dawidl hat folgende Kurzmitteilung an dawidl gesendet :

"zweite Testnachricht an xxxx"



Besuchen Sie das Profil von dawidl

um einen Kommentar zu erstellen.




[owner] is converted into dawidl
but dawidl is the poster

I am using the same in fbsmp:
template:

Ein Foto von [poster] für [owner]:

[status-unformatted]

[attachment-themed]

Besuchen Sie das Profil von [owner]

um einen Kommentar zu erstellen.

and result in activity_message table is

Ein Foto von dawidl für xxxx:

Foto an xxx

Only local images are allowed.

Besuchen Sie das Profil von xxxx

um einen Kommentar zu erstellen.

So, statuses with attachments are working.

Things I have changed:
Newest versions of
Facebook Status
Status Comment
Status Micropublisher
Activity
CTools (there were problems, because CTools changed their API, dont't know if this information is important)

I deleted all activity tables and entries and reinstalled to newest dev Version - same problem

I attach activity and status tables as a status quo.

baff’s picture

There seems to be a second bug.
It is always chosen the Public message: section for status recording on another persons profile

Not e.g. Owner message: section

Statuses with attachments are ok

icecreamyou’s picture

Still can't reproduce this. Will think some more about why it might be happening.

baff’s picture

Before I was updating to the newest dev Versions of

UR
Status
Status Comment
Micropublisher
CTools
Activity

It was working.

Maybe you can talk to module writer of Micropublisher, which is working, to compare the coding ...

PS: Can it be a result of string translating into German? Dont't think so, just came into my mind.

PS: If you want you can login into my site, the writer of Micropublisher did and found the bug.
He could not reproduce another bug

icecreamyou’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Yeah, I'm going to chalk this up to a translation error. I talked to publicmind, who I'm mentoring for the FBSMP project, and he can't reproduce it either; plus FBSMP actually uses FBSS' own tokens so the values should be exactly the same unless they were translated differently.

baff’s picture

I have disabled German - the result - activity does not record anymore - no statues and no statues with attachments.

So I think it is not a Language problem (because only English is activated) but a problem of newest dev version of activity, or maybe deeper, a problem of actions module

At the moment I don't know what to do ...

What module writes into activity_message table when a status is posted and when?
Maybe I can debug php code.

baff’s picture

Deleted all activity tables and entries, deleted all activity entries in action table.
Installed latest dev of activity (25th May)

I checked the different enries in actions table:

Here Entry in actions table of status without attachment to other users profile:
a:4:{s:26:"facebook_status-pattern-de";
s:180:"[poster] ...";
s:17:"poster-pattern-de";s:118:"...[owner] "; /* different: poster-pattern-de */
s:19:"everyone-pattern-de";
s:197:"[poster] ...[owner] ..."; /* s:197 different */
s:14:"activity_types";a:0:{}}

Here Entry in actions table of status with foto to other users profile
a:4:{s:26:"facebook_status-pattern-de";
s:184:"...[poster] ... ";
s:16:"fbsmp-pattern-de";s:112:"...[owner]..."; /* different: fbsmp-pattern-de*/
s:19:"everyone-pattern-de";
s:199:"[poster] ....[owner]..."; /* s:199 different */
s:14:"activity_types";a:0:{}}

Maybe this helps to get an idea what the problem could be ...
But as I do not understand it could be useless information

PS: in activity_message table fsmp makes the following entry

href="/mitglieder/dawidl" title="Profil anzeigen">dawidl an xxxx

Could the tittle "Profil anzeigen" be a problem statuses without attachments?

icecreamyou’s picture

Those records are correct. The pattern just has to do with which field you're using (module-dependent) and the s:199 stuff just means "a string with 199 characters."

The title should have nothing to do with it.

It may well not be related to translation, but whatever it is, it's not something that happens in a standard install. I don't know what to tell you to do other than try reinstalling, clearing caches, and reconstructing your Activity templates.

I'm not using the very latest Activity dev at the moment, but I really doubt that's the issue.

CobraMP’s picture

This just happened to me as well so I can verify it has nothing to do with translation.

template is "You posted on [owner]'s wall" and the result is saying I posted on my wall.

shows that way on both the maintenance page as well as my page and block views

I'd be happy to help troubleshoot but not sure where to start. Just downloaded the mod tonight.

icecreamyou’s picture

I mean, look, here's the code that gets the value for the token:

$owner = _facebook_status_user_load($status->uid);
$values['owner'] = theme('username', $owner);

If the status appears on the correct profile, then the value for UID is correct, and that value represents the owner, and the [owner] token is populated using the owner variable.

The only way I can think of that this wouldn't be the case is if some other module was overriding the [owner] token, which I'm not even sure is possible.

If you'd like to debug, you can edit facebook_status.module and add drupal_set_message("Owner UID: $owner->uid"); after line 1983 (assuming latest dev). Then try posting a status on someone else's profile and see what it says.

(Also -- make sure you're using the fbss_submitted_other template. If you're using the fbss_submitted template, then [owner] and [poster] will be the same.)

CobraMP’s picture

ok I deleted the old template and started a new one making sure I selected fbss_submitted_other

In the poster message the template is "You posted on [owner]'s wall"

when I posted on another user's wall the activity reads that I posted on my wall.

entering code above after line 1983 $owner = _facebook_status_user_load($status->uid); when I post on a users wall I get the following output (i am user 24)

* Owner UID: 24
* Owner UID: 24
* Owner UID: 24
* Owner UID: 33

seems odd to have 4 entries. btw when I delete a status it tells me twice that it was deleted.

icecreamyou’s picture

Both FBSS and Facebook-style Micropublisher have default status deletion messages through Rules, which is probably why you would see two delete messages. That's a minor bug in FBSMP -- you can just disable one or both of them.

The 4 messages would be from 4 different times values were retrieved for tokens -- probably for your rule, an FBSMP rule, Pathauto analysis... I'm not sure what else, but not anything FBSS causes by default and not anything to worry about.

Try putting drupal_set_message("Owner UID: $status->uid"); on line 1761 of facebook_status.module.

CobraMP’s picture

done and when I posted on another user's wall the message is "Owner UID: 35" which is the uid of the person I posted on.

icecreamyou’s picture

Well I don't know what to tell you then. FBSS literally passes $status (which worked correctly for you) directly to the Trigger/Action system which should feed it unchanged right back to the Token integration. Whatever is causing the change in between is very weird, and not due to FBSS, and honestly I have no idea how to debug it, but I definitely can't reproduce it.

CobraMP’s picture

Thanks for trying ICY I will pass this forward to the activity maintainers.

angelmax’s picture

Thanks to IceCreamYou for having redirected me to this issue.
I have the same problem as in the title and I described it here: http://drupal.org/node/831296

Apologize for not having being able to find this issue earlier.

Now, I am eagerly waiting for a solution to this problem.

Cheers.

A.M.

mach5_kel’s picture

I am having the same issue with no solution.

I posted it here http://drupal.org/node/861662 (marked as double post).

olivo.marco’s picture

I have the same issue on my D6 installation: I am using italian language, and poster seems to be shown as owner every time, even when I try post with one user on another's wall.

baff’s picture

angelmax’s picture

Baff, I don't see your message here, but I read it via the notification email.

I am at number #20 and I do HAVE English as the first language.

Thanks.
AM

Scott Reynolds’s picture

Status: Closed (won't fix) » Needs work

I will define the problem and share the source.

Activity module assumes that each object in the $context array has a uid tied to it and that uid corresponds to the user to get the message. It also assumes that the primary object's uid (in this case facebook_status) is the person who did the thing. Unfort, it actually corresponds to the persons wall which is not what Activity assumes. And thus it adjusts that uid to be GLOBALS[user]->uid because, unless it was specified, the person 'doing' the activity is the GLOBAL user. And the only time it is really specified is when its rebuilding the activity from scratch.

And of course, to throw another wrench, Activity2 also makes sure that the 'actor' that was specified (or GLOBAL user) is the uid on the primary object.

All of this comes down to the fact, that the primary object's uid does not match the excepted uid (GLOBALS user) and thus it is adjusted to match.

This is the ugliness I am trying to address in the next version just because unless people are intimate with Activity code, they won't understand. Its a DX fail of epic proportions.

icecreamyou’s picture

Status: Needs work » Postponed (maintainer needs more info)

Thanks for your insight Scott.

The thing is, this problem doesn't happen for most people. I personally haven't been able to reproduce it. Are you saying it's a bug in the Activity API where it assumes the wrong UID under certain circumstances, even when the right one is passed?

Also, is there an issue I can follow so I can keep track of when this change is made to the Activity API, or will you update here?

Scott Reynolds’s picture

Status: Postponed (maintainer needs more info) » Active

Nothing wrong with the Activity API other then its aweful DX. The object has a uid property, but when the owner isn't the poster, Activity 'fixes' the object which in turn breaks the token. It will happen 100% of the time if you do a template like so for Facebook status other submit: http://skitch.com/supermanscott/d21h2/edit-contrib-d6

icecreamyou’s picture

Well it's been too long since I worked with the Activity API so I don't grok for sure what's going on there, but it looks to me like FBSS always passes in the right UID. I mean, obviously something is wrong somewhere, and it may very well be on the FBSS side, but I'm just not seeing it.

Scott, how do you suggest moving forward? Is it worth waiting for the next iteration of the Activity 2 API, or is there a simple fix now?

glitz’s picture

Hi-just wondering if there was any work around in place for this yet?

THANKS

glitz’s picture

any update on this yet?

glitz’s picture

is this put on hold until the release of the new API> or is there a workaround yet for this?

white_pawn’s picture

Any news?

vgulla’s picture

Any update on this? I am also having the same issue

gorgo’s picture

I have the same problem!
Anyone has a solution for this yet?

5t4rdu5t’s picture

Hi there,

Here's a small fix/workaround for those (like me) who need this solved asap:

On facebook_status.module file line # 1878 in function facebook_status_activity_info(), change this line:

<?php

$info->objects = array('Owner' => 'facebook_status', 'Poster' => 'poster');

?>

with this one:

<?php

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

?>

Then add the following hooks on a custom module of yours:

<?php

function mymodule_activity_objects_alter(&$token_objects, $activity_type) {
	if ($token_objects['facebook_status']) {
		$token_objects['facebook_status']->uid = $token_objects['owner']->uid;
	}
}

function mymodule_activity_record_alter(&$record, $context) {
	if ($record->type == 'facebook_status') {
	  $record->uid = $context['owner']->uid;
	}
}

?>

That should get you going until something better is available.

icecreamyou’s picture

I suspect that it breaks other things, but if other people can confirm the solution in #35, I will try to translate it into a fix.

Again, Scott, it would be great if you could chime in here...

5t4rdu5t’s picture

You were right IceCreamYou, it does break other things...

Forget the change to facebook_status.module. I think I've got it working with just the two hooks:

<?php

function mymodule_activity_objects_alter(&$token_objects, $activity_type) {
	if ($token_objects['facebook_status']) {
		$token_objects['facebook_status']->uid = $token_objects['facebook_status']->owner->uid;
	}
}

function mymodule_activity_record_alter(&$record, $context) {
	if ($record->type == 'facebook_status') {
	  $record->uid = $context['owner']->uid;
	}
}

?>

I will keep testing, if all is good maybe they can be incorporated into facebook_status somewhere. Any improvements are welcome.

white_pawn’s picture

Great job 5t4rdu5t! I believe you have fixed the problem.

icecreamyou’s picture

Interesting. I don't see a way to solve this that doesn't involve using alter hooks, so if I can get one more person to confirm that the solution in #37 works, I'll just go ahead and commit that code to the module.

glarsch’s picture

I was experiencing the same problem. I made a custom module with the code from #37 and it fixed the problem for me as well!! Very glad I found this post.

mastermtg’s picture

where do I put the code from #37? or how do I quickly create a custom module to put the code into?

icecreamyou’s picture

Status: Active » Fixed

Committed #37 to dev. I haven't tested it, so please try it and report if it doesn't work or causes any other problems.

I'm not marking this "to be ported" because I suspect that the changes in FBSS 3.x should already fix this problem.

glarsch’s picture

Status: Fixed » Active

I checked out this post to create my custom module: http://drupal.org/node/416986. All in all it only took about 20 minutes to test this out.

IceCreamYou, I'm seeing Feb 1 as the latest dev. Am I not looking in the right place? Thanks

icecreamyou’s picture

Status: Active » Fixed

Whoops, my bad. I made the change but forgot to commit it. (Committed now.)

To be clear, when using the (new) latest dev, you shouldn't need a custom module to make this work.

glarsch’s picture

Got rid of my custom module and updated to the latest dev, works like a charm. Thanks again.

Status: Fixed » Closed (fixed)

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