This topic contains 10 reply and 3 voices, and was last updated by david 5 years, 11 months ago
Viewing 10 Posts - 1 through 10 (of 10 total)
Author Posts
November 8, 2013 at 4:57 am 9848
david HI, On the desktop, the counter posts gives me error. If I have created two posts and then I eliminate the two posts, the counter should again be two (Post Left: 2), but not, the counter stays at zero (Post Left: 0) and I can not create a new post (You must purchase a pack before posting). The subscription package is for one year but the elimination of the post should make up the counter, in this case is not that. Thanks, David
November 8, 2013 at 6:40 am 9854
Mahi Mahi

Hello David,

Thats why “Edit” option comes! If user not happy with the post then they can edit that.

Post deleting not going to increate post limit again. Cause, user already posted what they paid for! Isn’t it?

If you need to edit user’s post limit you have to do that manually.

Go to their profile from admin area -> WPUF Subscription -> Post Count:

November 8, 2013 at 10:52 pm 9869
david david

Hello Mahi,

I think this is not correct. The user pays for a number of posts within a certain date and he can edit and delete posts as often as he wants. The counter should reflect these changes.

The easy example, if the user has ordered 3 posts and he created all three, if he removes one post, the counter should be in 2, the user still has the possibility of creating a new post.

This is possible?

Thanks!

November 10, 2013 at 8:47 pm 9927
david david

Is there anyone who can answer that?
Is very important for me.

Thanks.
David

November 11, 2013 at 12:48 am 9930
Tareq Hasan Tareq Hasan

WPUF doesn’t do any sort of increasing count once a post is deleted. But if you think you need this feature, here is the code may be you could use. Paste it to your themes functions.php and see if it solves your problem.

[php]
/**
* 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’ );
[/php]

November 11, 2013 at 4:01 am 9939
david david

Thank you very much, that is a very important part for my project.

The code works but partially. For example, if the user has a limit of 3 post, if he writes two posts and then deletes one or two posts, this works perfectly, the counter reflect these changes. But if you write three posts (3 of 3), there is a error: the counter no reflect these changes, remains at 0 even remove the three posts and the user can not create a post.

Thanks.
David

November 12, 2013 at 12:14 am 9960
Tareq Hasan Tareq Hasan

So you are saying, if he write 3 posts and then deletes 1 or 2 posts, it doesn’t increase the limit?

November 12, 2013 at 3:15 am 9973
david david

An example: The limit is 3 posts. If I write 1 or 2 posts and then delete 1 or 2 posts, the limit increases. This is perfect. The error is if I write 3 posts (the limit is 3), then the counter is at zero and I can not write more posts. If I delete all posts, the counter also continues to zero.

Thanks!

November 13, 2013 at 3:58 am 10014
david david

Tareq, can you help me with this, please?
Thank you.

November 15, 2013 at 9:48 pm 10117
Tareq Hasan Tareq Hasan

In the code, replace $count != 'unlimited' with $count !== 'unlimited' and see if it solves your problem.

November 17, 2013 at 9:28 pm 10210
david david

It works perfectly!!

Thank you very much!
David

Viewing 10 Posts - 1 through 10 (of 10 total)