Download & Extend

Author name instead of subject/title in forum topic list

Project:RealName
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

After I installed and updated to 6.x-1.3 my subjects in the forum list went wrong.
The subject list in the terms now shows the author of the node instead of the title. The link to the node is also corrupted.

Comments

#1

I just found out the same thing.

For me, the temporary fix was to comment out line 45 of the file realname_content_profile.inc

<?php
         
default:
           
$account->{$field_name} = $values;
        }
      }
    }
  }
 
//comment out line below
// $account->title = $profile->title;
}
?>

I tried to follow what this function (content_profile_load_profile) is doing, but really found no logic as to why it overrides only forum topics so far. It's being called around lines 755-767 in realname.module. This fix hasn't affected negatively anything on my site yet... so I'm good for now.

#2

I am getting the same thing with the Blog module and RealName 1.3. I haven't tried the suggested fix.

#3

Version:6.x-1.3» 6.x-1.x-dev

As confirmation, this also occurs in the latest -dev snapshot.

#4

I have the same issue. Only for logged in users that have a permission for realnames.

#5

I used the described fix and the forum is working again. But I think this is not a final solution.

#6

The line mentioned in comment #1 is definitely the source of the problem. RealName can potentially blast the title of anything a user could've authored because of it. According to #579040: Some bugfixes, it looks like it was an attempt to fix #487576: Pull RealName from node title (Content Profiles).

#7

Try the patch #21 from #579040: Some bugfixes. Hopefully this helps.

#8

@DrakeRemory - that doesn't solve my problem with Blog titles. All I get is a nicely HTML escaped title, instead of a non-HTML escaped title.

#9

I don't know if mine is the same problem, or a different one. I did the #21 patch, on the most current dev. On my test forum, in the "Created" column, it now shows <a href="/forums/... for the users name. It seems to be working fine elsewhere.

#10

Just spent an age trying to find out why this was happening on a site...

The reason this is happening is because template_preprocess_forum_submitted in forum.module calls theme_username which when taken over by realname eventually calls content_profile_load_profile in realname_content_profile.inc which unhelpfully overwirte the objects title with the node title - the line identified in #1 defintely is the cause. What I do not understand is why it is setting $account->title at all... surely it is supposed to be setting $account->name as this seems to be the point of realname!!!

#11

subscribe

#12

Title:Subjects in forum list corrupted» Author name instead of subject/title in forum topic list

Wow, no one seems to be mentioning a long stressful ordeal just to discover that it was *this* module causing the problem, and not a forum-related one. Must have just been me then.

Thanks everyone, for discovering the bad line of code and thereby lowering my blood pressure to acceptable levels again.

Hopefully a slightly more specific title will make this easier to find in a search.

#13

I have had the same problem these days and I can confirm that the simple patch in comment #1 fixes the problem fine.

Well, it took a lot of time for me too to discover that the problem was in the RealName module and **not** in the Forum module... but I am very glad that it can be fixed because RealName is really very very good.

#14

Here's a patch to remove the line of code that's causing the problem.

AttachmentSizeStatusTest resultOperations
realname_606364.patch582 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch realname_606364.patch.View details | Re-test

#15

subscribe

#16

Status:active» reviewed & tested by the community

I applied the patch again. It works and it is an issue!

Can this be committed please? Thanks

#17

subscribing

#18

I had the most bizarre problem. My forum topics in viewing a forum were all suddenly changed to the title of my most-recent content profile. I tried uninstalling all sorts of modules, flashing all sorts of caches, and updating my database. This patch seems to have fixed the problem.

Why was this line of code even there? What does it do? What effect will deleting it have?

Here's a screen capture:

#19

Sorry. Here's the screen capture.

AttachmentSizeStatusTest resultOperations
Clipboard01.jpg36.76 KBIgnoredNoneNone

#20

This issue had been driving me crazy as well! This patch worked great for me and I agree with ayalon, this patch should be committed.

#21

thanks for the great work

#22

I'm going to go out on a limb and guess that content_profile_load_profile should only be run for users and content_profile nodes ... I bypass the entire routine by putting this at the top (line 12ish?):

  if (($account->type) && (!in_array($account->type, array_keys(content_profile_get_types('names'))))) {
    // Node Type is not not a content profile ... skipping.
    return;
  }

The routine still gets run for accounts that are passed to it ... I have no idea if it should or not, but assume from the $type=NULL argument that it can take both accounts and nodes. In any case, this addition seems to have worked for me for the moment ... and I get to keep my updated titles inside my content profile nodes. :)

#23

