Posted by Waverlymain1 on January 5, 2013 at 3:54pm
I was wondering if there is a way to set an event timer to work on the back end?
Meaning that when Billy Bob creates a new article or comments on something, the timer will then start a countdown to when Billy Bob can create another article or comment on someone else’s article.
Not really concerned about the timer being visible or not.
Trying to keep members from basically spam bumping their own content or buddies spam bumping each other (lol that almost sounds wrong). Set everything to like a 12 hour cool down.
I am using Drupal 7.18
Sorry if I posted this in the wrong area, really was not sure where to post a question like this.
Thank You
Comments
Rules module
I would use the Rules module for this.
I would create a role for people who are allowed to comment, let's called it "Commenter" and give it to all users. Then add a field to the User entity to hold a date and time (let's call it "Last Comment"). Then you can set a rule to update that field after a user posts with the current date and time and also remove the Commenter role.
Then set another rule to give the Commenter role back, by checking on an event like page view, or login or whatever if the date and time stored in Last Comment is more that 12 hours ago. If so, assign the Commenter role.
Probably a lot of ways to do it but that's one idea.
Thank you for being very detailed with your reply
Thank you for a reply back and thank you for being very detailed with your reply.
Going to go try that now…
I’m no pro at web development and I have been using Web expressions to create my sites over the last year or and combining so some sites with SMF.
I looked at a lot of different ways to create websites over xmas (trying to be more professional looking) and I chose Drupal. It really seems to be very user friendly and offers a ton of support and mods. It’s just being new little things like what I want to do with setting a countdown timer like this is just hard to figure out when you’re a newbie like me, unless some great person makes a mod for it,lol.
Thank you again for your input; you made a Stay @ Home Dads day a little bit easier.
2013 NEW YEARS Resolution:
1-Delete all my websites and start over with only 2-3 and a goal in mind.
2-To actually try and make some money from at least 1 of the 67 domain names (which when I bought each one I really believed in my gut that it would be the next Facebook or amazon, lol) I bought over the last 2 years
3-Find a trust worthy web partner and make some money instead of just talking about it…
Two great minds are by far much more profitable than one.
Rob
42 Year Old Stay @ Home Dad in Sunny Southern California...
Ok I have it set and is
Ok I have it set and is working as far as when the user creates and post new content that it removes them from their current role.
I am having a hard time getting it to promote them back to their original role after a set amount of time. Below is what my settings look like from the rules screen, by looking at the below info is anyone able to tell me what I have set wrong ?
EVENT OPERATIONS
After saving new content
ELEMENTS OPERATIONS
Entity has field
Parameter: Entity: [site:current-user], Field: field_last_comment1
User has role(s)
Parameter: User: [site:current-user], Roles: Commenter, Match roles: any
ELEMENTS OPERATIONS
Save entity Parameter: Entity: [site:current-user], Force saving immediately: true
Remove user role
Parameter: User: [site:current-user], Roles: Commenter
Calculate a value
Parameter: Input value 1: [site:current-user:field..., Input value 2: 3 min
Provides variables: Calculation result (result)
Can you click on export next
Can you click on export next to your rule(s) and paste the result here?
{ "rules_timer" : {
{ "rules_timer" : {
"LABEL" : "Timer",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "comment" ],
"ON" : [ "node_insert", "comment_insert" ],
"IF" : [
{ "entity_has_field" : { "entity" : [ "site:current-user" ], "field" : "field_last_comment1" } },
{ "user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "4" : "4" } },
"operation" : "OR"
}
}
],
"DO" : [
{ "entity_save" : { "data" : [ "site:current-user" ], "immediate" : 1 } },
{ "user_remove_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "4" : "4" } }
}
},
{ "data_calc" : {
"USING" : {
"input_1" : [ "site:current-user:field-last-comment1" ],
"op" : "+",
"input_2" : 180
},
"PROVIDE" : { "result" : { "result" : "Calculation result" } }
}
}
]
}
}
Thank you for any help you can give me with any of this. :)
looks good. The only problem
looks good. The only problem is that once you have calculated that result (the last action) you don't assign it it to the field_last_comment1 field. You used it as an input for the calculation, but that does not save the result back in the field. It just gives you a new variable called "result".
So after that action, you need another one "Set a data value". and set field_last_comment1 equal to result.
After that, you'll need another rule to give the role back if field_last_comment1 is less than the current time.
Thank You
Thank You for the help, Sorry for the day or so delay and replying back. Had to go AFK.
I am going to try this again here soon after lunch. I will reply back with a big thumbs :)... (I'm hoping)