Hi,
after searching a lot in Facebook-style Statuses (Microblog) and Activity modules issues and docs I wasn't able to find a solution.
I am using
Drupal 6.14
Activity 6.x-2.x-dev (2009-Sep-23)
Facebook-style Statuses (Microblog) 6.x-2.x-dev (2009-Oct-02)
I need FBSS to integrate into an Activity stream which includes, besides content and comments updates, User status updates and "wall messages" from users to users.
I have a block, created with VIEWS which gather the activities from the DB.
I've setup the activity templates for FBSS.
These are the scenarios
1) USER A leave a message to USER B
USER A gets SELF MESSAGE
USER B gets OWNER MESSAGE
other USERS get PUBLIC MESSAGE
The message should be in the form:
[date of creation]
[User A name] to [User B name]
[Message Text]
ExampleS:
SELF MESSAGE: 3 secs ago you said to Bruno: "Hi Bruno".
OWNER MESSAGE: 3 secs Abramo said to you: "Hi Bruno".
PUBLIC MESSAGE: 3 secs Abramo said to Bruno: "Hi Bruno".
2) User A updates their status
USER A gets SELF MESSAGE
other USERS get PUBLIC MESSAGE
The message should be in the form:
[date of creation]
[User A name]
[Updated User A status]
Examples
SELF MESSAGE: 6 secs ago you said: "I am happy".
PUBLIC MESSAGE: 6 secs Abramo said: "I am happy".
PROBLEM
I can't have a different message for a status update and a Message to other user so the two scenarios above cannot be achived.
I tried to edit the VIEW, by adding a Relationship to FBSS:Users hoping to get info about the USER, POSTER, OWNER etc so to make a check, but I get an erron on "uid" being ambiguos
What do you suggest? What is the best way to get the output I described?
Thank you.
AM
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | fbss_a2.png | 13.73 KB | icecreamyou |
Comments
Comment #1
icecreamyou commentedI don't understand what you mean. You should see Owner, Poster, Self, and Public templates when setting up the Activity 2 action, as shown in the attached screenshot. If you set up that one action, it should automatically work the way you seem to want in the default Activity view.
Comment #2
angelmax commentedHi IceCreamYou,
that might be a possible solution for the PUBLIC message but I need to format the [status-themed] in the same way as the other messages while it's coming with the time in the end, which i need at the beginning and, moreover, the time is always "secs ago".
How can I decide the content and the style of [status-themed]?
thanks.
AM
Comment #3
angelmax commentedMaybe I found a problem.
the message template for the POSTER never gets published.
If I leave a message for another user I don't get the POSTER message but the SELF message.
I used the template messages you suggested in your attachment:
OWNER MESSAGE
[status-themed]
POSTER MESSAGE
You [operation]d the status [status-unformatted] on [owner]
SELF MESSAGE
You [operation]d: [status-themed]
PUBLIC MESSAGE
[status-themed]
What I get is the SELF MESSAGE when I leave a message on another user instead of getting the POSTER message.
So I read "You updated: MYUSERNAME > USERNAMEB : MESSAGE. A moment ago"
And as a further problem "A moment ago" stays there always, also after a lot of moments...
Thank you.
AM
Comment #4
icecreamyou commentedTo override [status-themed], you can either override the theme function or just use the other tokens provided (i.e.
[status-time] [poster] said to [owner]: "[status-unformatted]").I think the reason you always see "a moment ago" is because of an unavoidable flaw in the way that Activity works (IIRC, it processes tokens when the action occurs rather than when the activity record is being viewed). You can get around this by changing your View to use the
Activity: Activity Creation Datefield instead of the token that FBSS provides. I must have forgotten about this when writing the tokens for the module -- but this is a bug, so I'll have to change the tokens so this doesn't continue to be confusing in the future.I can confirm that there is a bug where the
postersees theselfmessage. I'll get to this and the above bug in the next 1-3 weeks probably.Comment #5
angelmax commentedThank you IceCream,
anyway I have spent the last two hours trying to ovverride the theme function and to see its output into the Activity View but without the slightest result.
I would pretty much appreciate a simple example of what function to put where because I am clueless.
Thanks for your reply, I am looking forward for this bug-fixing, for now, for me it's a showstopper.
AM
Comment #6
icecreamyou commentedYou're probably forgetting to refresh the theme registry and views cache after changing your theme template. It's not particularly complicated stuff once you get used to it but I don't have the time to explain it to you when there are already several tutorials out there explaining how to do it. The #drupal channel on IRC is also always a good place to get fast help.
Comment #7
angelmax commentedThanks IceCream,
but I have the DEVEL module up and running with "re-build theme registry at each page load" on and, I have tried serveral times to clear the cache. Anyway i will follow your advice regarding the IRC channel.
- - -
Trying to find a solution to the issue raised in this thread I managed to modify the "actvity/all" view provided with VIEWS 2.
Knowing that FBSS provide a field for "cross-posting" I would think I could grab this value in a view.[...].tpl and decide if the UPDATE operation is a User Status Update or a Message Left on another user.
But I get a SQL error.
This is the View:
- - - Start - - -
$view = new view;
$view->name = 'all_activity';
$view->description = 'All activity on a site.';
$view->tag = 'activity';
$view->view_php = '';
$view->base_table = 'activity';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'uid' => array(
'label' => 'User',
'required' => 0,
'id' => 'uid',
'table' => 'activity',
'field' => 'uid',
'relationship' => 'none',
),
'users' => array(
'label' => 'FBSS Users',
'required' => 1,
'id' => 'users',
'table' => 'facebook_status',
'field' => 'users',
'relationship' => 'uid',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('fields', array(
'message' => array(
'label' => 'Activity:Message',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'message',
'table' => 'activity_messages',
'field' => 'message',
'relationship' => 'none',
),
'created' => array(
'label' => 'Activity Creation Date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'created',
'table' => 'activity',
'field' => 'created',
'relationship' => 'none',
),
'op' => array(
'label' => 'Operation',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'op',
'table' => 'activity',
'field' => 'op',
'relationship' => 'none',
),
'type' => array(
'label' => 'Type',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'type',
'table' => 'activity',
'field' => 'type',
'relationship' => 'none',
),
'pid_extra' => array(
'label' => 'Cross-Posting',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'pid_extra',
'table' => 'facebook_status',
'field' => 'pid_extra',
'relationship' => 'users',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'activity',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 25);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'activity/all');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
- - - End - - -
and this is the error:
- start -
* user warning: Column 'uid' in on clause is ambiguous query: SELECT COUNT(*) FROM (SELECT activity.aid AS aid FROM MYAPP_activity activity LEFT JOIN MYAPP_users users_activity ON activity.uid = users_activity.uid INNER JOIN MYAPP_facebook_status facebook_status_users ON uid = facebook_status_users.uid INNER JOIN MYAPP_facebook_status facebook_status_users_1 ON uid = facebook_status_users_1.uid INNER JOIN MYAPP_activity_targets activity_targets ON activity.aid = activity_targets.aid AND activity_targets.uid = 0 INNER JOIN MYAPP_activity_messages activity_messages ON activity_targets.amid = activity_messages.amid LEFT JOIN MYAPP_activity_targets activity_personal_targets ON activity.aid = activity_personal_targets.aid AND activity_personal_targets.uid = 1 LEFT JOIN MYAPP_activity_messages activity_personal_messages ON activity_personal_targets.amid = activity_personal_messages.amid ) count_alias in /var/www/html/vhosts/alpha/sites/all/modules/views/includes/view.inc on line 739.
* user warning: Column 'uid' in on clause is ambiguous query: SELECT activity.aid AS aid, COALESCE(activity_personal_messages.message, activity_messages.message) AS activity_messages_message, activity.created AS activity_created, activity.op AS activity_op, activity.type AS activity_type, facebook_status_users.pid AS facebook_status_users_pid FROM MYAPP_activity activity LEFT JOIN MYAPP_users users_activity ON activity.uid = users_activity.uid INNER JOIN MYAPP_facebook_status facebook_status_users ON uid = facebook_status_users.uid INNER JOIN MYAPP_facebook_status facebook_status_users_1 ON uid = facebook_status_users_1.uid INNER JOIN MYAPP_activity_targets activity_targets ON activity.aid = activity_targets.aid AND activity_targets.uid = 0 INNER JOIN MYAPP_activity_messages activity_messages ON activity_targets.amid = activity_messages.amid LEFT JOIN MYAPP_activity_targets activity_personal_targets ON activity.aid = activity_personal_targets.aid AND activity_personal_targets.uid = 1 LEFT JOIN MYAPP_activity_messages activity_personal_messages ON activity_personal_targets.amid = activity_personal_messages.amid ORDER BY activity_created DESC LIMIT 0, 25 in /var/www/html/vhosts/alpha/sites/all/modules/views/includes/view.inc on line 765.
- end -
that's another dead-end. Do you have idea how I could fetch the "cross-posting" flag for an activity / FBSS without incurring in this?
thanks again.
AM
P.S.
trying #drupal... nobody online? (EDIT: my fault. found the right server)
Comment #8
icecreamyou commentedI don't have the slightest idea. I can't provide support for you if you want to get that in-depth, but you shouldn't be theming your View for that anyway.
Comment #9
icecreamyou commentedThe two bugs discovered in this issue have now been fixed in CVS.
Comment #10
angelmax commentedThanks IceCreamYou for this,
I really appreciate it.
I can confirm that
1) Now the Poster sees the POSTER template activity message when is leaving a message to another user
2) The status time is the correct time and not "a moment ago".
Still, since I am not able to ovverride the them function I have this last inconsistency:
when USER A leave a message to USER B,
USER A sees the POSTER message = OK
USER B sees the OWNER message
all other users see the PUBLIC message
when USER A updates its own status,
USER A sees the SELF message = OK
all other users see the PUBLIC message
So if you set the PUBLIC message to be __ [status-time] [poster] said to [owner]: "[status-unformatted]" ___
it is going to suit the case of USER A messaging to USER B
but not the case of USER A updating the status.
and,
if you set the PUBLIC message to be ___ [status-themed] __
it is going to suit the case of USER A messaging to USER B
but not the case of USER A updating their status because it reads just the status message without "USERNAME said: STATUS message".
I cannot ovverride the themed-status, I cannot provide a conditional message for either the "user->user" or "user updates itself" and I am left with incosistent messages printed to different users.
I hope somebody has some hints about this.
Thank you.
AM.
Comment #11
icecreamyou commentedHmm. I hadn't thought about it that way before -- I understand what you mean now. Unfortunately the only real solution to that is via theming, although there might be a way to override the Activity form and public template. I'm going to leave this issue at "fixed" for now, but if I figure out a way to make this simpler I will come back and update it to let you know.
Comment #12
angelmax commentedI really would be willing to help. I can devote some time to this. Let me know, even privately, if I can do anything to help.
thanks.
AM.
Comment #13
icecreamyou commentedI figured out how to do it and the code is in CVS now. It slows down recording Activity messages a little, but I've contacted the maintainers of Activity to try to find a way to do it without the overhead.
Cheers!
Comment #14
angelmax commentedDear Ice,
I was so excited when I downloaded and installed the code in CVS.
In fact now the issue reported above, the one about having different messages for SELF and PUBLIC, is fixed.
Unfortunately I updated the live production server only to discover a new issue... now when a user CREATE any type of content the PUBLIC message related to the ACTIVITY TEMPLATE for PUBLIC is ignored. Instead the FBSS "Public message (self-update)" gets published!
I tried to remove the FBSS ACTIVITY TEMPLATE and nothing changes. If I create again a new node the other users are still getting the FBSS "Public message (self-update)", which I had deleted!
I am using:
* facebook_status from the CVS taken a couple of hourse ago
* Activity 6.x-2.x-dev the latest available now.
Please advice if this is an ACTIVITY issue or a FBSS issue and if I can help by providing further information.
Cheers,
AM
Comment #15
angelmax commentedMore info:
a) Tested the previous Activity 6.x-2.x-dev (2009-09-23) and FBSS CVS with only one template for INSERT NODE. The issue in #14 is not happening. Both AUTHOR and PUBLIC messages are showing correctly
BUT I get this error
user warning: Unknown column 'language' in 'field list' query: SELECT language, amid FROM activity_targets WHERE uid = 0 AND aid = 1 in /var/www/sites/all/modules/facebook_status/facebook_status.module on line 356.
b) With Activity 6.x-2.x-dev (2009-09-23) and FBSS CVS if I CREATE a NEW ACTIVITY TEMPLATE for Facebook status I get the WHITE SCREEN OF DEATH.
I am stuck again...
AM.
Comment #16
icecreamyou commentedOkay, a few things.
You have to be using the very latest version of Activity 2 for this to work. The latest dev build of Activity 2 added a new system for supporting languages, and FBSS assumes that system exists.
Also, I made a mistake in the version of FBSS that you grabbed from CVS: I forgot to check whether the Activity message was from FBSS before switching the template. I fixed that almost immediately after the CVS commit but I haven't committed the fix yet because I'm working on a few other things that could potentially break FBSS also.
However, I've been talking with the Activity maintainer, and he says it would be easier just to split the FBSS Submit trigger/activity template into two parts: one for self-posting and one for posting on other users' profiles. I'm hesitant because it seems counter-intuitive to me, but that seems to be what you expected from the beginning. Would that format make sense to you? Also, I'm adding triggers for editing and deleting statuses. Would it make sense to split those too?
I do have everything working as-is, but it's a question of clarity from the interface as well as clarity and speed of the code.
Comment #17
angelmax commentedHello Ice,
thanks for this series of prompt and substantial contributions. I start to feel that I couldn't make it without you.
I was eagerly following the developments also in the Activity Issues and I saw your question. I would have no problem in managing the two in a split fashion as far as each trigger / template does exactly what it is intended to do. I am developing a quite sophisticated private community where, you guess, the only "social" way of interacting is the means provided by your module. So, yes, I need I fine and efficient control of every bits managed and printed by FBSS, the more I can control it the better. If somebody has to suffer between the developer (me) and the users I definitely choose me.
That said, I am a developer too and I like beautiful and elegant solutions so I am following your questioning. It does not seem counter-intuitive to me but what do you feel would not be clear is this possible solution?
Instead of having the actor as a discriminating point you would have actions as different events to manage. This does not disturb me, as I just wrote, if it gives me flexibility and the power to do what my users want: is more than fine.
Maybe, once the module is working following these requirement we can think about the most appropriate user interface in terms of admin / back-end / settings, etc.
Thanks again for this long, interesting, engaging contribution to this wonderful module, let me know if I can help you in any way.
Ciao,
AM.
Comment #18
icecreamyou commentedThanks for your feedback.
The part that felt unclear to me was that if I as a site administrator to go the Activity templates page, I think "I'm going to add a template for when a user edits a status." It doesn't immediately occur to me that there could be two different kinds of editing a status based on where the status was posted. On the other hand, once I go to the template creation screen and it shows me a list of triggers with descriptions, the distinction may become clear.
In terms of flexibility, both methods would offer exactly the same functionality. Having a single trigger would be slower and the code would be more difficult to follow, but it has the advantage that all of the templates are in the same place. Having two triggers for each event would be faster and the code would be clearer, but it requires that the administrator makes the mental connection that there is a distinction made based on where the event occurs. (Also, combining the UI once there are two triggers is much more complicated than I want to get into.)
I will try to find some time to work on this stuff today and hopefully have working code in CVS tonight. I'll probably end up splitting the triggers.
Comment #19
icecreamyou commentedCommitted the fix for the problem you encountered.
Comment #20
angelmax commentedHi Ice,
I just installed the CVS'.
Now I am able to create a new activity template and I am presented with these choices:
Facebook status Triggers: *
fbss_deleted: A status has been deleted.
fbss_edited: A status has been edited.
fbss_submitted: A user has saved a status.
Please choose when you would like to record a message.
If I select "fbss_deleted: A status has been deleted." or "fbss_edited: A status has been edited.":
i get:
------------
(ERROR) Available Activity Types field is required.
Available Activity Types: *
Comment
Node
User
Facebook status
Please choose which type of activity you would like to record.
--------------------
If I select "fbss_submitted: A user has saved a status."
I get the White Screen Of Death.
I am using:
Drupal 6.13
Activity 6.x-2.x-dev (the latest)
FBSS CVS (the latest)
So I cannot even configure an activity template to use FBSS.
Let me know if I can provide further information to help.
thanks.
AM
Comment #21
angelmax commentedNo, it's not true.
I was using: Activity 6.x-2.x-dev (2009-Sep-23)
I will update it and will let you know how it goes.
Thanks.
AM
Comment #22
angelmax commentedSorry for my wrong statement at #20.
Updating Activity now FBSS seems to be working exactly like I need it.
Will test it more deeply.
Thank you Ice.
AM
Comment #23
angelmax commentedHello Again,
I just wanted to tell you that with the latest CVS version of FBSS I've got exactly the behavior I was needing.
Thanks to IceCreamYou for the crucial support. He is an excellent developer: quick, available and reliable.
Thank you Ice.
AM
Comment #24
icecreamyou commentedNo problem, I'm glad it's working for you!
Comment #25
pribeh commentedCool, I was looking for a solution for this. Yes, I agree, Ice is one of the most dependable developers I've ever seen grace the likes of Drupal.org