- Rule options
- Rule parameters
- A Regular Expression Usage Case
- A practical case: Two Channels and Two Categories
- How to create Rules for content in different Languages
- How to create Rules for content in different Access Levels
- Advanced Rules: Engine Mode "Posting to selected channels only."
- Frequently asked questions
You can access this feature by clicking on Activities, Rules in the toolbar area.
If you are looking for a way to publish or not content from some categories, most plugins have a "Filter" to define included/excluded categories. Firstly, check the associated plugin for the "Filter" tab, to filter by category. Moreover, this option avoids any further processing, not generating new requests.
Out of the box, Perfect Publisher is set up to publish Posts into all Social Channels. However, this is not what most users would like. These are some classic examples:
- Only publish posts from specific categories
- Publish messages to specific channels
- Conditional publishing, for example, publish posts containing some keywords
Some cases can be solved just with a filter at the content plugin level. In this section, we present solutions based on rules.
Rules allow selecting plugins and channels to post by category, text terms, author and more. Rules are only needed when you will do particular posts. If you will post messages to all channels, there is no need to add rules.
The rules engine works processing requests from the list to create posts when they are on the way to the social channels.
- New: operation to create a new rule.
- Edit: a rule can be edited to modify its attributes.
- Publish / Unpublish: operations to either publish or unpublish rules. Unpublished rules are not executed.
- Copy: a rule can be copied to be duplicated. For example, to create a similar rule for each channel.
- Delete: a rule can be deleted to avoid any further processing.
# Rule options
Each rule has the following options:
- Rule name *: only informational.
- Source *: which integration plugin this rule applies.
- Channel: in which channel this rule applies. If empty (the "- Select -" pseudo-option of the channel list), it applies to all channels.
- Type *: rule type to be applied in the execution.
- Condition: some rule types require an additional parameter. For example: category: IN requires a list of category IDs 11,22,33,44.
- Only featured: this filter allows restricting the rule to featured content.
- Status: Published/Unpublished
# Summary of rule types
# Rule types for content attributes
The following rule types are executed only if the article attribute is either included or not in the associated list of values.
- access: IN
- access: NOT IN
- author: IN
- author: NOT IN
- category: IN
- category: NOT IN
- language: IN
- language: NOT IN
- featured: IS
- featured: IS NOT
- media: HAS
- media: HAS NOT
# Text-matching rules
These rule types are oriented to solve cases where a word or sentence has to be matched to execute the rule:
- term: AND: apply when ALL terms from the list are included in the message text
- term: NOT IN: apply when NONE of the terms from the list are included in the message text
- term: OR: apply when ONE of the terms from the list is included in the message text
- word term: AND: apply when ALL words from the list are included in the words from the message text
- word term: NOT IN: apply when NONE words from the list are included in the words from the message text
- word term: OR: apply when ONE words from the list are included in the words from the message text
- regular expression match: apply when a match to the given regular expression is found in message text
# Perfect Publisher PRO rule types
- channel scope: IS Site: rule to be applied to site channels
- channel scope: IS User: rule to be applied to user channels
- channel owner: IN Group: rule to be applied to channels owned by a user of certain groups
- channel owner: NOT IN Group: rule to be applied to channels not owned by a user of certain groups
# Special rule types
- catch all: always apply the rule for the detailed plugin and channel
- catch all not fits: apply the rule when there is no matching rule for the plugin
# Rule parameters
These are the parameter that can be controlled and modified by a rule.
# Override Settings
- Auto publish: to choose if the message has to be auto-published (Yes) or not. If not, Off sends the Posts to Pending state, waiting for manual publishing, or Cancel to prevent further processing.
- Show URL: to choose if the Url has to be included or not in the message, and where, beginning of message or end of message.
# Rule Message Control
Message format: a pattern to customize how the message is created. These tags can be implemented in a message pattern:
[xxxxx,99]: it is a special operator to restrict the length of title, text, or fulltext. For example: [introtext,45]
# Message format examples
[message] / #Joomla! - [fulltext,60]
Extly: [introtext,45] #Joomla! #Perfect Publisher [maincat]
# Add Static Text
Static text can be introduced, or removed if it was previously introduced, in the message.
- Show static text: to choose if the message has included a static text (beginning of message or end of message) or not (Off).
- Static text: a static text that is inserted into the message. You can use this also for hashtags.
# Text replacement
This is one of the most powerful Perfect Publisher features. It provides a flexible way to replace strings in the message
- Regular expression: enter a regular expression to remove or replace parts of the message text. PHP preg_replace function is used. The expression can be a JSON array.
- Replacement text: Enter the replacement text for the regular expression. PHP preg_replace function is used. If the field is empty, the text parts are removed from the message text.
Reference: Regular Expressions (Perl-Compatible) (opens new window)
# Text replacement Example 1
The word perfectpublisher is always replaced with #PerfectPublisher, ignoring case.
# Text replacement Example 2
Similar to the previous example, but for two words:
# A Regular Expression Usage Case
For example, a regular expression to create hashtags:
# Regular expression
# Replacement text
- Regular Expressions (Perl-Compatible) (opens new window)
- Regular Expression Test Page (opens new window)
# A practical case: Two Channels and Two Categories
In this case, the rules help to route the content between two channels. Each channel must receive and publish only the articles from its associated category.
# The Case
Article: A new article for Channel 1
Category: 81 - Category for Channel 1
Channel Test Mail Channel 1
Article: A new article for Channel 2
Category: 82 - Category for Channel 2
Channel: Test Mail Channel 2
By default, Perfect Publisher broadcasts the content Requests to all Channels. So, the rules must publish the articles from a category to its channel and discard everything else received in the channel.
- Rule 1: Channel 1 - Category: 8
- Rule 2: Channel 2 - Category: 9
- Rule 3: Channel 1 - Catch all / Cancel
- Rule 4: Channel 2 - Catch all / Cancel
The final result and the rules can be checked in the following screenshots:
# Processed Posts
The post for Channel 1 was successfully processed, and the post for Channel 2 was canceled:
# Rules created for two excluding channels
# Rule for Channel 1 and a specific category
# Rule for Channel 2 and a specific category
# Rule for Channel 1, to cancel everything else
# Rule for Channel 2, to cancel everything else
In case you are wondering if there is a way to avoid the "canceling" rules, YES, there is. You can enable DENY ALL mode (opens new window). In this mode, no post will be published unless you define specific rules to publish posts.
# How to create Rules for content in different Languages
In this example, we will show how to set up two rules, one for each language, to show the power of the Rules. In this way, for example, you can define a channel for Twitter in Spanish, Facebook in English, and LinkedIn for all the site languages:
- A rule for Articles in English (en-GB)
- A rule for the rest of the languages (In Joomla! terms: "*" or "all")
These are the rules:
# A rule for Articles in English
# A rule for the rest of the languages
The DENY ALL (opens new window) mode can be enabled to avoid the processing of other languages content, .
# Processing results
When we publish articles in different languages, they are routed according to the selected language.
# How to create Rules for content in different Access Levels
In this example, we will show how to set up two rules, one for each access level. For instance, you can define a Public Channel to publish news to a Facebook page and a Members Only Channel:
- A rule to publish Public Articles
- A rule to publish "Members Only" articles
In this case, the DENY ALL (opens new window) mode must be enabled.
These are the rules:
# A Rule for "Members Only" Content
# A Rule for Public Content
When articles are published by different access levels, they are routed according to the target audience.
# Rule to cancel publication of Special-Level Articles
# Advanced Rules: Engine Mode "Posting to selected channels only."
By default, the rule engine works in ACCEPT ALL mode, accepting all posts and applying specific rules to the source-channel combination.
On the other hand, if you want to publish content under particular conditions, more content has to be canceled than published. In this case, DENY ALL is the most convenient option.
The advanced mode DENY ALL works in the other way, rejecting all and accepting only rule-specific posts. A rule must be created to publish content in a source channel.
# Deny All Mode configuration
In Control Panel / Options / Advanced / Rule Engine Mode:
# Frequently asked questions
For more information, visit the Frequently Asked Questions (opens new window).