It all depends whether you are talking about the first day it leaves or any day it docks. On the first day you have to board the ship by latest 2 hours before it sails, but if you mean when it leaves after stopping off during its port visits, then it is usually latest 30 minutes before - but you will be informed on the ship and each time it docks.
I don't know who you've been talking to, but they have little idea of what they're talking about. Normally at ports 30 minutes before stated departure time is the 'All Aboard' time. If your later than this they don't lock the dock gates, as there is normally many other ships in port, but the ship will leave on time, so it's up to you to be on board before the gangplank is removed.
I have never heard of needing to be back on the ship 2 hours before...it is normally 30 mins to 1 hour, this is to take account of the final checks the crew need to complete before departing. All aboard times are normally earlier if you are tendering at a port. If you weren't back by then they would still let you back on the ship but you would probably be warned to try and keep to boarding times in future. Also bear in mind that the ship is only obliged to wait for you if you are on an organised tour, if not, the ship will leave without you.