0

Ok As @Letharion rightly says, i need to rephrase my question. SO here it is:

I created a basic page and gave it an url alias as "Profile". This page is meant to be my profile page for users on my site. On this page there are 3 quick tabs,"My-Profile", "My-Content", "My-Flagged-Node". The "My-Profile" quicktab has a call back to a custom panel page "user-profile" which has the user name, user picture, and the user activity (created as a view with activity module), and the number of content created by the user. The "My-Content" has the content by the user. The "My-Flagged-Node" quick tab on clicking loads a view showing the flagged nodes by the user. I have created these views and these work properly. Now when a user goes to his relationship and clicks another user's picture then i want that the user is taken to the "Profile" page of this user (the user on which he clicked). I undersatnd this has to be done by passing arguments to views from panels and so on but i am not clear on that. While creating my view in the contextual filters and the relationships i added user id from url as a default value but this takes me to a blank screen or to the same user profile. I hope i am clear now on what i want. Some redirection rules and passing arguments.

Regards

  • Could you please try to clean up the question a bit? You have no less than 4 "PS" added, suggestion perhaps it's time to re-phrase the question altogether? You also clearly have two separate questions in here. Please open one question for each one of those. As it looks right now, I'd vote not constructive if I could. A better question might even have saved you the need for a bounty, since both of your question are fairly simple. – Letharion Mar 7 '13 at 12:23
  • @Letharion i have done so...thanks and i am apologetic for the mistake – why Mar 7 '13 at 16:17
  • No need for apologies, just glad you're making an effort and hoping the community can help. You still have two questions in one though. :) – Letharion Mar 7 '13 at 20:52
  • @i have crossed them as well :) – why Mar 8 '13 at 6:17
0
+50

Try the entity-views-attachment module http://drupal.org/project/eva

This will solve the first part of your problem - having a view filtered by user as per /users/username. Check that you can access via this specific url before trying to redirect.

Answering the question of how to redirect with non-static parameter information - this can be done with 'drupal_goto()' in a module. Copy one of the 'examples' modules. Customise the .info and .install file and delete everything from the .module file.

Assuming the module is called 'redirect' try a variation of:

redirect_init() {
  if (isset($_GET['q']) && preg_match('#^myusers/profile#', $_GET['q']') {
     $uri_parts = explode('/', $_GET['q']);
     $username = $uri_parts[2];
     drupal_goto('custompage/profile/' . $username);
  }
}

This compares the current url ($_GET['q]) against a prefix url. It finds the user name at a specific part point in the path e.g. myusers/profile/username, with username being the 2nd index (starting from 0). This way you still have the parameter.

Enable the module before testing.

4

Panels provides a built-in way to override user profiles-- look for the link (disabled by default) in Page Manager called user_view (User Profile Template). Instead of using your own custom profile page, enable this page override (User Profile Template) and make your changes to that panel.

Then, to link to user profiles, you can just use the standard user profile links, no rewriting needed.

  • thanks for your suggestion...but is there any way to redirect? i know about the user_view thing but is it possible to do by the above asked way? – why Feb 24 '13 at 16:45
  • kenny...the problem i am having is that i have created some views for users. For example, one view lists the content by that user, other lists the flagged nodes by that user and so on. However, when i am adding those views in my content through panel in user_view i am seeing the result of the currently logged in user rather than that of the user whose profile the currently logged in user has visited...Any advices please...i have googled a lot and read a lot of stuff but unable to come to any solution – why Feb 24 '13 at 18:29
  • Using the user_view, you should be able to send the view the argument User being viewed. To be able to select this, you have to make sure that your views displays (blocks, content panes, views etc.) are configured to accept an argument from a panel. – Patrick Kenny Feb 25 '13 at 0:12
0

The EVA view is nice but not always easy to build as the logic behind it can escape many.

I would handle this in a very simple way: In your existing view, add a pane. In that pane, add a contextual filter uid (User ID) or author ID. In the configuration of that filter select "Provide Default value" and select User ID from URL. Save.

This means when a user ID will show up in the URL, clicking on the user's pic will take you to that user's profile page.

Now, to get the user ID into the URL you need to configure the view path. You can do that in one of two ways. The first, if your view is a page, go to Page Setting - Path and set the path to something like user/% or user/%/profile or abcd/%/fghig or whatever as long as your "%" is in there somewhere (with a slash before and one after.) The "%" will automatically change to the ID of the user being viewed.

The other way, if your view is not a page, click on Advanced - Other- Link display and select your path there, replacing the "%" token for the page above with "!1"

Save your view and add the views pane to your panel.

Hope this helps. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.