Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When anonymous users post to forums the user information shows "joined 1970-01-01" and the post count is the total of anonymous users' posts. Obviously, we'd like to avoid that. So we need to check if the user is registered in the code that's added to template.php like this:
...
<?php // BEGIN AUTHOR JOIN DATE DISPLAY ?>
<?php
global $user;
if (isset($joined) && $user->uid) { ?>
<div class="author-regdate">
<?php print t('Joined:') . ' ' . $joined; ?>
</div>
Same goes for the post counts and the online icon.
Comment | File | Size | Author |
---|---|---|---|
#5 | advanced_forum-no-anonymous-info.patch | 2.01 KB | Natalie@drupal.ru |
Comments
Comment #1
Natalie@drupal.ru CreditAttribution: Natalie@drupal.ru commentedOops, I meant forum-thread.tpl.php
Comment #2
Natalie@drupal.ru CreditAttribution: Natalie@drupal.ru commentedCorrection: the code above actually checks the current user but what we need is to check the uid of the node's or comment's author. My guess that it should be done in the module's code and not the theme templates.
Comment #3
Natalie@drupal.ru CreditAttribution: Natalie@drupal.ru commentedI went ahead and did the changes myself. If anyone is interested, I can post the patch here.
Comment #4
MichelleGood idea. I'll add it to the to do list.
Thanks,
Michelle
Comment #5
Natalie@drupal.ru CreditAttribution: Natalie@drupal.ru commentedSorry for the delay... here's the patch.
Comment #6
MichelleHmmm.. You have bad timing. I'm about to rip this section of code apart. LOL! But it will be a while before my changes get into an RC so people can use this patch in the mean time. :)
Thanks,
Michelle
Comment #7
MichelleComment #8
Natalie@drupal.ru CreditAttribution: Natalie@drupal.ru commentedThank you Michele.
It was just a couple of minor changes.
Are you going to incorporate this feature with the new changes?
Comment #9
MichelleYes, I will. I actually didn't get to that code last night after all but it's the next thing I'll be doing for advforum. I want to reuse the code from advprofile as much as I can so I'll be splitting that off into its own area.
Michelle
Comment #10
MichelleAlso want to add to this task allowing anon users to put in name/email/homepage like with comments and showing that.
Michelle
Comment #11
MichelleI did go ahead and add code to not show all the user stuff for anon posters but I didn't take the next step of allowing people to put in their info like with comments. I'm undecided on the best way to handle that right now so postponing this.
Michelle
Comment #12
MichelleI can't think of any good way to do this. Just closing it.
Michelle