Skip to content

Commit

Permalink
Merge pull request SimpleMachines#7415 from albertlast/disableUrlSort…
Browse files Browse the repository at this point in the history
…Guest

Disable memberlist url sort for guests
  • Loading branch information
Sesquipedalian authored Apr 5, 2022
2 parents 231ffed + efb421b commit ae0ab6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Sources/Memberlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ function Memberlist()
'label' => $txt['website'],
'link_with' => 'website',
'sort' => array(
'down' => 'mem.website_url = \'\', mem.website_url is null, mem.website_url DESC',
'up' => 'mem.website_url != \'\', mem.website_url is not null, mem.website_url ASC'
'down' => $context['user']['is_guest'] ? '1=1' : 'mem.website_url = \'\', mem.website_url is null, mem.website_url DESC',
'up' => $context['user']['is_guest'] ? ' 1=1' : 'mem.website_url != \'\', mem.website_url is not null, mem.website_url ASC'
),
),
'id_group' => array(
Expand Down Expand Up @@ -273,6 +273,13 @@ function MLAll()
$context['columns'][$col]['selected'] = $_REQUEST['sort'] == $col;
}

// Don't offer website sort to guests
if ($context['user']['is_guest'])
{
$context['columns']['website_url']['href'] = '';
$context['columns']['website_url']['link'] = $context['columns']['website_url']['label'];
}

// Are we sorting the results
$context['sort_by'] = $_REQUEST['sort'];
$context['sort_direction'] = !isset($_REQUEST['desc']) ? 'up' : 'down';
Expand Down

0 comments on commit ae0ab6f

Please sign in to comment.