We upgraded from D5 to D6 recently

I do see module 2 URLS (duplicate ?) for same user ...
if some one registered with user name John
two profile URLs are created

www.website.com/john (Core profile module page
www.website.com/john-0 ( Content Profile Page module page)

In d5 , we were using Bio module and BIO used to redirect john-0 to john (I guess..not sure). Its not happening after upgrade. Google started indexing both type in our site. I am affraid content duplicate issues.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jumpfightgo’s picture

I've run into this as well.

pharma’s picture

I think its in settings
admin/settings/content_profile_page

Check the following settings

>Redirect profile nodes to user page

If checked, a user's profile node will redirect to the user's page. This is useful if you don't want profiles to appear in two places (node/# and user/#).

Pol’s picture

Weird, I don't have that setting !

wilgrace’s picture

I don't see this either - in fact, there is no global Settings page for Content Profile at all, just the field settings at the content type.

crea’s picture

Category: bug » feature

"Redirect profile nodes to user page" is a feature of Advanced Profile Kit module and not Content Profile. Please also note the warning there: "This specifically works with the uprofile node type that ships with APK and will not work if you are using a different node type."
You can try APK module. Also, this is not bug. It could be a feature request.

crea’s picture

Title: How to redirect content profile page to user profile page » Option to redirect content profile page to user profile page

Temporary solution: add this to your module, rebuild theme registry. The code assumes your module name is "mymodule" and your content profile node type is "profile". This is what APK does.

/**
 * Implementation of modulename_preprocess_node()
 * 
 * Redirect from content profile node to user page.
 * 
 */
function mymodule_preprocess_node(&$variables) {
  $node = $variables['node'];
  switch ($node->type) {
    case 'profile':
      if (arg(0) == 'node' && arg(1) == $node->nid && arg(2) == "") {
      // If we are postitive we are on node/N where N is the NID of a profile 
      // node, then redirect to the user profile page instead.
      drupal_goto("user/$node->uid");
    }
  }
}
FiNeX’s picture

Would be possible to have the opposite? When an user goes to user/UID being redirected to the profile node?

PieWie’s picture

when can we expect the introduction of this feature?

i have the problem is

when i want to redirect from user galery by clicking the image to profile
is redirected to nod - and not the full profile

This functionality is useful
Please include in next version

PieWie’s picture

Status: Active » Fixed

everything is ok

in the latest version apk http://drupal.org/project/advanced_profile

already implemented functionality

YesCT’s picture

I use content profile module and dont use apk.

when looking at profile pages like:

/users/usernameX

there is a "view" link for one of the content profile nodes which takes me to say

/content/usernameX

I want /content/usernameX to redirect to /users/usernameX

is that what is being discussed here?

and if the solution is to install apk... I'm scared to, because I already have content profile module set up.

Royal_Jat’s picture

Hello All,

i am working with drupal 6.x and developing a social networking site. i have install all recommended module for a user profile, like privet message, friendlist, og, invite etc..
also i create a user-profile.tpl.php in theme folder with my design.
but my problem is that when i click on some links as like invite or message than page go to another place(not show the result in same design page). how i show all links in user-profile.tpl.php page and also their result.
i need if i click on "send a friend request" button than it show on same page.
or if click on "my inbox" button for check the message than message would be display under the user profile detail at same page"user-profile.tpl.php"

but right now its working as i need. its show link in user-profile.tpl.php page but when i click on link its go to anothe page and show the result without any theme or block (that should be on profile page)

please help me.
any drupal master suggestion will be appreciated

Thanks
Regards
Royal_Jat

FiNeX’s picture

@royal: you should ask this in the support forum, not in the bug queue.

@piewie: and what if you don't use apk? I'm not sure this bug can be considered as fixed requiring another extra module

crea’s picture

Status: Fixed » Active

I agree that we can't treat APK as a complete solution because it's big module with lots of functionality user may not need.

FiNeX’s picture

I agree with @crea

mattiasj’s picture

I agree as well, custom code in #6 worked great for my purpose.

chinnerz’s picture

Crea,

I am new to this and wanted to get specifics. What file do I add this code to? I tried adding it to the bottom of the content_profile.module file, without the php tags at the top and the bottom, rebuilt theme registry, but profile content didn't show up on the user page.

thanks.

jumpfightgo’s picture

Title: Option to redirect content profile page to user profile page » Option to redirect content profile page to user profile page or vice versa
Version: 6.x-1.0-beta4 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
2.34 KB

Here is a patch that lets you set a redirect per content type, based on crea's code in comment #6

It adds a setting to each profile content type that allows you to specify whether to redirect from content profile to user, or user to content profile, or neither (default).

If you have multiple content profile types, and want to redirect from user page to a particular content profile type and not another, then I think the settings could achieve this but I haven't tested that particular use case.

Please test this patch so that we can get this into the next release of the module!

jumpfightgo’s picture

Status: Needs review » Closed (duplicate)

Both http://drupal.org/node/577218 and http://drupal.org/node/577218 appear to be duplicates of this issue.

Also, http://drupal.org/node/686350 is related, but the patch I wrote does not check roles. If someone would like to try adding that in then that issue would also be resolved.

jumpfightgo’s picture

Status: Closed (duplicate) » Needs review

Sorry accidentally marked this thread as duplicate instead of the other way around.

apothus’s picture

@jumpfightgo: Patch appears to work great. Thanks.

crea’s picture

Proper way is to redirect inside hook_nodeapi("view") or in hook_init(). Solution posted above is simply an ugly workaround: using theme layer for redirects is bad. Theme layer runs last meaning you've already spent processing power to prepare the page which user won't even see.

crea’s picture

Status: Needs review » Needs work
YK85’s picture

+1 subscribing

Tamela’s picture

subscribing

YesCT’s picture

I used rules to do this.

array (
  'rules' => 
  array (
    'rules_2' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_view',
      '#label' => 'Redirect to user profile, when viewing profile node',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
        0 => 'content_profile',
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          0 => 
          array (
            '#weight' => 0,
            '#type' => 'condition',
            '#settings' => 
            array (
              'type' => 
              array (
                'personalinformation' => 'personalinformation',
              ),
              '#argument map' => 
              array (
                'node' => 'node',
              ),
            ),
            '#name' => 'rules_condition_content_is_type',
            '#info' => 
            array (
              'label' => 'Viewed content is Personal Information',
              'arguments' => 
              array (
                'node' => 
                array (
                  'type' => 'node',
                  'label' => 'Content',
                ),
              ),
              'module' => 'Node',
            ),
          ),
          '#weight' => 0,
          '#type' => 'AND',
          1 => 
          array (
            '#type' => 'condition',
            '#settings' => 
            array (
              'code' => 'return arg(0) != "user";',
              'vars' => 
              array (
              ),
            ),
            '#name' => 'rules_condition_custom_php',
            '#info' => 
            array (
              'label' => 'Execute custom PHP code',
              'module' => 'PHP',
              'eval input' => 
              array (
                0 => 'code',
              ),
            ),
            '#weight' => 0,
          ),
          2 => 
          array (
            '#negate' => 1,
            '#weight' => 0,
            '#info' => 
            array (
              'label' => 'User has role(s)',
              'arguments' => 
              array (
                'user' => 
                array (
                  'type' => 'user',
                  'label' => 'User',
                ),
              ),
              'module' => 'User',
            ),
            '#name' => 'rules_condition_user_hasrole',
            '#settings' => 
            array (
              'roles' => 
              array (
                0 => 7,
              ),
              'operation' => 'OR',
              '#argument map' => 
              array (
                'user' => 'user',
              ),
            ),
            '#type' => 'condition',
          ),
        ),
      ),
      '#actions' => 
      array (
        1 => 
        array (
          '#type' => 'action',
          '#settings' => 
          array (
            'path' => 'user/[author:uid]',
            'query' => '',
            'fragment' => '',
            'force' => 1,
            'immediate' => 0,
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'path' => 
                array (
                  0 => 'author',
                ),
              ),
            ),
          ),
          '#name' => 'rules_action_drupal_goto',
          '#info' => 
          array (
            'label' => 'Redirect to User Account Page',
            'label callback' => false,
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'path',
              1 => 'query',
              2 => 'fragment',
            ),
          ),
          '#weight' => -10,
        ),
      ),
      '#version' => 6003,
    ),
  ),
)

