Port RelatedContent to Drupal 6

j0hn-smith - February 18, 2008 - 09:19
Project:RelatedContent
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Do you have any idea of when this excellent module will be released for Drupal 6?

Thanks

#1

dolittle - March 1, 2008 - 10:56

I will also apprciate a rough estimate.

Thanks

#2

TBarregren - March 1, 2008 - 11:46

Since RelatedContent depends on Views, it cannot be upgraded to D6 before either Views 1 has been upgraded to D6, or Views 2 for D6 has stabilized and has an upgrade path from Views 1.

#3

NikLP - July 14, 2008 - 13:57

Views 2 in RC now :)

#4

greggles - August 21, 2008 - 19:04
Title:Timeframe for Drupal 6?» Port RelatedContent to Drupal 6

subscribe (and better title...)

#5

momper - August 23, 2008 - 16:00

subscribe

#6

yurtboy - August 27, 2008 - 21:52

Same here this is a great module.
Does the developer need help?

#7

TUc - August 29, 2008 - 20:17

Why not use CCK and nodereference field instead? Sure it's a great module. But with some creativity nodereference could do the trick...

#8

aries - September 30, 2008 - 18:13

+1

#9

yurtboy - October 9, 2008 - 01:43

I have used cck node reference and it is a replacement but I do think it is missing some of the features like a tabbed view of all the nodes to choose from etc.

#10

rrlange - October 11, 2008 - 12:21

subscribe

#11

pauline_perren - October 27, 2008 - 04:13

subscribing

#12

rrlange - October 27, 2008 - 20:57

subscribing

#13

manuprevention - October 29, 2008 - 09:09

subscribe

#14

Manuel Garcia - November 4, 2008 - 13:13

I also would like to see this ported to drupal 6. So I went ahead and ran the coder module on d6 on this.

Users: please note that you can easily do this yourselves to help out in the process, remember drupal is collaborative ;)

Here are the only two files that returned results (I reformatted it for easy reading)

