Pooping in a potty is often the last phase of potty training.
For most all kids.
Boys, are often later in this.
My son included.
Now, for night time sleep dryness ... keep in mind that this is not attained, BIOLOGICALLY, until even 7 years old. It is nothing to do with day time pottying. Night time dryness, is a TOTALLY separate, process.
Just use night time diapers for sleep naps.
And a waterproof bed pad, directly under him.
That is what I do with my son, and with my daughter.
My Daughter even at 5 years old, was still wet at night.
Normal.
But with the waterproof bed pad, accidents are not a big deal, nor a laundry ordeal.
I have 4 of these pads, and just rotate them out as needed and replace it with a dry one.
No biggie.
My son is 4, and still wear night time diapers for naps and sleep, because he is still wet. The child does NOT get 'confused' about diapers at sleep. I simply tell my son that his "body" is not ready to be dry at sleep, yet. He understands. I tell him, sleep time dryness is different than day time.
Keep in mind also, that if you push him to poop in a diaper, SOME kids will just CEASE, pooping altogether, And they will 'withhold' it on purpose.
This of course, causes MEDICAL problems, internally, and pain and constipation. Once constipation sets in, it takes MONTHS AND MONTHS to remedy.
I know, my daughter went through that.
Even if we did not force her to poop in a toilet, she was just not ready... emotionally/biologically... and it just thinking about it, caused her stress and anxiety.
We ended up having to take her to a Pediatric Gastroenterologist... because she developed constipation. She was, Withholding her poop, on purpose, to avoid, pooping. This of course, causes GREAT pain. Then because it hurts and because the poop becomes ROCK hard... the child KEEPS withholding their poop.
The Specialist said, JUST let the child poop in a diaper. Until they are ready... for a toilet. To poop.
EVERYDAY, he saw kids like this. Not pooping on purpose, because they were not ready, to poop in a toilet. Thus, they get, MEDICAL problems of which he then has to treat them for that.
A complication of Constipation, is also something called "Encopresis." This is an involuntary 'leaking' of poop, of which the child has no control over. Or they get bulging bowels or blockages. And, this is a big medical problem.