i have a content type and the possibility for logged in users to vote on it. there are 5 different fivestar votings (categories) on the node. now i want to add userpoints and wanted to ask if it is possible that when a user votes that he gets 1 point for every vote on a node, so 5 points if he votes in every category. he has the possibility to change the vote later, but then he shouldn´t get any points anymore. is this possible?
greets
While it doesn't look like there is an existing 7.x or 8.x module that accomplishes this, there are two ways you should be able to accomplish your goal:
Write a module. The Userpoints API is fairly well-documented and it should be possible to create a module to increment a user's userpoint count when a fivestar field is modified. To avoid duplication, note that this field looks like it should accomplish the de-duping you are looking for (assuming you set txn_id to some combination of the current node ID, field ID, and user ID:
'txn_id' => (int) Transaction ID of a current points record. If
present an UPDATE occurs
Use Rules. The userpoints module integrates with Rules, so you should be able to accomplish your userpoints use case without writing any code. According tho the Userpoints Rules integration notes, you can compare the current userpoints to the number of points before the transaction:
Compare Userpoints before the transaction
- This condition is used to compare the amount of userpoints the user had before the userpoints was added to/deducted from the user against a specified value.
- The 'Amount to compare' value is checked as >= (greater than or equal to) and the Negate checkbox will change the condition to < (less than) as it will be any value other than >=. If you would like to get an exact value, say 1, you can add two of the condition to use >= and < to specify one number. Simple math stuff here =)
I hope this helps. Let me know how it goes!
Related
What I wanted is to display an alert when I move to the next row if the record that I inserted is already one of the records in the multi record block.
and in what trigger must I put it?
There are several options you can use.
One is to POST values entered (in WHEN-NEW-RECORD-INSTANCE) trigger. It will, well, post everything you entered so far. Then, you can write a WHEN-VALIDATE-ITEM trigger which SELECTs from that table and checks whether such a value already exists. Alternatively, if there's the UNIQUE CONSTRAINT on that (those) column(s), database will do its job itself, i.e. raise an exception.
Another option is to literally loop through all rows in a block and compare the first row's value with all the others, then the second row's values with all of them, etc.
Or, you can use a Record Group (usually used for Lists of Values). Basically, you'd check whether value you entered exists in a record group. More info, along with a FMB file, on Craig's blog.
Or, you can use calculated items, as described enter link description here (FMB attached as well).
As you can see, quite a few ways to do that; explore each of them and pick the one you find the most useful / attractive / easy to implement.
I would like to define a field, where there is a list of allowed values as well as give user the option to type it in. For example, I list a bunch of previous jobs that the applicant can have, plus have them pick other and fill it in as well.
Is it possible to do this with one field or do I need two fields where the user has to type it in? Is there a doc. or sample or tutorial I can look up? Thanks.
Here is a super simple Tags sample:
https://drive.google.com/open?id=0BxtQI4fTAVQqcUx4OUJfQ1JYV2c
To cover your exact use case you just need to:
Add logic to check if record already exists
1.1 If record doesn't exist, then create one
Create relation between records
If you don't care about duplicates in your database, then you can skip step 1 and always do 1.1 and 2.
In a simple scenario there is a webpage with a datagrid containing 2 columns; first name and country. There's a filter set on the grid to filter out all Australians. There's a form on the same page to add new records and a user decides to add someone from Australia. This record does not meet the filter criteria so would not normally display. However, this might be confusing from the users perspective as they might not have confidence that the person has been successfully added or have forgotten that the filter will mean the new entry is not displayed.
What is the best way to handle this from a usability perspective?:
display the new entry but leave the list in a state inconsistent
with the filter criteria?
filter out the new entry but risk confusing the user?
provide feedback to the user that the record was successfully
added but may be filtered out of the list?
?
Three tools I use, Mingle, Jira, and Quicken, use this implementation very effectively; a slight modification to your number 3:
Provide feedback to the user that the record was successfully added, but won't be shown, and provide a link to the record using its record identifier (record number + title).
I have some nodes with a widget vote up/down. I can't understand how can i get integer votes value for various actions without sql requery. For example to hide nodes with rating < 10.
No matter what module you use,(Rate, Fivestar or anything else), all the data stored in Voting API module.
Using Rules module and VotingAPI Rules integration module you can check values of votes and take arbitrary(but possible) actions.
You may need to add new triggered rule on even "user votes on content" and check if the vote's value is < 10.
Voting API keeps data as a percentage so < 10 means < 10%. Vote count, value of each vote and percentage available as data.
(Also posted as http://drupal.org/node/596860)
I would like to create a view showing only those groups of which I am not already a member (or a pending member). However, the obvious way of doing this (take the og_my view and change the filter "Organic groups: Group member" to false) does not work.
The reason is that the SQL query essentially returns one row for every user in the group that matches your conditions. If you're searching for yourself (as in og_my), each group node will only show up once; if you're not searching for yourself, each group node shows up N times, where N is the number of other group members. Thus the groups of which I'm already a member continue to be displayed as long as there's at least one other member.
Does anyone have a way around this?
Thanks, Adrian
You may not be able to achieve this in Views directly as it does not support subqueries. My SQL came out like so:
SELECT node.nid AS nid, node.title AS node_title FROM node node LEFT JOIN og_uid og_uid ON node.nid = og_uid.nid WHERE (node.type IN ('campaign','setting','system')) AND node.nid NOT IN (select nid from og_uid where uid = 1);
It is said you can programmatically forward the results of such a query into the Views system for theming.
Maybe a special handling of the argument Organic Groups:Member of a Group, Exclude Argument option?
I also posted to d.o in hopes of pushing the issue conversation onward.
Wild. OG Views Extra was made available on d.o three days after your first revision of this question. I haven't used it, but looks just like it may do it.
So why install this module? If you need finer-grained control. The
available user options:
Not a Group Member
Group Member or Site Admin
Group Member Only