[note I had to enable the php module, but I did not give anyone permission for it]

jumpfightgo’s picture

Status: Needs work » Needs review
FileSize
2.29 KB

Here is a modified patch of #17 that uses node_api instead of the theme layer to appease @crea's (well-founded) criticism.

I don't have much experience with rules, so I'm not sure which is a better solution. I like that the patch provides a simple radio button for controlling the redirect, but if @YesCT's rules solution is more appropriate then that's fine. I just want this feature to work out-of-the box, because this is a fundamental usability and SEO concern for anyone trying to implement a node-based solution to drupal profiles.

YK85’s picture

This would be a great feature to be shipped with content profile.

I was wondering if there is any difference between the method with the patch in #26 vs using rules? Any chance of conflict or issues with using rules? I am currently using rules to do this.

I am interested in learning more and would appreciate any information

le dendrite’s picture

Hey everyone, I'm also trying to redirect core profile or account pages to their corresponding Content Profile Pages for several content profile types.

Jumpfightgo, would you mind giving me a quick walk through of instilling your patch?
Also, what is your opinion on running this patch on a production site? Safe or a bad idea?

Many Thanks.

xkater’s picture

subscribing

jumpfightgo’s picture

http://drupal.org/patch/apply

I don't think there should be a problem with running the patch on a production site, but of course the status of this thread is still "needs review" because ideally several people will test the patch on a development site, and check to make sure, before this (hopefully!) gets into the next release of the module.

