With the new beta release of Statuses (thanks for the great and hard work), I'm trying to record activity using the Message module.

Message uses Rules to create the activity messages and here is where I'm so confused.

When a user updates a Status via Statuses module the "User saves a status" is triggered. Then I create a new Entity of type Message via Rules. I want to this message render the status just created but I can't do it...

If statuses was an entity, I can add a new field to the message relating the message with the status. Then I have the message related with the status and then work good with this. It can't be done for now as Statuses are not entities.

I can't acces to the text content of the status in order to print it in the message. If I can, this is not useful because the status functionality (comments, tags, etc) will not work.

I think it best to render the status like on status streams in order to preserve the whole functionality of Status module.

Someone is trying to do this?? How can be it done?

Thanks in advance

Comments

eidoscom’s picture

eidoscom’s picture

The only way is to Statuses be an Entity...

So I applied the patch here and try to do this. The Rules engine is detecting status as an entity, and the Entity Reference module also do that.

It's good as now I can define a new field (Entity Reference) in the Message referencing a Status entity. So I go to Rules and try to do the Message logging. When I try to make the action of "set a data value" in order to set the status the referenced entity in Message, I can't access to the token list ....

If I try to do the action of Load Status and neither access to token list... Perhaps is also related to this issue #1255648: Rules integration is broken ?? Or perhaps te recently reopened issue #1531976: Token integration is broken ??

IceCreamYou’s picture

Status: Active » Fixed

I was able to get it to work without applying the Entity patch or using the Entity or Entity Reference modules.

  1. Create a new Message Type and add a new Long Text field to it.
  2. Create a new Rule for the event User saves a status.
  3. Add a Create new entity action to the Rule for the Message entity type.
  4. Add a Set a data value action to the Rule with data [entity-created:field-text] (obviously change this to the field you added to your Message type) and value [status:status-themed] (or whatever you want here).
  5. Edit the Message Type to set the contents of the message to the relevant field, or change the Display settings for the message type to make sure the field shows up.
eidoscom’s picture

Hi here,

I can't access the status tokens as I said earlier. I did your recipe step by step and it only shows [status:status-themed] as I inserted manually...

I'm using the unstable version... are you working with dev version to try this??

Anyway I think that the Status must be referenced through some reference field or at minimum, saving the sid in an INT field of the message in order to let views or others to connect this two "entities". But It can be by now a great solution if the tokens are accesible by Rules.

Thanks

eidoscom’s picture

Sorry, I'm using the beta1 version

mathankumarc’s picture

Status: Fixed » Postponed (maintainer needs more info)

I could see that in couple of issues we got input that token integration is not working well with rules. If someone provides exact step to reproduce the issue will help. I will look into it anyway.

eidoscom’s picture

I think that I get the problem...

It seems that the tokens has not the correct data type. If I try to "Add a variable" action on a "User save a status" event I only have access to the tokens if the variable type is "Text". When the variable is text, all the tokens are showing but if I want to for example add an INT variable like sid ([status:status-id]) the tokens are not showing...

I don't know if it works as designed, but in my case, where I want to save the sid in a field of another entity for referencing, is necessary that store int values and not text values.

IceCreamYou’s picture

Title: Is possible to record activity via the Message module at the moment?? » Problems with Token integration with Rules

Renaming to more accurately reflect what this issue is actually about, given that I already showed Message integration is possible in #3.

IceCreamYou’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Marking this duplicate of #1693620: Problems with Token integration with Rules because it's the same root issue and there is the beginning of a patch there.

vinoth.3v’s picture

What about access control over tokens?
Because the tokenized value of [status:status-themed] is static?

If it would be an entity, access can be controlled.

I know it is not a right place to specify this.
Just a thought.