"stagename" should not be in the above at end of first line
Also, the ORDER BY may conflict with the use of the filter, too. If I leave it out, the following works for me properly (in 2.5):
SELECT u.firstname, u.lastname, u.email, u.city, u.country, c.fullname
FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
WHERE c.id <> 1
%%FILTER_COURSES:c.fullname%%