Again, I don't know much about rules, so someone else will have to chime in about rules vs. node_api.

le dendrite’s picture

@jumpfightgo
Thank you for the great help, I got the patch installed successfully.

If their were a way to make the patch redirect for everyone Except the account owner, or provide a septate link to the users account page so they can still view their own User Profile or account page but everyone else is redirected to the Node Profile then it would be perfect and solve all the problems with Content Profile.

Also since I installed the patch if I have a content type set to "Do Not Redirect" I will get the following error on the User Profile Page.

warning: Invalid argument supplied for foreach() in
sites/default/modules/cck/content.module on line 1284.

jdwfly’s picture

I used the above posted rule, but I agree that it should be an option of the module.

ressa’s picture

I also used the rule posted above, and second that it should be a option in the module.
Note: When you import, remember to remove the from the export dump above and update the "Viewed content is..." rule to your content profile content type .

Sinan Erdem’s picture

I used the patch on #26 and it works fine...

fago’s picture

Status: Needs review » Needs work

I agree that it makes sense to have an option like that by default, however we need to find a better wording for the labels.

Apart from that:
* only using node_api view won't work if the display of the content profile is disabled.
* we don't need to comment each line of code, in particular if it's readable. We need comments if it's not self-explaining.
+ if ($node = content_profile_load($type, check_plain(arg(1)))) {
Why escape html tags here? _load() won't display the string ;)

Boletus’s picture

Subscribing.

le dendrite’s picture

Am I the only one that thinks it would be Extremely Awesome and Useful if you could

***Redirect Users profile views to Content Profile node *UNLESS is Current User. ?

That way the user can access their own account/user profile page and info that other modules provide to it, And puts an end to the confusion and extra step in getting viewers to the Content Profile node. It would make everything a lot simpler for me thats for sure.

robby.smith’s picture

+1 subscribing

ayalon’s picture

Status: Needs work » Needs review
FileSize
2.22 KB

As I see, we all agree, that this should be an option in content profile.

So do I. I had to implement this patch in my content_profile module.

#35 @fago
I corrected the things you pointed out, changed the strings.

Could someone review this patch to get this integrated into the next release of the content profile module?

crea’s picture

Status: Needs review » Needs work

I haven't fully reviewed the patch but have spotted this one:

0 => t('Don\'t redirect'),

This is bad practice: instead of escaping, you should combine single and double quotes.

ayalon’s picture

This time I will not gave up reposting this patch until its committed:

fixed...

ayalon’s picture

Status: Needs work » Needs review
crea’s picture

hmm, what about node edits ? Perhaps we need to redirect those too.

robby.smith’s picture

Redirect for the node edit would be great!
www.mysite.com/node/%/edit
www.mysite.com/user/%/profile/profile

YK85’s picture

#41 works great - redirect of node edit would complement this very well!

frankcarey’s picture

Status: Needs review » Reviewed & tested by the community

yeah, works nicely for me

frankcarey’s picture

Maybe it would be best to get this patch in and then worry about node edits

YK85’s picture

ayalon - is the edit page redirects something that you would be able to add to your patch?

moonray’s picture

Status: Needs work » Reviewed & tested by the community

subscribing.

moonray’s picture

Status: Reviewed & tested by the community » Needs work

If there are multiple content profile node types, how do you determine which of the content nodes the user profile page forwards to?

rburgundy’s picture

Status: Reviewed & tested by the community » Needs work

+1 subscribing

916Designs’s picture

I think I've worked my way around the Content Profile -> User Profile redirect case. Was having trouble with Rules and the hook shown above.

For pages, theme your Content Profile related nodes (the ones linking to the CP when they shouldn't be) like this:

//Show content profile data, but link to Drupal Profile.
$cpdata = content_profile_load('profile', $node->uid);

if ($cpdata && $cpdata->field_fullname[0][value]) {
   print '<p><a href="' . url('user/'.$node->uid) .'">'.$cpdata->field_fullname[0][value].'</a> posted this on ' .date('n-j-Y', $data->node_created) . '</p>';
}

For Views, we can use the "Output this field as a link" option to show something from our Content Profile node, yet link to the standard profile.

0. Assume user created the node you are doing a view on, that you can get a uid to link to
1. Add field User uid and select "Exclude from display" (drag to first item in fields list)
2. Add the field that has info from the Content Profile node, such as "Full Name", choose "Output this field as a link", put 'user/[uid]' as link path
3. Done

I'm still not happy with the overall weird double page edit thing I have to show my users for their Profile/Accounts, but it beats no content profile at all

moonray’s picture

Using the theme layer isn't a very good permanent solution. It means you have to re-code stuff for every site you create.
There should be an in-module solution.

916Designs’s picture

Yeah... I see what you mean. Search returns the wrong links, and there are too many other edge cases to account for.

nicedawg’s picture

Status: Needs work » Needs review
FileSize
3.5 KB

I took the patch from #41 (thanks, ayalon!) and added the discussed options for also redirecting the edit pages.

#50 moonray -- not sure how it *should* work, but the way it *does* work is to just redirect to whichever content_profile content type it runs across first which has the option enabled.

Please review and let me know what should fix/improve.

suedehead’s picture

nicedawg, thanks -- #55 worked wonderfully!

Michsk’s picture

i think how it should work, is that in the content type we set as content profile, have a option to check if that content type should be used to redirect to.

drupalina’s picture

Once you submit the form it brings you back to the same form. Shouldn't it bring you back to your profile?

deastlack’s picture

I am just getting started using the Content Profile module and am relatively new to drupal module coding, so please forgive if these questions are blatantly simplistic.

How should one apply the redirect patches that have been mentioned in this thread? In reviewing the comments it is not clear where to append the code and what if anything should be removed.

In any case I'm not sure that redirection will resolve my issue. I want values entered in fields of the users table during account registration to be placed in the corresponding fields of the CCK created content_type_user. After the initial data entry during registration and creation of the content profile node, all data modification should /will take place in the CCK node. When the user edits these fields in the content_type_user node, I want the changes written back into the users table record.

Is this what is meant by redirection?

Michsk’s picture

deastlack: i think you should open a new issue for your question. About the patch question: http://drupal.org/patch/apply

metro mark’s picture

Applied the patch in #55 and it appears to work fine. There is however one usability issue that has been previously mentioned in #37

***Redirect Users profile views to Content Profile node *UNLESS is Current User. ?

Without this there is no way for a user to edit their password. I think this is a much needed feature for all the people who have their content profile as a node. This way the public clicking a user are directed to the content profile (what we want them to see), but a user can still enter and edit their my account page.

If you add this to the patch this would be the final piece in the puzzle for me, and I'm guessing many others too.

Thanks for your good work.

kostask’s picture

The patch at #55 works like a charm! Thanks a lot for this!

Michsk’s picture

@nicedawg: i was testing you patch and came across some issues.

## TABS / EDIT ##
closer inspection showed that when i use the option Redirect content profile node edit to content profile user edit.

I got redirected to the following url when i press edit on the profile node
user/2915/profile/profile
Above url works for - top - edit tabs (Show a tab at the user's page)
But when you use the - sub - edit tabs (Show a secondary tab below the user's edit tab) the url should be:
user/2915/edit/profile

I am trying to fix this trough a check in @418 with content_profile_get_settings($type, 'edit_tab') but i'm not much of a coder.

## ME module ##
Second thing is the me module. i use this module and the following occurs. When users are at the edit profile page - core -. They see the tabs view and edit. Because of the me module, the view tab is changed to not user/uid but to user/me. Because of this the patch can not find a content_profile for the user.

Michsk’s picture

following gives me problems

  elseif ($op == 'view' && is_content_profile($node) && content_profile_get_settings($node->type, 'page_redirect') == 1) {
    drupal_goto('user/' . $node->uid);
  }

firefox says that this creates a recursive loop...

Michsk’s picture

here is the change i made to the patch for the tabs thing.

// check what kind of edit tab is used - top or sub. Based on that redirect to the right path
if( content_profile_get_settings($node->type, 'edit_tab') == 'top' ){
  drupal_goto('user/' . $node->uid . '/profile/' . $node->type);
}elseif( content_profile_get_settings($node->type, 'edit_tab') == 'sub' ){
  drupal_goto('user/' . $node->uid . '/edit/' . $node->type);
}

starting @417

guillaumev’s picture

Hi,

I had the same problem as lasac (redirect loop), I fixed it by doing this:

elseif ($op == 'view' && is_content_profile($node) && arg(0) == 'node' && content_profile_get_settings($node->type, 'page_redirect') == 1) {

(notice the && arg(0) == 'node' )

I modified the patch with the modification I made and I'm uploading it here.

Note this is my first Drupal hack, so you might want to double-check...

osopolar’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
3.56 KB

For me it works fine. I created a patch from #66 with the changes of #65.

fago’s picture

Status: Reviewed & tested by the community » Needs work

Please do not RTBC your own patches.

+++ b/content_profile.module	(working copy)
@@ -172,6 +172,28 @@
+    '#description' => t('Optionally redirect all full page node views or default user profile views'),
+    '#options' => array(
+      0 => t('Do not redirect'),
+      1 => t('Redirect content profile node to user profile'),
+      2 => t('Redirect user profile to content profile node'),

The description should not re-state what already the options say. Say something new, or nothing.

Also, doesn't the module else use "profile content" in the UI?

+++ b/content_profile.module	(working copy)
@@ -172,6 +172,28 @@
+  $form['display']['edit_page_redirect'] = array(

I don't like this option. Having too much options quickly clutters the options page. Also I don't think this is needed - when there is no link to it people won't find it.

+++ b/content_profile.module	(working copy)
@@ -304,6 +326,13 @@
+        if (content_profile_get_settings($type, 'page_redirect') == 2) {

From reading the code I can't understand what is 2. Add defines or just use short string names as keys, ala "0", 'to_node', 'to_user'.

+++ b/content_profile.module	(working copy)
@@ -383,6 +412,19 @@
+  elseif ($op == 'prepare' && is_content_profile($node) && arg(0) == 'node' && content_profile_get_settings($node->type, 'edit_page_redirect') == 1) {

We should check whether this really node/$nid of this node. The node could be displayed in a block or similar too.

+++ b/content_profile.module	(working copy)
@@ -383,6 +412,19 @@
+    // check what kind of edit tab is used - top or sub. Based on that redirect to the right path

Comment exceeds 80 chars. Also it has to start capitilized and end with a point.

+++ b/content_profile.module	(working copy)
@@ -383,6 +412,19 @@
+    if( content_profile_get_settings($node->type, 'edit_tab') == 'top' ){
+      drupal_goto('user/' . $node->uid . '/profile/' . $node->type);
+    }elseif( content_profile_get_settings($node->type, 'edit_tab') == 'sub' ){

Wrong spacing.

+++ b/content_profile.module	(working copy)
@@ -383,6 +412,19 @@
+  }  ¶

Trailing whitespaces.

+++ b/content_profile.module	(working copy)
@@ -383,6 +412,19 @@
+  elseif ($op == 'prepare' && is_content_profile($node) && arg(0) == 'user' && (arg(2) == 'edit' || arg(2) == 'profile') && arg(3) == $node->type) {

I think underscores of the type appear as dashes in the UI. Thus the check would fail.

+++ b/content_profile.module	(working copy)
@@ -400,6 +442,9 @@
+  elseif ($op == 'view' && is_content_profile($node) && arg(0) == 'node' && content_profile_get_settings($node->type, 'page_redirect') == 1) {

As above, check for node/$nid.

Powered by Dreditor.

Michsk’s picture

fago: good work.

Michsk’s picture

@61: i do not see the use for: Redirect Users profile views to Content Profile node *UNLESS is Current User. The content profile module shows a edit tab and trough that tab we are send to the edit page of that users, there they also can edit there password.

If we use the unless is current user statement we also have to create two templates, one for /user and one for /profile/uid this is unnecessary.

Michsk’s picture

how is this going, fago made a good review. ositoblanco maybe you could implement fago's comments?

pixelsweatshop’s picture

subscribing

mrosas’s picture

subscribing

Michsk’s picture

Priority: Normal » Major

This is getting awkward but this option actually is a necessary one. And looking at the community impact this even deserves a priority of major.

osopolar’s picture

Finally I found some free time to review the comments of fago in #67 and created a new patch.

I also changed the function content_profile_nodeapi to not have so mutch if ... else ... else ... . I think it's better to use a switch($op)-statement (which can be found) in many implementations of hook_nodeapi. I hope it is okay that I put it into the same patch.

The only one I disagree with fago is:

+++ b/content_profile.module (working copy)
@@ -383,6 +412,19 @@
+  elseif ($op == 'prepare' && is_content_profile($node) && arg(0) == 'user' && (arg(2) == 'edit' || arg(2) == 'profile') && arg(3) == $node->type) {

I think underscores of the type appear as dashes in the UI. Thus the check would fail.

As far as I can see in content_profile_menu() the underscores won't be replaced, see content_profile_menu(): $items['user/%user/profile/'. $type] = ...

Michsk’s picture

yes, great. Thanks ositoblanco for your time and effort! Ill test it today, and let's just wait for fago.

Michsk’s picture

Im thinking what to do with the option "Display the full content". When someone chooses to redirect this whole option is useless..

//edit: all seems to work for me.

sdsheridan’s picture

Subscribing.

laura s’s picture

Another data point: Have applied #75 patch and it works swimmingly on two sites. Since this is a pretty important feature, I hope this gets a formal review and committed soon. Thank you everyone for working this so thoroughly!

drupalina’s picture

is any of these patches in .dev yet - can't wait to test.

I'm especially concerned with search results - people search for names, and because Drupal searches content first (end-users tend to ignore the top "Users" tab is search results), Content Profile item comes up first -- and that Title of the Content Profile in search results too should redirect to that user's profile page.

drupalina’s picture

Update: I've tested #75 and it seems to work fine for my needs.
(I don't yet know what implications it will have on the CPU and memory when there are more than 50 simultaneously logged in users all searching for each other, but let's hope that it will not put too much strain)

Michsk’s picture

if you don't want to wait for a version in which you can use this. You can set the content profile path (in pathauto) the same as your users path, works like a charm.

tevih’s picture

thanks! works perfectly!

sdsheridan’s picture

We found an issue with the following in function content_profile_nodeapi().

      elseif (arg(0) == 'user' && (arg(2) == 'edit' || arg(2) == 'profile') && arg(3) == $node->type) {
        if (content_profile_get_settings($node->type, 'edit_page_redirect') == USER_PROFILE_TO_CONTENT_PROFILE) {
          drupal_goto('node/' . $node->nid . '/edit');
        }

In particular, it is possible for the $node->nid to be not set if the node doesn't exist. The result is a URL like node//edit (or node%2F%2Fedit), which of course, does not exist. Getting here happens when a user had "administer node" permissions, but the node does not yet exist, and they have clicked a "Create your [content type]" on the profile display page, or the [content type] tab on the user edit page. There needs to also be an isset($node->nid) condition here too.

Shawn

osopolar’s picture

Status: Needs work » Needs review
FileSize
6.51 KB

Please review changes again and leave a comment here.

cdonner’s picture

Works like a charm and does exactly what was needed. Thanks!
One small caveat is that the 'me' Aliases module no longer works. Links to user/me/profile are redirected to node/xx/edit as well.

Michsk’s picture

ositoblanco: did you find any time to take a look at the me issue? And fago did you have time to check ositoblanco's patch? This is a major issue but in my eyes does not get enough attention.

osopolar’s picture

to #86:

One small caveat is that the 'me' Aliases module no longer works. Links to user/me/profile are redirected to node/xx/edit as well.

I had a short look on me module and the content profile code in question:
user/me will be the same as user/{uid} and user/me/edit the same as user/{uid}/edit. Therefore I think user/me/profile shouldn't redirect to the node edit page.

In my local installation I set the content profile settings to:
"Redirecting profile content: Redirect user profile to content profile node"
"Redirecting profile edit: Redirect content profile user edit to content profile node edit"
with the following results:

  • user/me doesn't redirect the profile page is shown => Fail => Fixed by current patch.
  • user/me/profile doesn't redirect the profile page is shown => OK
  • user/me/edit doesn't redirect the profile edit page is shown => OK
  • user/me/edit/{content profile name} redirects to node/{content profile nid}/edit => OK

For the settings:
"Redirecting profile content: Redirect content profile node to user profile"
"Redirecting profile edit: Redirect content profile node edit to content profile user edit"
with the following results:

  • node/{content profile nid} redirects to user/{username}/edit => OK
  • node/{content profile nid}/edit redirects to user/{uid}/edit/{content profile name} => OK

Maybe it should redirect to user/me or user/me/edit/{content profile name}, but this should be done by the me module.

Michsk’s picture

ositoblanco i think you did a great job at this. For the
Maybe it should redirect to user/me or user/me/edit/{content profile name}, but this should be done by the me module.
1) you are right should be done by the me module, but 2) this really isn't an issue.

Thanks!

rryyaann_19’s picture

Would love to get this working, but not sure what I am doing wrong as no new options are appearing in the content profile tab of the CCK content type I am using for my content profiles.

I have a applied patch and rebuilt the theme registry, any thoughts?

rryyaann_19’s picture

FileSize
45.1 KB

sorry a little more info, I do not know anything patches, just how to applying them, althought this is the message I am recieving when applying the patch.... see image

patcon’s picture

Was just coming on to supply another patch, as drush_make can't deal with the one on #88.

The issue is that CVS or Git is adding a prefix of "a" or "b" to the path near the beginning of the file:

+ a/...
- b/...

You could still apply it with:
patch -p1 < this-is-a-patch.patch

Using -p1 instead of -p0 tells the patch tool to strip the first dir (the "a" and "b") from the path. To avoid this snafu while creating a patch with git, add the option --no-prefix. (Presumably the same for CVS?)

So to create a standard-format drupal patch, you'd use git diff [commit-edit] [commit-original] --no-prefix > this-is-a-patch.patch

But to automate this with drush make, I needed to re-roll anyhow, so here it is :)

Cheers

patcon’s picture

Just a heads up that the Page Manager Redirect module might offer a more generic solution. Perhaps it might be worth integrating rather than building new features? Just playing around with it now, and I'll keep you guys posted if I find a more elegant technique (a packageable feature or something)

Cheers all!

Michsk’s picture

I would rather see a function like this, which in my eyes belongs in this module, to be in the module itself. Instead of installing another module to do something like this.

And this feature is basically allready done, just needs to get commited.

Q2U’s picture

Subscribe

brianmercer’s picture

Subscribed. Patch at #92 applies and works for me, thanks.

gigantortron’s picture

Subscribed. Thanks for the patch, @patcon.

Will this be merged into the module at any point?

Fozzie’s picture

Subscribe.

alexiscott’s picture

Here is a patch based on #75, which was working, but we wanted it so that if a user is logged in and looking at their own page they stay at user/* and do not get redirected to the content profile node. The reason for that is that on the user page there are various tabs added by other modules and we do not want the user to lose the ability to see and edit those.

jruberto’s picture

+1 on using rules to accomplish this:

ON event 'Content is going to be viewed' IF viewed content is Profile, DO page redirect to user/[author:uid]

Fast, simple & effective solution until something more permanent makes it into the module. Seems to be compatible with me aliases as far as offering an "edit my profile" link.

zdean’s picture

subscribe

YK85’s picture

@jruberto - is current rules integration allow all functionalities discussed here? Or does rules integration need to be worked on?

osopolar’s picture

-100 on using rules to accomplish this:

If you are already using rules this would be ok, but I think there is no need to install rules if just the content profile module itself could provide this functionality.

patcon’s picture

I guess I'm of the mentality that closer integration of modules with rules is the future. Seems like it will help make module logic pluggable and configurable without hacking or forking. But that's just my preference. I find I'm using it in more and more sites, along with context, spaces, and features. Seems to be the future, if you ask me :)

I'm starting to think of it as the next Views. It used to be that people wrote their own queries for kicks (seeing Views as bloat for beginners), but as performance increased, Views became more and more the no-brainer approach.

earthangelconsulting’s picture

re: #103 - does anyone know how bad the overhead is in using Rules? i worry that it's too cpu/db-intensive for things that could be accomplished more simply otherwise... but i don't really have proof of that

re: #88 - THANKS ositoblanco, i applied this patch (to 6.x-1.0) and it worked like a charm! NICE WORK!

hello maintainers: any chance we could just have #88 just put into the next version of the module, hmm? :-)

cheers
Peter 'Fish' Fisera
Earth Angel Consulting

patcon’s picture

j0e’s picture

thanks for this patch...i don't think you should have to make a foray over to rules to fix a problem like this which is quite internal to content profile...

here's my vote that functionality in #92 gets included in content profile...and most importantly, thanks to jumpfightgo #17 for creating it...real lifesaver!

capellic’s picture

THANK YOU ALL for all the work. This has always been a source of confusion and frustration for me. The addition of this configuration field makes this module unstoppable! I've applied the patch in #99 and I say roll into the DEV version.

capellic’s picture

Here is a patch based on #75, which was working, but we wanted it so that if a user is logged in and looking at their own page they stay at user/* and do not get redirected to the content profile node. The reason for that is that on the user page there are various tabs added by other modules and we do not want the user to lose the ability to see and edit those.

@arcX: In my case, I've done some theming work on the profile node (overriding as a panel) to show links to edit their account page. Therefore, I don't need the acting user to see user/* if they looking at their own account page. Would be great if there was a fourth option here that would NOT make this accommodation and simply send everybody to the profile node. Thanks for your work on this!

mpaler’s picture

Patch in #92 works nicely for me. +1 for inclusion.

katherinecory’s picture

Patch #92 worked for me to when redirecting the user view to the content profile.

jgraham’s picture

Status: Needs review » Reviewed & tested by the community

Patch #92 worked for me after setting 'Redirect content profile node to user profile' at '/admin/content/node-type/profile/profile'

Ran through coder module after applying patch and only issues were for details unrelated to this patch.

Changing to RTBC as several users have indicated the patch works for them.

batje’s picture

the patch in #92 works for me

fago’s picture

Status: Reviewed & tested by the community » Needs work

From #68:

I don't like this option. Having too much options quickly clutters the options page. Also I don't think this is needed - when there is no link to it people won't find it.

I'm still thinking we should only add the 'view redirect' option. Let's avoid unnecessary complexity in terms of UI and code.

+define("CONTENT_PROFILE_TO_USER_PROFILE", 1);
+define("USER_PROFILE_TO_CONTENT_PROFILE", 2);

Second define violates the module namespace.

capellic’s picture

I discovered a compatibility issue with Panels. If you have enabled the user view panel (/user/%user), then you need to be sure you add the selection criteria that makes it so the viewing user is the same as the user page, else the redirect will be ignored.

chinita7’s picture

@patcon
Have you worked out how to configure Page Manager Redirect module to redirect node/ to user/ ?
I'm trying to but don't find how ... Thanks

mattcasey’s picture

Subscribe. Would love to see this in dev and not have to install yet another module

xtfer’s picture

Despite its minor issue, the patch at #92 is working well.

hixster’s picture

I've applied the patch in #92 and have both redirect options enabled for node edit and node view to redirect to user profile and user profile edit like so:

Redirecting profile content:
Redirect content profile node to user profile = TRUE
Redirecting profile edit:
Redirect content profile node edit to content profile user edit = TRUE

Viewing a node redirects to the user account as expected, but when editing I am redirected to the current page.

Any pointers?

ShaunDychko’s picture

#92 worked for redirecting from content profile node to user profile, but #99 did not.

hixster’s picture

Subscribing

FiNeX’s picture

@hixster: please use the big green follow button on the top when you want to follow a discussion.

franksweb’s picture

Patch in #92 works nicely for me too.

mattcasey’s picture

+1 for 92

amstel’s picture

#92 worked for me, but I had to alter the path in the patch file to match my Open Atrium installation /profiles/openatrium/modules/contrib/content_profile/

Used Patch Manager to apply patch.

YesCT’s picture

Component: Base module » Views integration
Category: feature » support
Priority: Major » Normal
Status: Needs work » Reviewed & tested by the community

@Sepulfull
did you apply the patch from #99 and it worked for you?
Let us know what you did to test it when you moved it from needs work to rtbc.
Also, do you think @fago's concerns in #114 have been addressed?

YesCT’s picture

I think the tag was added by mistake.

Sinan Erdem’s picture

I think he is a spammer...

YesCT’s picture

Component: Views integration » Base module
Category: support » feature
Priority: Normal » Major
Status: Reviewed & tested by the community » Needs work

thanks. putting values back.