Media mogul Rupert Murdoch took a night off from managing crises at Fox News to deliver a warm introduction of President Trump Thursday in New York at a dinner honoring American and Australian veterans of the Battle of the Coral Sea.

“It is my distinct honor to introduce the commander in chief, the president of the United States, my friend Donald J. Trump,” Murdoch said.

Murdoch and Trump's friendship, like their attempt at a hug Thursday, is not perfectly smooth, however.

In 1982, Trump and Murdoch were competitors; they submitted rival bids to purchase the New York Daily News, then owned by the Tribune Co. Neither man's offer was accepted.

Murdoch already owned a major tabloid, the New York Post, and Trump was one of the newspaper's favorite subjects — particularly on gossipy Page Six. Susan Mulcahy, a former Page Six editor, penned this reflection in Politico last year:

If you worked for a newspaper in New York in the 1980s, you had to write about Trump. As editor of the New York Post’s Page Six, and later as a columnist for New York Newsday, I needed to fill a lot of space, ideally with juicy stories of the rich and powerful, and Trump more than obliged. I wrote about his real estate deals. I wrote about his wife, his yacht, his parties, his houses. At times, I would let several months go by without a single column mention of The Donald; this doubtless upset him, as he loves Page Six and used to have it brought it to him the moment it arrived in his office. But eventually I returned to the subject, as did a legion of other writers. We didn’t see it at the time, but item by inky item we were turning him into a New York icon.

In January 1988, Trump offered to buy the New York Post from Murdoch. Instead, Murdoch sold the paper to one of Trump's rivals on the real estate development scene, Peter Kalikow.

If Trump felt bitter, the sentiment did not last long. Within months of the New York Post's sale to Kalikow, Trump was complaining about tougher coverage and pining for the publicity of the Murdoch era.

“He's killing me,” Trump said of Kalikow, while speaking at a breakfast event for New York Republicans in August 1988. “Rupert, come back.”

Murdoch did come back, reacquiring the New York Post in 1993. In the intervening years, the tab published some of its most memorable Trump covers, including several about his affair with Marla Maples.

During the presidential campaign, Murdoch was initially put off by Trump's candidacy, and Trump resented the early coverage he received from Murdoch's news outlets, which also include the Wall Street Journal.

Remember this?

In an article in the fall, New York magazine's Gabriel Sherman described the discord:

Murdoch was not a fan of Trump’s and especially did not like his stance on immigration. (The antipathy was mutual: “Murdoch’s been very bad to me,” Trump told me in March [2016].) A few days before the first GOP debate on Fox in August 2015, Murdoch called Ailes at home. “This has gone on long enough,” Murdoch said, according to a person briefed on the conversation. Murdoch told Ailes he wanted Fox’s debate moderators — [Megyn] Kelly, Bret Baier and Chris Wallace — to hammer Trump on a variety of issues.

The moderators obliged, and we all remember what happened between Trump and Kelly in the aftermath.

But Trump maintained his lead in the Republican primary, and Murdoch ultimately tweeted that “if he becomes inevitable, party would be mad not to unify.”

In April 2016, the New York Post endorsed Trump in the GOP primary.

“Should he win the nomination, we expect Trump to pivot — not just on the issues, but in his manner,” the paper's editorial board wrote. “The post-pivot Trump needs to be more presidential: better informed on policy, more self-disciplined and less thin-skinned.”

Trump never pivoted, and the New York Post withheld its endorsement in the general election, as did the Wall Street Journal.

Then Trump won. As I have noted before, the Fox News lineup has been tilting in his favor, with bigger roles for supportive voices, such as Tucker Carlson and Eric Bolling.

These days, Trump seems happy with his coverage.

“I want to thank the American-Australian Association for hosting this event, which I've been contributing to for years, by the way, through Rupert,” the president said Thursday. “Every year, he'd send me this letter: ‘Could you please give money?’ I said, ‘What do I have to do with that, Rupert?’ And I just keep sending him money, money. And now, I realize that was money well spent. That's great. Right, Rupert?”