It's obviously fine for President Obama to campaign for Hillary and to express a strong preference for her victory in November, but he crosses the line when he meets with world leaders and denigrates Trump as unfit for office. Lots of people say that, lots of people believe it, but President Obama has a responsibility to the office and to America not to undermine a potential successor. Even if Obama is right, if Trump wins the election he will be the next President, and he'll have a tough enough job without this condemnation hanging over his head.
On many occasions, Obama has been explicit about the fact that his words are intended specifically about Trump. He's said questions about the GOP nominee come up in every meeting with a foreign leader, and he's emphatically declared Trump to be unfit to inhabit his role as commander in chief.