AndrewSimm
Well-known member
I am creating an addon to list polls. The problem I am running into is when removing threads that users don't have permission to view the total doesn't change and the threads still show on their original page. This means that instead of showing 40 per page it shows however many the user has permission to view out of that group of 40. So if a user can only view one poll in the 40 - 80 range then only one will show on that page.
TLDR; my total and page count always shows the same regardless if a user only has permission to view a small percentage fo the results.
edit: simplified a few things but still the same issue.
TLDR; my total and page count always shows the same regardless if a user only has permission to view a small percentage fo the results.
PHP:
$pollsPerPage = $this->options()->andrewEnhanchedPollsPerPage;
$page = $this->filterPage();
$perPage = $pollsPerPage;
$threadFinder = \XF::finder('XF:Thread')
->with('Poll', true)
->with('Forum', true)
->with('Forum.Node.Permissions|' . $visitor->permission_combination_id)
->order('post_date','DESC')
->limitByPage($page, $perPage);
$threads = $threadFinder->fetch();
$threads = $threads->filterViewable();
$total = $threads->count();
edit: simplified a few things but still the same issue.
Last edited: