This guide will tell you how to unlock GAMES AND APPLICATIONS on PS4. The games become locked when you log in from a PS4 account to a PS5 account and also when you start sharing the games.
First, you have to go to the settings on the home screen of your PS 4 and then navigate to the User and Accounts. Select the other options and then click on Restore Licenses. It will restore the licenses of all your games and applications. After this hopefully, your issue will be resolved.
If you are still having the issue, then you have to go to the account through which you have purchased these games. Once you are on the main account on which you have purchased the games. Go to the settings on the home screen of your PS 4 and navigate to Account Management. You have to select Activate as Your Primary PS4 and then click on Activate. After doing this, you need to go back to your 2nd user and there all your locked games will be unlocked.