Support » Plugin: myCRED » Removepoint when delete post

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



    There is no built in limit for Points being awarded when a user posts a new content. I assume you give points for new posts under the “Points for publishing content” hook?

    Hi Gabriel!

    >>”Points for publishing content”
    Yes! It is something like “Points for comments > Trashed / Unapproved Comments”

    I hope to the possibility of myCRED.

    Thanks Gabriel!

    Plugin Author Gabriel


    Your only option is to hook into the mycred_add filter which fires just before points are awarded / deducted from users allowing you to stop a process if needed. Filters simply just need to return either true (go ahead and give / take points ), false (stop what you are doing) or ‘done’ (in case you award points yourself due to some custom formula or something and don’t want myCRED to duplicate things but indicate that points have been awarded).


    add_filter( 'mycred_add', 'enforce_limit_for_published_content', 10, 3 );
    function enforce_limit_for_published_content( $reply, $request, $mycred ) {
    	// If another filter has already declined this, so do we
    	if ( $reply === false ) return $reply;
    	// Check the log how many points this user has received
    	// today for publishing content
    	$points_today = mycred_get_total_by_time( 'today', 'now', 'publishing_content', $request['user_id'] );
    	// In this example I assume users get 1 point per content
    	// So 1 point * 1 = 1
    	// In the user has not received points today, $points_today will return zero
    	if ( $points_today == 1 ) return false;
    	return true;

    You can find more information on how to use the mycred_get_total_by_time function in the codex.

    Let me know if you require further assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Removepoint when delete post’ is closed to new replies.