• Resolved outwork

    (@outwork)


    Hi! I am working on a membership website where the users can post 5 times in a 5 month period. How it is possible to add custom cycles? For now the plugin supports only some predefined periods (daily, weekly, monthly, etc.) Somehow it is possible to use custom cycles? Thank you!

    BTW your plugin is really unique and simple. I like it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Condless

    (@condless)

    Hi,
    Please refer to the plugin’s docs:
    ‘How to modify the cycle for rules that applied on certain post type?’
    The value of the $cycle can be ‘5 months ago’

    Thread Starter outwork

    (@outwork)

    Hi Condless, Thank you for the answer. Already tried that, but the cycle doesn’t show up in the dashboard, where I can set the limits for the user roles.

    I have multiple user roles on my website with different limitations. For example, users with Silver user role can upload 1 post per month (this is easy, I can select that option from the dropdown when I set the limits for the user roles), Gold user can upload 10 posts in a 5-month cycle.

    How can I achieve that? Thank you, really appreciate your support!

    • This reply was modified 1 year, 11 months ago by outwork.
    Plugin Author Condless

    (@condless)

    Hi,
    The updated cycle won’t show up in the settings, but you can track the up to date posts count via the Users screen.
    Try the following code (make sure the slug of the user role is accurate):

    add_filter( 'upl_query', 'upl_modify_cycle', 10, 2 );
    function upl_modify_cycle( $args, $i ) {
    	$post_type = 'post';
    	$user_role = 'gold';
    	$cycle = '5 month ago';
    	if ( $post_type === $args['post_type'] && $user_role === get_option( 'upl_user_role' )[ $i ] ) {
    		$args['date_query']['after'] = $cycle;
    	}
    	return $args;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom cycles (5 month)’ is closed to new replies.