EmpireKicking Posted February 20, 2016 Posted February 20, 2016 got to be something like an email sent out to remind them and whatnot anything that might wake up members that are inactive
Sull5 Posted February 22, 2016 Posted February 22, 2016 @Kevin Carwile, how can I create a condition, if a file has been attached to a forum post ? Thanks
Kevin Carwile Posted February 23, 2016 Author Posted February 23, 2016 (edited) 11 hours ago, Sull5 said: @Kevin Carwile, how can I create a condition, if a file has been attached to a forum post ? Thanks That's not so easy. But I'll give you the solution anyway in case you are the adventurous type. The attachments aren't actually "attached" until after the content created/updated events have happened (internal ips workflow thing). So you can't check the condition on a rule attached directly to one of those events because the attachment won't actually have been claimed yet. Also, there is no stock condition to check if a topic or post has an attachment, so it would require a custom php snippet to do that. So... for the solution: You need to first create a custom action which you will trigger from a rule when the content is created/updated and set the action execution to wait until the end of the page load so that the "attachment" can be processed before your custom action is actually fired. And then you would check the condition in your custom action rule. The custom php code portion of the condition would look like this (this means you need to add an argument to your custom action called "Content", which would either be a content item class or a content comment class, and would make $content available to your custom php code): /** * If content being checked is a topic/item, check if any post has an attachment */ if ( $content instanceof \IPS\Content\Item ) { $locationKey = $content::$application . '_' . ucfirst( $content::$module ); return (bool) \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( 'location_key=? AND id1=?', $locationKey, $content->activeid ) )->first(); } /** * If content being checked is a post, see if it has an attachment */ else if ( $content instanceof \IPS\Content\Comment ) { $item = $content->item(); $locationKey = $item::$application . '_' . ucfirst( $item::$module ); return (bool) \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( 'location_key=? AND id1=? AND id2=?', $locationKey, $item->activeid, $content->activeid ) )->first(); } return FALSE; Edited February 23, 2016 by Kevin Carwile
NoGi Posted February 28, 2016 Posted February 28, 2016 Does this work with Adv Tags and Prefix? I use that in my sales forum and have a prefix that is SOLD. I'd like the topic to close if the prefix is changed to that. chilihead 1
chilihead Posted March 1, 2016 Posted March 1, 2016 (edited) On 2/28/2016 at 4:30 PM, NoGi said: Does this work with Adv Tags and Prefix? I use that in my sales forum and have a prefix that is SOLD. I'd like the topic to close if the prefix is changed to that. 5 minutes ago, Kevin Carwile said: Yes, it will work. Nice use! Edited March 1, 2016 by chilihead
NoGi Posted March 1, 2016 Posted March 1, 2016 10 minutes ago, Kevin Carwile said: Yes, it will work. Don't suppose you've already cooked something up have you? I've been trying to work it out without much luck.
Kevin Carwile Posted March 1, 2016 Author Posted March 1, 2016 1 minute ago, NoGi said: Don't suppose you've already cooked something up have you? I've been trying to work it out without much luck. No. But what have you got?
NoGi Posted March 1, 2016 Posted March 1, 2016 I'm stuck on the how to check for the prefix as being sold Rule: Auto close on sold items Disabled Event: Topic has been created or updated Conditions: Content attribute values (Check for SOLD prefix) Actions: Lock content (Close Topic)Rule: Auto close on sold items Disabled Event: Topic has been created or updated Conditions: Content attribute values (Check for SOLD prefix) Actions: Lock content (Close Topic)
Kevin Carwile Posted March 1, 2016 Author Posted March 1, 2016 Try creating a custom action to check for the sold prefix on the topic and close it, and then trigger that custom action from your rule when a "topic has been created or updated". And make sure to set the action execution to the "end of page load" setting. I believe the problem you are having is because of a timing nuance. When the topic is created/updated with new tags, then the event actually happens before the tags are saved to the topic in core processing.
Colonel_mortis Posted March 9, 2016 Posted March 9, 2016 Editing an administrative profile field using the edit profile form on a member's profile (front not ACP) doesn't save.
Colonel_mortis Posted March 13, 2016 Posted March 13, 2016 On 09/03/2016 at 7:29 PM, Kevin Carwile said: What version of IPS4? 4.1.7
Colonel_mortis Posted March 19, 2016 Posted March 19, 2016 (edited) If dev mode is enabled, the app breaks the site because an E_NOTICE is emitted by line 435 of your ipsPatternsActiveRecord hook (__set) when you try to get an undefined index from _data (because it's being set for the first time). You should probably add an array_key_exists or isset check there to prevent that error. Also, can you add some indexes to the Rules tables? The queries are currently fairly slow, and adding an index should help quite a lot. Edited March 19, 2016 by Colonel_mortis
Kevin Carwile Posted March 19, 2016 Author Posted March 19, 2016 What tables dont have indexes? Which queries are slow?
Colonel_mortis Posted March 19, 2016 Posted March 19, 2016 1 minute ago, Kevin Carwile said: What tables dont have indexes? Which queries are slow? rules_rules doesn't have any indexes, and is queried a few times with where parameters.
Kevin Carwile Posted March 20, 2016 Author Posted March 20, 2016 8 hours ago, Colonel_mortis said: rules_rules doesn't have any indexes, and is queried a few times with where parameters. I see. So how many rows do you have in your rules_rules table?
Colonel_mortis Posted March 20, 2016 Posted March 20, 2016 8 hours ago, Kevin Carwile said: I see. So how many rows do you have in your rules_rules table? Actually, never mind, turns out I was looking at the wrong column, and it is taking an insignificant amount of time. Sorry about that.
VR6Pete Posted April 14, 2016 Posted April 14, 2016 Is there a demo site I can access to evaluate this solution? cheers
Kevin Carwile Posted April 14, 2016 Author Posted April 14, 2016 2 hours ago, VR6Pete said: Is there a demo site I can access to evaluate this solution? cheers The lite version of the app is available as a free download. No demo site except your own. VR6Pete 1
VR6Pete Posted April 15, 2016 Posted April 15, 2016 Ah great, ive installed this lite version now... looks great! Have downloaded the example rules and trying to set up member engagement. Looking at Scheduled Actions I see Send a re-engagement email to the member listed 5 times. Is this normal behavior?
Kevin Carwile Posted April 15, 2016 Author Posted April 15, 2016 If it is for 5 different members, yes. VR6Pete 1
Jesse Rapczak Posted April 30, 2016 Posted April 30, 2016 Hi Kevin, I'm using the forms app with your Rules app and I'm trying to come up with a way to not let a user submit a form unless it checks the currently logged in member for my 'steamid' variable and only lets them submit it when it finds that the steamid isn't 0. Any ideas?
Kevin Carwile Posted April 30, 2016 Author Posted April 30, 2016 8 minutes ago, Jesse Rapczak said: Hi Kevin, I'm using the forms app with your Rules app and I'm trying to come up with a way to not let a user submit a form unless it checks the currently logged in member for my 'steamid' variable and only lets them submit it when it finds that the steamid isn't 0. Any ideas? Not really possible I dont think. You can perform the check after the form is saved, but you can't do on the fly form validation like that.
Recommended Posts