I have made a social networking site. One of the feature I would like to add is to allow users to change the background image of their profile.I have written javascript for it, but once I change background image of one user, all users background change to that image. What should I do to avoid this.
Javascript Code for switching background
Change background option in Settings page
Advertisement
Answer
You should load the background image dynamically for each user.
This is just a streamline of what I think you should do:
- Create a field in the DB for every user to hold the path for the bg image
- Once logged in check if they have that setted on their profile
- Change it dynamically using js