Sort:  

Yes I know, but surely there is a better way of checking a user's role instead of duplicating all the code?

Now that you mentioned, it can be done with a function that takes the role as the parameter :D i will do that.