Drupal 6 Version of User Titles module

sergeant - April 8, 2008 - 12:10
Project:User titles
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Steven Merrill
Status:closed
Description

any plans on that? Would like to see one for my community site

#1

sergeant - April 8, 2008 - 14:06
Category:feature request» support request

#2

parrottvision - April 16, 2008 - 18:32

yeah - would be dead keen to have this module go into 6 - any one still support it?

#3

BakerQ - April 19, 2008 - 16:26

Also interested in a D6 version.

#4

tonnyl - May 16, 2008 - 20:05

Anything new about this or is there another module that we can use for 6.2?

#5

Fayna - June 26, 2008 - 23:18

I don't think there is another module like this one.

#6

Psicomante - July 20, 2008 - 12:12

First Step.

updated .info
updated .install
updated .module (for now only hook_help, hook_perm, hook_menu)

NOTE: this module DOES NOT WORK. Please DO NOT USE it if you're not a developer.

INFO: release for 6.x uses User_stats module, because it creates a profile value that counts posts. If you use this on a forum, with advanced forum, i think it will be useful and do not duplicate a value/table.

AttachmentSize
user_titles.zip 13.72 KB

#7

luisfeng - July 31, 2008 - 17:48

What about your version of user_titles? Works fine or not?

#8

Psicomante - August 7, 2008 - 15:01

NOTE: this module DOES NOT WORK.

#9

Justin W Freeman - September 8, 2008 - 23:40
Status:active» needs work

Just to let you know that we will be porting this module to D6. We'll happily accept any patches to help the process along :)

#10

Steven Merrill - October 19, 2008 - 22:20
Status:needs work» needs review

Hey - here's a complete module directory .zip, upgraded for Drupal 6 with schema support and recalculating of titles when the types change, rather than truncation, as in Drupal 5.

AttachmentSize
user_titles_drupal_6.zip 31.96 KB

#11

quicksketch - October 20, 2008 - 17:43

Could you also provide a patch version? It's difficult to tell what changes were necessary.

#12

Justin W Freeman - October 20, 2008 - 19:50

Patch file for user_titles-6.x-1.x-dev against user_titles-5.x-1.x-dev attached.

AttachmentSize
user_titles-6.x-1.x-dev.patch 12.89 KB

#13

Justin W Freeman - October 20, 2008 - 19:54
Title:version 6?» Drupal 6 Version of User Titles module

#14

Steven Merrill - October 20, 2008 - 22:28

There's still two more bits to fix - db_last_insert_id() in 6 is NOT a proper analog to 5's db_next_id(), and I can remove a bit of code from the rebuild function. We can probably also add in that recalculate functionality to the 5 version. I'll issue a patch once I truly slay db_last_insert_id(), or what used to be db_next_id() in the 5 version.

#15

Justin W Freeman - October 21, 2008 - 22:12

Agreed, I tested this last night and there are quite a few things still to iron out. I am working on an updated patch but its not likely to be finished till mid-next week due to other commitments.

#16

batbug2 - October 28, 2008 - 07:28

subscribing

#17

Lucretia9 - October 28, 2008 - 13:09

I've tried to get this to work, but it fails. I tried adding the _phptemplate_variables from the README.txt, but then found out it was deprecated in 6. So, I tried adding the following file user-titles-preprocess.tpl.php to my current theme (the root of themes/pixture):

<?php
function user_titles_preprocess(&$variables) {
  if (
module_exists('user_titles')) {
   
$variables['user_title'] = user_titles_get_user_title($variables['node']->uid);
  }
}
?>

I also tried naming the file user_titles-preprocess.tpl.php but this still didn't work. I'm not sure if it should be a hyphen or underscore, eithe way, this didn't display anything in the advanced_forum.

I also set up a block to be displayed in the profile using the code from the README.txt, this doesn't display either.

Luke.

#18

Shyin - November 1, 2008 - 15:22

Would love to see this also.

Shyin

#19

batbug2 - November 2, 2008 - 12:47

I made User Titles work in D6 by modifying one of its functions. Now UT depends on UserStats module. My mod was to grab number of posts from UserStats and to not count them by itself. And after that User Titles are working again and stuff like "user_titles_get_user_title($variables['node']->uid);" work again, too.

#20

Lucretia9 - November 2, 2008 - 22:49

Is this included in CVS or something?

#21

Steven Merrill - November 3, 2008 - 02:56

Here's a newer version of the patch with some improved validation. (This patch is again against CVS HEAD.)

AttachmentSize
user_titles_6_port_2.patch 13.94 KB

#22

Lucretia9 - November 3, 2008 - 12:54

Ok, the patch does apply to HEAD ok, but why has no-one updated the instructions for D6? Doesn't the variable preprocess have to go into a separate file now?

Why the hell can't this be some sort of element that gets displayed automatically like all the other modules?

Luke.

#23

Michelle - November 3, 2008 - 18:42

Displayed automatically where?

