Bury have appointed former player David Flitcroft as their new manager following his departure from Barnsley.