When not to capitalize president
Other than those cases, president should be lowercase. Take this sentence for example: The president lives in the White House. Here, president is neither being used as a title before a person’s name, nor as a direct address, so it isn’t capitalized.
President doesn’t get capitalized if it comes after a person’s name, as in Barack Obama, president of the United States, or if the name that follows is being used as a nonessential phrase offset by commas. Nonessential means the phrase is not crucial to the meaning of the sentence as a whole. For example: The 42nd president, Bill Clinton, was born on August 19, 1946. Here, Bill Clinton is a nonessential phrase, as the sentence is clear without it.
https://www.thesaurus.com/e/grammar/when-do-you-capitalize-president/