[groups_drip]
This shortcode is used to drip the content it surrounds based on certain time constraints.
Usage:
[groups_drip ...] ...Content to be dripped... [/groups_drip]
Parameters:
type
: ‘account’ (default), ‘groups’ or ‘fixed’group
: one or more group IDs or names separated by comma, used when type is ‘groups’from
: number indicating as of how many units of time the content will be shown, when type is ‘account’ or ‘groups’until
: number indicating until how many units of time the content will be shown, when type is ‘account’ or ‘groups’from_uom
: time unit, ‘seconds’, ‘minutes’, ‘hours’, ‘days’ (default), ‘weeks’, ‘months’ or ‘years’ – used as the time unit to evaluate thefrom
conditionuntil_uom
: used as the time unit to evaluate theuntil
conditionfrom_unit
: ‘yes’ or ‘no’ (default), if set to ‘yes’, thefrom
will evaluate to the start of the time unit, e.g. when used withfrom
set to ‘days’, the condition will be the start of the dayuntil_unit
: similar tofrom_unit
but for the end of the time unit, e.g. end of the dayfrom_datetime
: takes a date and time YYYY-MM-DD HH:MM:SS, used when type is ‘fixed’thru_datetime
: takes a date and time YYYY-MM-DD HH:MM:SS, used when type is ‘fixed’user
: if a user ID or user login is provided, the shortcode is evaluated for that particular user instead of the current user (alternatively you can provide the user ID with theuser_id
or the login with theuser_login
parameter)debug
: if set to ‘yes’, will print debugging info below where the shortcode’s output is showncheck_membership
: if set to ‘yes’ (default), whentype
is ‘groups’ it will only show the content if the user is still a member; use ‘no’ if content should be shown also for users who are no longer a member (but have been at some earlier point in time)check_membership_op
: used whentype
is ‘groups’ to determine whether the user is considered a member; with ‘or’ (default) the user can be a member of any of the groups provided via thegroups
parameter, with ‘and’ the user must be a member of all of them
Here is a simple example that reveals its content one day after the user’s account was registered:
[groups_drip from="1"]This is visible one day after registering the user account.[/groups_drip]
Please note that each piece of content that should be dripped must be enclosed by an opening and a closing shortcode tag. In the opening shortcode tag you will indicate certain parameters that determine when the enclosed content will be revealed. The values provided for parameters can be enclosed in straight single or double quotes, please make sure to use straight quotes as slanted quotes will result in provided parameters to be ignored.
We can achieve equivalent restrictions as we have for whole posts, using the right combination of parameters.
Drip Embedded Media
It’s very easy to drip videos and other media using the shortcode.
Please refer to the more detailed examples below.
Drip based on Account Creation
To drip content based on when a user’s account was created, use type=’account’ (or omit this parameter ‘account’ is used by default) along with the from, until, from_uom, until_uom, from_unit and until_unit parameters.
An example that restricts viewing the enclosed content for a certain time after user account creation:
[groups_drip type='account' from='1' from_uom='days' until='7' until_uom='days']Content shown exactly one day after account registration until exactly 7 days after but not beyond.[/groups_drip]
For illustrative purposes, we have even indicated parameter values that would anyhow be used by default. The example would reveal the content exactly 1 day after the account was created, exact to the hour, minute and second. It will hide the content exactly 7 days after that, again exact to even the second. This means, that if the account was created at 12:15:35, the content would be visible at 12:15:36 of the next day and would be hidden again at 12:15:36 of the 7th day after that. To add flexibility, we can use the from_unit and until_unit parameters:
[groups_drip type='account' from='1' from_uom='days' from_unit='yes' until='7' until_uom='days' until_unit='yes']Content shown at the start of the day after account registration until the end of the 7th day after.[/groups_drip]
With the added parameters from_unit=’yes’ and until_unit=’yes’, the user would be able to view the enclosed content as of 00:00:00 the next day after the account was created and until 23:59:59 of the 7th day after the account was created.
Drip based on Group Membership
To drip content based on the user’s group membership(s), you must indicate type=’groups’ along with the from, until, from_uom, until_uom, from_unit and until_unit parameters. The extension must have been enabled when the user’s membership first started, otherwise the moment of account creation would apply instead.
Here is an example that reveals its content in two weeks based on group membership:
[groups_drip type='groups' from='2' from_uom='weeks' group='Premium']This is visible two weeks after the user joined the Premium group.[/groups_drip]
By default, this type of dripping will check whether the user is still a group member. If the user is not a group member anymore, the content would again be hidden. You can indicate check_membership='no'
and the content will even be revealed if the user is not a group member anymore, although the user must still have been a member of the group before.
By default, this drip type will check if the user is a member of any of the groups indicated. If you require the user to be a member of all groups indicated, you can indicate that via check_membership_op='and'
, for example:
[groups_drip type='groups' from='1' from_uom='month' group='Premium,Gold' check_membership_op='and']This will be visible one month after the earliest membership to the Premium or Gold group started. In addition, the user must be a member of both the Premium and the Gold group.[/groups_drip]
Drip based on Specified Time
To drip content based on specific dates, you would use type='fixed'
.
The following example shows its content as of a certain date and from then on:
[groups_drip type='fixed' from_datetime='2021-01-01 12:00:00']This will be shown as of noon on January 1st, 2021.[/groups_drip]
This example will show its content up to a certain date and time and not after:
[groups_drip type='fixed' thru_datetime='2020-12-31 23:59:59']Just visible until the end of 2020.[/groups_drip]
You can combine both parameters, to show content during a specific time:
[groups_drip type='fixed' from_datetime='2022-01-01 00:00:00' thru_datetime='2022-01-31 23:59:59']This will be visible the whole month of January, 2022.[/groups_drip]