I am having a post that user can send to 'another profile' on site, but before posting it will be added to 'some another profile'of other 'random users' and he must approve this post. 'Random users' will receive this submit for approval only if they already follows this 'another profile'. So, my question is:
how to check 'random users' follows 'some another profile' to get new requests for approve?
what I have tried this:
another_profile follows table (profile_follows):
profile_id | who_follow_id
21 5
post that user submit for approve ( posts_for_approve ):
for_whom_id | submit_text | submit_author_id | post_id
21 some text 5 2
users table ( users ):
user_id
5
and table with users that can approve ( users_can_approve ):
post_id | user_id
2 5
in my posts_model I'm getting all users:
function get_all_users()
{
$this->db->select('user_id');
$this->db->order_by('rand()');
$query = $this->db->get('users');
return $query->result_array();
}
in my controller I'm getting all users which will receive posts for approve:
$all_users = $this->stories_model->get_all_users();
foreach ($all_users as $key) {
$send_approve['post_id'] = $edit;
$send_approve['user_id'] = '';
$this->db->insert('contribute_moderators', $send_approve);
}
So this works, but in my code ALL site users will receive post for approve, but my need is to check users follows 'profile_id', to receive this post for approval. Thanks!