Home Forums Plugin Support WP Project Manager – Free Increase the post count once a post is deleted

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  david 3 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #72400

    david
    Participant
    Post count: 40

    That's not work on last version:

    /**
     * Increase the post count once a post is deleted
     * 
     * @param int $post_id
     */
    function wpufe_trash_post( $post_id ) {
        // bail out if charging is not enabled
        if ( wpuf_get_option( 'charge_posting', 'wpuf_payment' ) != 'yes' ) {
            return false;
        }
         
        $author_id = get_post_field( 'post_author', $post_id );
        $userdata = get_userdata( $author_id );
     
        $count = ( $userdata->wpuf_sub_pcount ) ? $userdata->wpuf_sub_pcount : 0;
        if ( $count !== 'unlimited' ) {
            $count = intval( $count );
            update_user_meta( $userdata->ID, 'wpuf_sub_pcount', $count + 1 );
        }
    }
     
    add_action( 'wp_trash_post', 'wpufe_trash_post' );

    Thanks.
    David

    #72428

    Nayem
    Moderator
    Post count: 6480

    Hello,

    You have posted in the wrong plugin topic. You are talking about WP User Frontend but you have posted in Project manager free.

    I will notify our developer team about this. But can you please make sure that you have used the right file to add those codes.

    #72509

    david
    Participant
    Post count: 40

    Ops, thanks Nayem ๐Ÿ™‚

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Increase the post count once a post is deleted’ is closed to new replies.