Jump to content

want a function for user


anshulmahipal
 Share

Recommended Posts

Hello guys,. I almost complete my website including member area but now problem comes....... I need a help that every user can access their content and content is posted by admin via c pannel. for example suppose I am a admin and a user called x create his account now he is able to access the page called user.php and now admin post a content on x user page which accessible by x user only after login and other user not even saw the same content even after login so help me on this please . Please provide me source code too.

Link to comment
Share on other sites

We aren't here to write your code for you. If you want content that only certain users see then you need to design your database to support that. If it is only for 1 user then you can put a user ID in the content table in the database. If content can be seen by multiple users then you need a separate table to hold user ID/content ID pairs to say which users can see which content. When a user pulls up that page then you can ask the database for the content for that user ID.

  • Like 1
Link to comment
Share on other sites

Think about what you are already doing. The user has logged in so now you have some session variables that tell your database queries what messages or content to load. A table for public messages has a "from" column but a table containing private messages is going to also have a "to" column. So then what does it matter if the messages are from the admin or from some other user? What matters is that the content is intended for a particular user.

  • Like 1
Link to comment
Share on other sites

Your question is too vague. I don't know what your user content is. I presumed you were loading content from a database. You say the users log-in, so you establish sessions, right? You use session variables to decide what content to show, right?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...