Jump to content

IPS Rules Application

Featured Replies

got to be something like an email sent out to remind them and whatnot anything that might wake up members that are inactive

  • Replies 575
  • Views 53.7k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • CoffeeCake
    CoffeeCake

    Perhaps it's time to open source the code and throw it up on Github for others to help maintain going forward?

  • Adriano Faria
    Adriano Faria

    You, me or even IPS can’t take ownership of other people's work. IPS is doing the only thing they can do: forbid the download and new purchases to try to minimize the damage for others.  If this

  • Hi @Kevin Carwile, I just downloaded and installed the IPS Rules Lite and actually see the functionality behind IPS Rules.  Some immediate feedback: 1) You have, hands-down, the cleanest and most educ

Posted Images

@Kevin Carwile, how can I create a condition, if a file has been attached to a forum post ?

Thanks 

  • Author
 

@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 by Kevin Carwile

Thank you! I'll tinker with this.

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.

 

 

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.

 

 

Yes, it will work.

Nice use!

Edited by chilihead

 

Yes, it will work.

Don't suppose you've already cooked something up have you? :smile:

I've been trying to work it out without much luck.

  • Author
 

Don't suppose you've already cooked something up have you? :smile:

I've been trying to work it out without much luck.

No. But what have you got?

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)

 

 

 

  • Author

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.

  • 2 weeks later...

Editing an administrative profile field using the edit profile form on a member's profile (front not ACP) doesn't save.

  • Author

What version of IPS4?

 

What version of IPS4?

4.1.7

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 by Colonel_mortis

  • Author

What tables dont have indexes? Which queries are slow? 

 

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.

  • Author
 

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?

 

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.

  • 4 weeks later...

Is there a demo site I can access to evaluate this solution?

 

cheers 

  • Author
 

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.

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?

 

 

  • 2 weeks later...

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?

  • Author
 

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.

Recently Browsing 0

  • No registered users viewing this page.