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

    (@mike_cowobo)

    Hi @daltontastic,

    There is no built-in way to quickly filter the activity length per user. However, you can prevent the plugin from loading when the user is premium:

    add_action( 'plugins_loaded', 'maybe_disable_bplal' );
    function maybe_disable_bplal() {
        if ( is_premium() ) {
            remove_action( 'bp_include', array( 'BP_LimitActivityLength', 'init' ) );
        }
    }

    (assuming this code is loaded from a plugin)

    Cheers,
    Mike

    Thread Starter daltontastic

    (@daltontastic)

    Okay so I symbolize which people are Premium by using modemlooper’s BuddyVerified Plugin…

    So does that mean the code would look like this?

    add_action( ‘plugins_loaded’, ‘maybe_disable_bplal’ );
    function maybe_disable_bplal() {
    if ( is_verified() ) {
    remove_action( ‘bp_include’, array( ‘BP_LimitActivityLength’, ‘init’ ) );
    }
    }

    Also, where do I put the code?

    Plugin Author Mike Martel

    (@mike_cowobo)

    That sounds about right. Though I don’t think BuddyVerified comes with a is_verified function (correct me if I’m wrong). You’d have to write that function yourself.. looking at the plugin quickly, that would be something like:

    function bp_is_verified() {
        $verified = get_user_meta( get_current_user_id(), 'bp-verified', true );
        return !empty( $verified );
    }

    (untested!)

    The best place to put all this is in a new plugin. That plugin could just contain these two functions and the add_action call.

    Cheers,
    Mike

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional Activity Length’ is closed to new replies.