4

I want to allow users to login to their area 'personal' and view their uploaded images/posts (basically creating an instance of the page) which is different to every user that logs in to my website --- similar to Facebook profile page which has the same layout for every user but different content in it.

So far, I have created a role called 'subscriber' (which are members of the page) and I have enabled front page module to re-direct subscribers to the 'personal' page.

I have read that the Views module is useful but I am stuck on how to do this.

0

5 Answers 5

4

From what I understand you need to redirect the user to its profile page, I mean www.example.com/user/[USERNAME] page.

simply install rules module and add a new rule and use this configuration for it:

enter image description here

In the EVENT select User has logged in and in the Action select this

enter image description here

and this is the action configuration

enter image description here

3
  • 1
    thanks for your answer +1, I learned another way with you ;-) Dec 18, 2015 at 20:28
  • I think this is what I am looking for! - Do you know what setting needs to be changed to make Drupal use a relative URL for the user's personal page (basically have their username in the URL) as now it just redirects to the same single page that any user that logs in sees the same content.
    – user54721
    Dec 20, 2015 at 17:04
  • @ldvt5 excuse me I didn't get you. The above url is relative, it is relative to your current domain address. if you need some preprocess for some custom urls, you can use PHP evaluation, PHP code inside of <?php ?‎> delimiters will be evaluated and replaced by its output.‎ E.g.‎ <?‎ echo 1+1?‎> will be replaced by 2.
    – M a m a D
    Dec 20, 2015 at 19:10
5

You can create a View to show the infomation that you need and with the help of the LoginToboggan module you can redirect the users to the view's url.

The LoginToboggan module offers several modifications of the Drupal login system in an external module by offering the following features and usability improvements:

  • Optionally redirect the user to a specific page when using the 'immediate login' feature.
  • Optionally redirect the user to a specific page upon validation of their e-mail address.

For more info about creating Views, you can read:

3

You can use hook_user_login to redirect different users based on a role. You will get complete user object in $account parameter. Check the role and redirect the user.

$edit['redirect'] = 'your_page_path';
3

Are you wanting to show a user all content that they have created (similar to the Facebook wall)? Or are you wanting to create a more timeline display of all content that a user's friends have created? Regardless, you're almost definitely going to want to research the heartbeat module.

If you wanted a lighter weight alternative, you could look into the flag_friend module, plus a view that shows content for all users who are your friends.

I haven't used the D7 of these modules recently, but there are lots of tutorials about using these to create Facebook-like results.

EDIT: An even lighter (but not nearly as robust) option is just using views.

  • For your own list of content: create a page display and add a filter by the currently logged in user.
  • For content others have created: you'd probably have to add the flag module, create another page display for this list, and add a relationship and filter that uses the flag. This should show the currently logged in user only content by people they've flagged (or "liked", or "friended").

But I still think heartbeat is the way to go if you're looking for the full blown Facebook experience.

EDIT: For the redirect after login, LoginToboggan is the way to go.

3
2

These kind of redirect-after-login cases are typically implement using the Rules module. Have a look at the answers to these questions:

Pick the scenario that's closest to what you're trying to do, import the rule(s) (in Rules export format) that are included in these answers and tweak them a very little bit to create your own variation of it. Should take less then 5 mins or so to get the job done and (only requires site building skills).

1
  • A good example of why Rules, rules.
    – No Sssweat
    Dec 19, 2015 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.