Assigning Posts/Where is Purchased Post Data Kept?

Hi,
I'm wondering if I can assign a specific post to a user once they've signed up. Assuming that this kind of request fell under user meta data, this is my function mockup to explain:
I basically want to assign everyone post_id = 1, and from then on I want only certain users to be able to access certain posts (depending upon other variables, most likely meta data.) I want them all to be under the same role.
Hopefully I can also somehow integrate drip feeds into this, like once a post has been assigned 7 days later it's sent to them via email.
This is really important to me and if anyone can point me in the right direction I would be very grateful.
I'm wondering if I can assign a specific post to a user once they've signed up. Assuming that this kind of request fell under user meta data, this is my function mockup to explain:
- Code: Select all
function assignPost($user_id, $post_id) {
$posts = get_user_meta($user_id, 'posts_purchased', true);
$posts .= ":$post_id";
update_user_meta($user_id, 'posts_purchased', $posts);
}
I basically want to assign everyone post_id = 1, and from then on I want only certain users to be able to access certain posts (depending upon other variables, most likely meta data.) I want them all to be under the same role.
Hopefully I can also somehow integrate drip feeds into this, like once a post has been assigned 7 days later it's sent to them via email.
This is really important to me and if anyone can point me in the right direction I would be very grateful.