Skip to:
Content
Pages
Categories
Search
Top
Bottom

Limit Comments Per User


  • Hellbounds
    Participant

    @hellbounds

    How to limit MESAGE NUMBER for all user.

    I need this becouse i have site abonament and i need limit this.

Viewing 4 replies - 1 through 4 (of 4 total)

  • Hellbounds
    Participant

    @hellbounds

    please !


    Henry Wright
    Moderator

    @henrywright

    It’s fairly easy to get the comment count for a particular user.

    $args = array(
        'user_id' => bp_loggedin_user_id(),
        'count'   => true
    );
    $count = get_comments( $args );

    From that point on, depending on what action the user is taking on your site, you can check the count against a pre-determined figure:

    if ( $count < 10 ) {
        // The comment count for the logged in user is less than 10.
    } else {
        // The comment count for the logged in user is 10 or more.
    }

    Hellbounds
    Participant

    @hellbounds

    where to add this line ?


    Henry Wright
    Moderator

    @henrywright

    It isn’t really a copy-and-paste example. You’ll need to be comfortable with PHP and WordPress 🙁

    Alternatively though, you could look for a plugin in the Plugin Directory. Maybe the functionality you need already exists?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Limit Comments Per User’ is closed to new replies.
Skip to toolbar