Looking at the patch, it appears to still be using _phptemplate_variables, which is wrong for D6. The variable should be added using preprocess_node. Then there's nothing for the end user to add to template.php. But, it would still be up to the end user to decide where in the node template to place the variable.

Michelle

#24

Lucretia9 - November 4, 2008 - 18:31

Ok, I seriously must be missing something here. I'm a complete newbie to Drupal, I've not gone into the code (yet) and at this point, I don't feel comfortable doing that either. I've opened up user_titles.module and added this to the end:

function user_titles_preprocess_node(&$vars) {
$vars['user_title'] = user_titles_get_user_title($vars['node']->uid);
}

There wasn't a function called preprocess_node or user_titles_preprocess_node (I've tried them both). Nothing appears in the advanced_forum. Unless this needs to go somewhere else? Where does this function need to go? What does this function need to be called?

And when I say displayed by default, I mean for example in the profile, the profile displays the user's points why not the user's title as well? I didn't have to set that up, it's done for me.

Luke.

#25

Michelle - November 4, 2008 - 20:06

Well, sure, the module could dump it on the user page like so many others do. It's not terribly useful there, though. Most people want it on the nodes and for that you need to add it to the node template.

That function you have there should get you a $user_title variable in your node template. Then you just need to print it.

Michelle

#26

Lucretia9 - November 4, 2008 - 21:11

Ok, so that's the correct name for the function and the correct place to put it? Yes?

Why then does it not get printed in the advanced_forum? The code is there to print it out, but I see nothing.

Luke.

#27

Michelle - November 4, 2008 - 21:34

Well, it's hard to guess where you may be going wrong... Just to confirm:

1) You've confirmed that user_titles_get_user_title($vars['node']->uid); actually returns the proper title?
2) Somewhere in advf-forum-post.tpl.php you added the line <?php print $user_title; ?> ?

Michelle

#28

Lucretia9 - November 4, 2008 - 22:06

1) Have no idea.
2) Inside advf-author-pane.tpl.php there is:

<?php
if (!empty($user_title)):
?>

<?php
print $user_title;
?>

<?php
endif;
?>

This is not being added into the final result. I've enabled the module in the settings.

Thanks,
Luke.

#29

Michelle - November 4, 2008 - 22:53
Status:needs review» needs work

The author pane is a completely different issue. That has nothing with changing the patch to use the node preprocess, which is what we were talking about here. I thought you were testing the change by adding the variable print to the forum node template. If that's not what you're doing, let's not derail this issue.

Setting this back to code needs work because it needs to be rerolled to use the node preprocess.

Michelle

#30

Steven Merrill - November 10, 2008 - 04:16
Assigned to:Anonymous» Steven Merrill

Yep - sorry about that. I ported this for a project that we're currently working on, so I was only concerned at the time with getting it working for our sites in specific.

As for getting this value somewhere more accessible to end users, since you have to choose what nodes to count, do you think it would make sense to include the user's title in a node preprocess only for the chosen node types, or for all of them?

I suppose that could be dealt with in a preference screen. Then from there we could look at an option to display this information in the user profile page or the advforum's author pane.

#31

Michelle - November 10, 2008 - 04:42

@Steven - I don't think it's a good idea to just tack it onto the node via this module. The best thing, IMO, is to make the variable available to the node template via the node preprocess. Then it's just a matter of printing the variable. For Advanced Forum, see the other issue I linked to. Once that code is in place, AF users won't need to do anything special for user titles to work.

Michelle

#32

Steven Merrill - November 11, 2008 - 06:25
Status:needs work» needs review

Okay. Here's a new patch. Improved in this one:

1) Better recalculation of user titles.
2) Updated README.txt which is useful to humans, not referencing _phptemplate_variables().
3) Implementation of a node and comment preprocess to provide the $user_title var.
4) Bugfix for comments such that only comments on the nodes of the selected types will be counted. (Should probably get backported.)

Please test and enjoy so we can get a release out there!

AttachmentSize
user_titles_6_port_3.patch 16.53 KB

#33

Justin W Freeman - November 11, 2008 - 06:34

Great work Steven (without having tested it yet)

#34

logicbug - December 7, 2008 - 14:12

Can we get a fully patched module uploaded, my attempts at applying the patches arn't working out very well...

#35

Justin W Freeman - December 8, 2008 - 02:37
Status:needs review» fixed

Thanks for the patch Steven.

I have created a 6.x-1.x-dev version from the patch plus a couple of other minor changes regarding the D5 - D6 change. So the 6 dev version should be up in the next 12 hours sometime.

Also, HEAD is now the D6 version.

#36

logicbug - December 8, 2008 - 22:39

Thanks, its almost working great. but I think it's a coding error on my end. When I try to print the $user_title it only prints if I have overridden the default title...

i.e. <?php print $account->user_title; ?>

#37

Justin W Freeman - December 8, 2008 - 23:01

There was a bit of a mix up in CVS with branching so the 5.x-1.x-dev version is currently actually the D6 version.

All the branches have now been sorted out though so when the update script next runs the dev versions will all be correct.

#38

System Message - December 22, 2008 - 23:02
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.