Closed (fixed)
Project:
User Points
Version:
8.x-1.x-dev
Component:
Code: userpoints
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2018 at 08:47 UTC
Updated:
5 Feb 2019 at 20:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
manuel.adanA new sub-module with example rules has been added. The example reaction rules provided by it are:
Someone else is needed to test it before committing!
Please, to do so:
You can edit the provided rules, for example, adding conditions to them or changing the amount of points granted, but note that provided rules (updated or not) are removed if the userpoints_rules sub-module is uninstalled.
Comment #3
socialnicheguru commentedHere is the error I get on login as user 1
https://test1.com/user/login|1||Drupal\rules\Exception\EvaluationException: The context for transaction is NULL, but the context transaction in transaction_execute requires a value. in Drupal\rules\Plugin\RulesExpression\RulesAction->prepareContext() (line 98 of rupal-8.5.1/html/modules/contrib/rules/src/Context/ContextHandlerTrait.php).
Comment #4
socialnicheguru commentedI goto my user/1 page
I click on a subtab and get the following:
a WSOD and in my logs:
TypeError: Argument 1 passed to Drupal\transaction\Entity\TransactionType::isApplicable() must implement interface Drupal\Core\Entity\ContentEntityInterface, string given, called in drupal-8.5.1/html/modules/download/transaction/src/Access/ApplicableTransactionAccess.php on line 112 in Drupal\transaction\Entity\TransactionType->isApplicable() (line 235 of drupal-8.5.1/html/modules/download/transaction/src/Entity/TransactionType.php)
Comment #5
manuel.adanHi SocialNicheGuru, thank you so much for your feedback on this.
I have been trying to reproduce the errors you reported, but I was unable to do it starting from a fresh Drupal 8.5.1 installation (standard profile). However, I found that the configured actions in the provided rules can not be edited, I got a 404 in URLs like:
/admin/config/workflow/rules/reactions/edit/userpoints_rules_earn_on_login/edit/
This doesn't affect to the rule application, I mean, users grant points on login or posting as expected, but it could be related with the errors you got.
About the first one:
here the execution action found an empty transaction context. The transaction entity should be created by the previous action, but it doesn't. It appears that, for some reason, it is not possible to create new user points transactions in your system with the default type. Did you alter (or delete) the default transaction type and fields provided by the userpoints_default module?
I need some other information in order to reproduce it:
- drupal version
- php version
- required modules version: typed_data, rules, dynamic_entity_reference & transaction
- full log entries on error
Comment #6
socialnicheguru commentedI recreated the site and it all seems to work just fine.
I don't know what it was.
It actually seems to be working just fine.
Comment #7
socialnicheguru commentedI am not sure if it is my setup for module but when I click on the reaction of any of the rules added here, I get a page not found
Comment #8
manuel.adanWhen trying to reproduce the issue described in #4, I noticed the same:
By adding some additional reaction, the existing one can be edited normally. it might be a rules issue, but I have to see it.
Comment #9
manuel.adanAs far I can see, rules stores in a single config entity the entire rule. This config entity has an UUID as usual that must be removed from the default configuration provided in userpoints_rules. However, each rule expression has also its own UUID that, unlike the entity UUID, it should be present in configuration.
By design, UUIDs are machine-generated identifiers that shouldn't be stored in any component code or default configuration. I opened an issue about this in the rules module queue, #2964770: Cannot edit reactions of imported rules from module config install
In the mean time, and considering that the purpose of the new submodule is to illustrate the rules integration, I added UUIDs values to provided rules expressions. With this change, the rule action edit links work.
Comment #10
socialnicheguru commentedI can now go and edit a rule
edit: admin/config/workflow/rules/reactions/edit/userpoints_rules_earn_on_content_post/edit/12126733-fa8e-4f1f-bca5-5729acbc8f11
which is
Home Administration Configuration Workflow Rules Edit reaction rule "Earn points for content added"
I only goto the bottom of the page and hit save, and I get this error:
Expected a entity data type for context Target entity but got a entity_reference data type instead.
Comment #11
manuel.adanThat's another rules issue. Such context selection is valid, validation works when creating new action but fails on edition. Issue post in rules: #2965726: Entity context fields fails on validation on update for entity reference
As a work around, the only affected reaction fetch first the user node author and uses this reference for the target entity context in the transaction creation rule.
Note that rules also requires to rebuild the cache after updating a rule to be applied.
Comment #12
manuel.adanAdded actions to set a reference to the reaction related entity. It can be tested with the latest -dev of the transaction module + patch from #2973989-2: Transaction type context refination in rules doesn't work.
Comment #13
socialnicheguru commentedDo you check to see if the userpoints can be applied to the content type ie. if field_userpoints_default_linkref is present?
I had this error come up automatically on save of a content type.
Here is the issue description
Unable to apply data selector '' at 'field_userpoints_default_linkref'
Comment #14
ohmdesbois commentedHello,
I tried to install the transaction dev version (with the
transaction-transaction_type_rules_context_refination-2973989-2.patchpatch) and the userpoints dev version (with thehttps://www.drupal.org/files/issues/2018-05-19/userpoints-basic_rules_examples-2956286-12.patchpatch), but I can't enable userpoints_rules becauseI hope this can help.
Thank you
Comment #15
socialnicheguru commentedI have problems with the field_userpoints_default_linkref field. (I closed the issue to just add it to this one since this patch is causing the problem).
on the DER page for the field_userpoints_default_linkref several of the fields have required values that are not filled in. Some have required values but no options available. (See the attached files).
I get the following errors:
http://mysite.com/node/add/my_polls|1||Drupal\typed_data\Exception\InvalidArgumentException: Unable to apply data selector 'field_userpoints_default_linkref' at 'field_userpoints_default_linkref':
Field field_userpoints_default_linkref is unknown. in Drupal\typed_data\DataFetcher->fetchDataBySubPaths() (line 100 of drupal-8.5.3/html/modules/contrib/typed_data/src/DataFetcher.php
Process:
I have enabled userpoints_default
I applied the userpoints_rules patch
I enabled userpoints_rules
I created a content type called poll with an entity reference to the poll entity (http://drupal.org/project/poll).
I hit save and got a white screen
I had to refresh my screen and the content type was saved but I do not think the userpoint was
I then went to the transaction type:
admin/config/workflow/transaction/edit/userpoints_default_points/fields/transaction.userpoints_default_points.field_userpoints_default_linkref
and I noticed that I had to select content types under the dynamic field options.
Some have no options available but still are required (redhen)
Comment #16
socialnicheguru commentedIf you use DER what happens once there is content in the system? I don't think you can modify this field at all.
Would a better approach be to modify the rule and only allow certain entities to execute it that way you don't have to worry about changing the DER field later?
Comment #17
manuel.adanThe reported issues in #15 and #16 seems to be caused by incomplete configuration in the link field provided by userpoints_default sub-module. Since it is not related to rules examples, I've opened a new issue for that: #3022258: Link field reference has incomplete configuration. Thank's @SocialNicheGuru for the feedback!
We are on the way of a first alpha release, latest patch needs be updated to accommodate to changes in the main module.
Comment #18
manuel.adanUpdated patch with 3 changes:
There are no changes in the provided configuration examples.
Comment #19
socialnicheguru commenteduserpoints_defaults is a requirement which also means that 'Article" type is needed.
Comment #20
manuel.adanDefault submodule is intended to be used as a starting point for almost any website. Dependency on node or comment is not really required, so I opened an issue to remove it: #3024998: Remove dependencies on node and comment modules in userpoints_default.
In rules example, we have now to ensure that the link entity reference field allows references to content and comment entities.
Comment #21
manuel.adanComment #22
manuel.adanTransaction 1.0-alpha4 released that provides the required rules integration. No other changes or issues reported, ready to commit.
Comment #24
manuel.adan