Threshold effects in photoionization and photodetachment