relatedcontent.module

  • CRITICAL Line 3: New syntax for .info files, use dependencies[] (Drupal Docs)dependencies = views
  • CRITICAL Line 9: New syntax for .info files files requires core=6.x (Drupal Docs)
  • CRITICAL Line 188: new hook_theme() function is required to register theme_ functions (Drupal Docs)
    <?php
    function theme_relatedcontent($output, $grouped = null, $node_type = null, $teaser = null, $page = null) {
    ?>
  • CRITICAL Line 344: hook_form_alter() parameters have changed (Drupal Docs)
    <?php
    function relatedcontent_form_alter($form_id, &$form) {
    ?>
  • CRITICAL Line 365: The arguments to hook_help() have changed (Drupal Docs)
    <?php
    function relatedcontent_help($section='admin/help#relatedcontent') {
    ?>
    Explanation: Change the first two lines to
    <?php
    function yourmodule_help($path, $arg) {
    switch (
    $path) { ...
    ?>
  • CRITICAL Line 699: The parameters for form validation and submission functions have changed to $form, &$form_state. (Drupal Docs)
    <?php
    function _relatedcontent_form_alter_node_type_submit($form_id, $form_values) {
    ?>
  • CRITICAL Line 702: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
     
    if (!$form_values['views']) return;
    ?>
  • CRITICAL Line 705: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
      $type
    = $form_values['type'];
    ?>
  • CRITICAL Line 706: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
     
    foreach ($form_values['views']['enabled'] as $vid => $enabled) {
    ?>
  • CRITICAL Line 707: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
        $weight
    = $form_values['views']['weight'][$vid];
    ?>
  • CRITICAL Line 708: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
        $title
    = $form_values['views']['title'][$vid];
    ?>
  • CRITICAL Line 794: The parameters for form validation and submission functions have changed to $form, &$form_state. (Drupal Docs)
    <?php
    function _relatedcontent_form_submit($form_id, &$form_values) {
    ?>
  • CRITICAL Line 797: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
     
    if (!$form_values['nodes']) return;
    ?>
  • CRITICAL Line 803: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
     
    foreach ($form_values['nodes'] as $vid => $nodes) {
    ?>
  • CRITICAL Line 836: replace $form['op'] with $form_state['values']['op']
    <?php
      $page_number
    = _relatedcontent_form_get_next_page_number($form, $form_values['page_number'], $form_values['op']);
    ?>
  • CRITICAL Line 1010: #multistep is gone, use $form_state instead
    <?php
      $form
    ['#multistep'] = true;
    ?>
  • CRITICAL Line 1018: The parameters for form validation and submission functions have changed to $form, &$form_state. (Drupal Docs)
    <?php
    function _relatedcontent_form_view_submit($form_id, &$form_values) {
    ?>
  • CRITICAL Line 1022: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
      $vid
    = $form_values['view_id'];
    ?>
  • CRITICAL Line 1025: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
      $offset
    = $form_values['page_number'] * $form_values['page_length'];
    ?>
  • CRITICAL Line 1026: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
      _relatedcontent_track_update_selected_nodes
    ($nid, $form_values['nodes'][$vid], $offset, $form_values['page_number']);
    ?>
  • CRITICAL Line 1029: replace $form['op'] with $form_state['values']['op']
    <?php
     
    if ($form_values['op'] != t('Update')) return false;
    ?>
  • CRITICAL Line 1029: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
     
    if ($form_values['op'] != t('Update')) return false;
    ?>
  • CRITICAL Line 1029: Submit handlers use $form_state rather than returning urls (Drupal Docs)
    <?php
     
    if ($form_values['op'] != t('Update')) return false;
    ?>
  • CRITICAL Line 1032: use $form_state['values'] instead, which is where the values are stored after a submit
    <?php
      $nodes
    = _relatedcontent_track_finalize($nid, $vid, $form_values['page_length'], $form_values['max_page_number']);
    ?>
  • CRITICAL Line 1037: Submit handlers use $form_state rather than returning urls (Drupal Docs)
    <?php
     
    return "node/$nid/relatedcontent";
    ?>

relatedcontent.install

  • CRITICAL Line 69: Use the new Schema API to create and drop tables rather than db_query() (Drupal Docs)
    <?php
    _relatedcontent_install_db_query
    ('DROP TABLE {relatedcontent}');
    ?>
  • CRITICAL Line 70: Use the new Schema API to create and drop tables rather than db_query() (Drupal Docs)
    <?php
      _relatedcontent_install_db_query
    ('DROP TABLE {relatedcontent_view}');
    ?>

Hope this helps!

#15

peter-boeren - December 9, 2008 - 15:10

Hi all,

I am also fan of this module in Drupal 5. I noticed that Thomas hasn't replied on the issues queue for the last 11 weeks. Does anyone know if he's busy, on holiday, or having babies? I'm also looking forward to the port for the last few weeks. I've started working on a port of the module last week.

I was a bit impressed by the nice structure of the module. While porting this module I use the follow working order:
1. Make it work
2. Make it right
3. Make it fast

Currently I'm at stage 1. The basic flow now works with views 2 and Drupal 6. I'll post a early version on this forum this week so others can test it. After the feedback we can go on to stage 2.

see you later

#16

Manuel Garcia - December 9, 2008 - 15:12

Thanks for taking the initiative peter-boeren!

Will keep an eye on it for testing in the future :)

#17

greggles - December 9, 2008 - 15:12

@peter-boeren: in general, it is best if work to "port" a module stick strictly to item 1. Post a patch once it works.

Any bug fixes or performance changes in 2 and 3 should be made as separate issues in the queue so they can be evaluated on their own merits and perhaps backported to the 5.x version.

#18

Hilal - December 20, 2008 - 20:37

subscribing

#19

peter-boeren - December 21, 2008 - 18:14

Everyone,

I'm now at a point that the basis functionality has been ported. Still a lot of work needs to be done... but hell yeah it's almost christmas so time is on our side. The following notes describe the status of porting related content module to Drupal 6.x

Changelog 21-12-2008

/**
* Port from D5 to D6. D6.x alpha
*/
- Basic functionality has been ported meaning a relation can be created between nodes by using the result of a view.

- Installer has been enriched with hook_schema so a full uninstall is possible. Thomas already achieved much of the functionality in D5 that is now covered by hook_schema.

- API function in relatedcontent.module haven't been ported yet. So modules depending on this module probably won't work in this stage.

- Hook menu needed a lot of love because of the changes between D5 and D6. With the help of wild-card loaders is determined if a view has to be shown as a local task.

- Also in favor of hook_menu I introduced a permission in hook_perm because real live checking if a user has update access on a node is only possible with a wild-card loader of hook_menu. I thought this was more transparent.

- implementation of hook_theme was of course needed.

- .help file needs a review. I have not checked if the information is still accurate.

- After changing a node-type now the menu is being rebuild in order to a update the local tasks defined in hook_menu

- added drupal pager functionality instead of "Next" button in D5
- ordinal number and weights functionality are not yet ported

-This version works with Views 2. Only views with a 'node' as base table are shown in the list of a node-type. Even if it is 'node' a base table than related content might not show result. The archive or glossary view is a good example. This view gives as a result a page: November, 2008 (121)
- relatedcontent.tpl.php template is not yet supported

- Code needs some love and care. It contains lines of code that are no longer in use.

- code that has been added needs documentation

- module needs some nice tests (simpletest)

I hope you all can provide me with feedback, issues and bugs to improve this version of the module. If anyone want to write some automated test then please let us know what you're testing so others can focus on other parts of the module.

gr. Peter

AttachmentSize
relatedcontent_d6.png 106.66 KB
relatedcontent_port_d6_alpha.tar_.gz 29.96 KB

#20

Hilal - December 21, 2008 - 18:44
Status:active» needs review

Thanks will give it a twirl. Changing the status to 'code needs review' so others will also give it a look?

#21

peter-boeren - December 21, 2008 - 20:18

Indeed. forgot to change the status. Thanks Hilalsuhaib

#22

fletchgqc - March 23, 2009 - 18:27

I tried the version in #19 and it's working pretty well for me. I've never used this module before, but I like it. For some reason I get the word "Page" appearing in an h3 above my related content listing though, that's really weird. Maybe it was something I did?

#23

jjalocha - May 17, 2009 - 01:47

Peter, are you still working on this code? Are there any users interested in this?

I downloaded and installed under Drupal 6.12, and got a huge warning that messed up the whole page layout. Here's the first part of it:

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /home/jjalocha/www.mysite.com/sites/default/modules/relatedcontent/relatedcontent.module on line 189
# [tabs] => List
# Uninstall
[title] => Modules [closure] => [body_classes] => not-front logged-in page-admin one-sidebar sidebar-left [tabs2] => ) [template_files] => Array ( [0] => page-admin [1] => page-admin-build [2] => page-admin-build-modules ) [content] =>

This module looks very interesting, and might be what I need right now. It's a pity we dont see much feedback on the D6 port.

Thank you, Peter,
Regards,
Jerzy

#24

sunmara - May 17, 2009 - 01:59

hmm, thanks, i test it now..

#25

peter-boeren - May 18, 2009 - 07:04

Hi jjalocha,

at the moment it is under a thick pile of dust due to my normal daily work. When I started porting Drupal was still at Drupal 6.2 or 6.3 I'm not sure if Thomas Barregen still wants to work on this module because when you look strictly at the functionality than it is nothing more than relating to nodes through views. This is also possible by using CCK with node reference. So maybe this module is getting deprecated

what are your thoughts?

regards,

Peter

#26

jjalocha - May 18, 2009 - 12:45

Peter, as I am very new to Drupal, I still miss a lot of knowledge about many essential topics.

From its description, RelatedContent looks the most promising module to me, but I found a few modules that might provide the functionality I am looking for. (Attach one node to another, eg. Student/Teacher types, by a user who is not the author.) Due to the lack of a D6 port of RelatedContent, I was experimenting right now with the Relativity module. But I am not sure yet, if I am using it too far from it's intended use-case, and if it isn't overkill for my page.

I have only used Views to create simple "indexes" of nodes. I don't know, if it can be used to create links/relationships between nodes. I do know, that Node reference is not viable in my case, because other users that are not the author must be able to attach one node to another, and I would like the relationship to be two-ways. But I will take a very close look to Views, because I know, that I am using only a small fraction of its functionality.

Thank you very much for your interest, Peter,
regards,

Jerzy

#27

enkara - May 20, 2009 - 08:34

I use this module to send news through the newsletter (simplenews). When I found the problem the only solution I found was to use related content in the newsletter issue. It works really well.

I don't know if now there's a better solution (if someone knows one please tell me!) but I think this module is not deprecated at all and it has different capabilities than node reference.

Would make me happy to see a D6 version.

Thank you!

#28

jjalocha - May 20, 2009 - 13:06

I've been doing a review of the available modules for doing relationships between nodes. In my case, i need users without editing permissions to be able to create the link.

CCK Node reference, Node relativity, Node hierarchy, and Node2Node should all be able to do links with Drupal 6. For link creation by users without editing rights, i am trying to get the patch for Node relativity fixed by someone. Else, I would probably have to go back to CCK Node reference with one of the extra modules.

I hope, this helps you find a solution.

#29

Summit - May 20, 2009 - 13:09

Subscribing, interesting in D6 also, greetings, Martijn

#30

greggles - May 20, 2009 - 23:08

@jjalocha - Awesome work! Can you merge that into this comparison of Content recommendation modules?

#31

jjalocha - May 21, 2009 - 00:27

No problem, Greg, it's done. I might have added too much information, so you can easily wipe out unneeded parts.

One comment, though: I think this has drifted quite far away from the original "content recommendation modules", and is now probably closer to something like "related content modules". Just my 2c.

Cheers,
Jerzy

#32

eff_shaped - May 29, 2009 - 14:23

subscribing

#33

peter-boeren - June 4, 2009 - 20:08

so guys you suprised me with the need for this module. I'll look into my schedule to see if i can make it the current port at least working with the latest D6.

#34

foxtrotcharlie - June 6, 2009 - 14:02

I'd also be really keen on seeing this ported to D6 :-)

#35

peter-boeren - June 8, 2009 - 05:21

guys,

this weekend I did some work. I tested the module againt the latest versie of Drupal (6.12) and found some minor bugs. One of the things I often do with this module is implementing hook_block to show te related links in a block so I added that to this version as you can see on the screenshot. It shows a item list per view and it honors the names that you can give a view in the contenttype settings. So 'glos' is normally the view called 'glossary'. I think in time the block should get the same options as a contenttype (group by view, author, etc).

I saw that I made a misstake with creating a revision in CVS and therefore the packaging-script put the HEAD version of Thomas to my nightly-build-revision. So when the script runs again a tar.gz will be available for download on the main page of this module. please be patient.

some particular stuff:

#22 can you show my a screenshot?
#23 call-by-reference is very common in Drupal, a node is loaded that way. Don't you get warnings then?
#27 I never tested my D6 port in combination with simplenews. Have you already tried it. I suppose it doesn't work.

kind regards, Peter

AttachmentSize
Screenshot.png 160.25 KB

#36

jjalocha - June 9, 2009 - 12:37

Peter, thank you very much for spending your time on this module again!

Regarding post #23, this is what I did today: A clean Drupal 6 install with the relatedcontent-6.x-1.x-dev CVS version downloaded today 2009-06-09.

Sadly, the warning still messes up my layout, as seen in the attached screenshot.

I can't find anything related to 'allow_call_time_pass_reference' on line 189 of the 'relatedcontent.module' file. But this has to be modified anyway, why isn't it set "from factory"?

Sorry, that I am really quite lost here, but I am very new to Drupal and PHP.

Cheers,
Jerzy

BTW: Anyone knows how to embed an image in the post?

AttachmentSize
Screenshot.png 93.94 KB

#37

z.stolar - June 16, 2009 - 11:33

subscribing

#38

peter-boeren - July 12, 2009 - 07:09
Version:5.x-1.6» 6.x-1.x-dev

After some trouble with cvs, packaging script and so on, the D6 version is finally availalbe for the public. In the last few weeks the following happened

- added a simple block for related content. It does not have yet the same options as for the body, but that is near future.
- fixed post #36 of jjalocha. http://drupal.org/node/223196#comment-1681870
- fiex issue http://drupal.org/node/258281

 
 

Drupal is a registered trademark of Dries Buytaert.