Looking at the shifter and rod that the shifter mounts to and the problem you are having. I can only assume that there is something fouling the rod that goes down the tube and unlocks the shifter to move around. I think your solution is disconnect the cables, take the housing off, go to your local JY and buy a new shifter, install it, connect cables, fixed.
Not all shifters require this, but I think the shifter in sentra's are one solid unit. So the only solution is to get a new shifter. I know the S30 has the shifting shaft seperate from the handle and the housing. Had to tear one apart before