any chance of commit to latest dev?

#24

Wow... what a hellish journey it was to track down this bug... I'm glad I found this patch before pulling any more of my hair out. For me the problem was that RealName was overwriting Organic Groups block titles. I can confirm that the patch in #14 fixes the problem.

#25

The patch in #22 also solves the problem, and perhaps is the more correct solution. Thanks, jthorson! I've attached a patch file.

AttachmentSizeStatusTest resultOperations
fix_overwrite_content_title.patch820 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details | Re-test

#26

Verified the patch in #25 fixes the bug. Thanks, jthorson and davisjan.

+1 for getting this committed!

@Dane Powell, yeah, I'm with you on the hellish journey...

#27

confirmed

#28

Committed to 6.x-1.x-dev.

#29

Status:reviewed & tested by the community» fixed

#30

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#31

Priority:normal» major
Status:closed (fixed)» needs work

I don't think you should commit the "fix" in #1. Actually that is not a fix. That line is there for a reason. Try this scenario:

1. Use content_profile as the source module.
2. Configure realname to use the title of content profile as real name.
3. Choose "Override username theme".

Now if you go to the content list, all content's author are replaced by the content's title if you have that one line commented out, except for the profile content type.

The patch in #25 does not fix this problem either because it is just trying to solve the problem from the same point of view.

A correct fix should consider the possibility that profile content title is used as the realname.

I hope this should give someone a correct idea to come up with a fix.

#32

This issue's commit completely breaks realnames based on profile node titles. +1 that it needs work, and see: #876704: Realnames not properly calculated after upgrading to 6.x-1.x-dev (Content Profile/title field)

#33

See also #748986: RealName overwriting Node->$title in teaser view. Might be related or a duplicate of this.

#34

Status:needs work» needs review

Following up on patrickslee's comment 31.
Another way to show that the changes in 22/25 are not quite correct is with the forum module. While it fixes the problem with the forum topic title, the 'created by' information only uses the username, while the 'last reply' properly uses the realname.

This patch somewhat inverts the approach in 22/25.
Instead of exiting the function early if the given object is a not a content profile node, which doesn't replace the title properly if the object is, this patch only replaces the title if the given object is a content profile node.

I am still quite naive to the functionality of the rest of the function, so please test this patch thoroughly.

AttachmentSizeStatusTest resultOperations
realname-606364-34.patch1.01 KBIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in realname-606364-34.patch.View details | Re-test

#35

subscribe, thx ...

#36

#37

#38

My previous patch would prevent realnames from getting generated properly if the Content Profile title was used as part of the realname pattern, since the content profile title was not added to the user object (as required for _realname_make_name())

I think focusing on Content Profile is wrong, and that the title attribute should only be set for user objects passed to the function; node titles should never be touched.
In the following patch, the title attribute is only set on the passed account object if it is a user object (no nid attribute). Any nodes passed to the function, Content Profile node or not, will not have their title altered.

<?php
 
// account is a user object, so add the content profile title to its properties.
 
if (empty($account->nid)) {
   
$account->title = $profile->title;
  }
?>

My only concern is that if a node object is passed in, the realname will then be improperly generated (since it may use the node's title, rather then the correct content profile title). My brief testing has not encountered any issues, but I would appreciate some extra eyes on this area. I don't think that a node should ever be passed in, so if any calls can be fixed this function may not need any modifications other than to uncomment the title assignment line.
AttachmentSizeStatusTest resultOperations
realname-606364-38.patch948 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details | Re-test

#39

subscribing

#40

Thanks you for the great work !
It's working fine for me using patch #38

#41

Thanks for the patch, gapple, #31. However this doesn't fix the problem in the forum when using the node title as the source of the real name. The username links that appear in the Created and Last Reply columns escape the HTML. And then it leaves the usernames unconverted on the discussion page.

I decided to go with patch #34 *AND* change the way that I am generating my real names -- no longer using the node title.

#42

#38 seems to be working for me so far.

Shawn

#43

@capellic
As I noted in #38 with the newer patch, my previous patch in #34 doesn't work correctly with realnames that use the Content Profile title. Did you try the latest patch as well?

@sdsheridan, thank you for testing the latest patch.

--

My current implementations are a forum (with Advanced Forum) using Content Profile fields for the real name, and a views-based Blog using the CP title, so testing in other instances would be appreciated.

#44

closed #748986: RealName overwriting Node->$title in teaser view as a duplicate of this issue.

#45

Status:needs review» reviewed & tested by the community

#38 resolves the issue for me as well.

#46

Thanks! #38 resolve my problem.