Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to limit the Number of Posts a user can make?


  • rsbthebest
    Participant

    @rsbthebest

    What i mean is i am using bbpress on my wordpress site. It has forum and whenever someone post any thing some points are awarded to him using mcreed point system. But i dont want it to be over used.

    So i want to impose restriction like :-

    After posting 10 posts in a day the 11th post will not get any points

    Or

    A user can only post 10 post no more than that.

    I will prefer the first one more!
    Is there any way to do any of this? Pleas reply

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

  • Giacomo
    Participant

    @gcmo

    An easy way to achieve the second option would be to copy paste this code at the end of the file named functions.php in your current theme folder.

    Make sure to create a backup of the file functions.php first. And always do the changes on a test server, not the live one.

    
    function rsb_limit_posting( $retval ) {
    
    	// count topics of the current user
    	$topic_count = bbp_get_user_topic_count_raw( get_current_user_id() );
    	// if they are 10 or more, do not allow him to create new topic
    	if ( $topic_count > 9 ) return false;
    	// otherwise return the default 
    	return $retval;
    
    }
    add_filter( 'bbp_current_user_can_access_create_topic_form', 'rsb_limit_posting' );
    

    The code above hide the “new topic form” for users who posted 10 or more topics.

    Hope it helps… good luck!


    tourdecartes
    Participant

    @tourdecartes

    Hello,

    That is VERY interesting.
    However, I do not see the time limit in the code posted above.

    Is it possible to include a reply limit as well?

    Thanks a lot for your time and support!
    Best regards,
    Emmanuel


    rsbthebest
    Participant

    @rsbthebest

    Ya i installed the code but it just dont allow any more post then 9!!!

    I want to add time limit of it to reset so that countdown starts again from 0 on next day

    Please some one help


    darkoned12000
    Participant

    @darkoned12000

    How would we expand on this code to allow different forum roles to have different posting and topic limits?

    Example:
    Member = Can’t create topics, but can post replies 5x
    Bronze = Can create up to 25 topics, and can post 250 replies
    Silver = Can create 100 topics, and can post 1000 replies
    Gold = Can create unlimited topics and unlimited replies

    I wanted to create some new forum roles and was wondering if this sort of thing is possible? If so can someone assist or point to some functions that I would need to use to help accomplish this. Because this code example looks good I would just need to alter it with maybe some IF logic to look at the users role first and then limit them to topic and post counts.

    Any thoughts?


    Robkk
    Moderator

    @robkk

    @darkoned12000

    this seems like some custom development

    go to http://jobs.wordpress.net/ and post a job.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar