I ran the coder (code review) module and it led me through some changes. There are a few remaining issues;

      Line 1126: new hook_theme() function is required to register theme_ functions (Drupal Docs)
      function theme_relatedlinks_types_table($form) {

      severity: criticalLine 63: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
        if ($may_cache) {

      severity: criticalLine 64: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
          $items[] = array(

      severity: criticalLine 72: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
          $items[] = array(

      severity: criticalLine 80: The menu system has been completely over-hauled in 6.x. (Drupal Docs)
          $items[] = array(

relatedlinks.install

      severity: criticalclick to read moreLine 10: A new schema API has been added in 6.x (Drupal Docs)
        switch ($GLOBALS['db_type']) {

      Explanation: This patch caused changes to the format of hook_install(), hook_uninstall(), and hook_update_N(). No longer are switch statements done on $GLOBALS['db_type']; instead, use the variety of schema API functions to perform table manipulation.

      severity: criticalclick to read moreLine 102: A new schema API has been added in 6.x (Drupal Docs)
       switch ($GLOBALS['db_type']) {

      Explanation: This patch caused changes to the format of hook_install(), hook_uninstall(), and hook_update_N(). No longer are switch statements done on $GLOBALS['db_type']; instead, use the variety of schema API functions to perform table manipulation.

      severity: criticalclick to read moreLine 140: A new schema API has been added in 6.x (Drupal Docs)
        switch ($GLOBALS['db_type']) {

Comments

Zen’s picture

If you have the time, please update your patch against 5.x.2.x-dev. Much appreciated - thanks!

hswong3i’s picture

Version: 5.x-1.x-dev » master
Category: bug » task
Status: Active » Needs work
StatusFileSize
new30.52 KB

Patch via latest 5.x.2.x-dev, code clean up with coder.
Able to install required tables, access/update setting pages.
Still need works and input.

mehlvogel’s picture

StatusFileSize
new786 bytes

Hi,

I've applied the patch and checked it, but got some problems which I was able to fix:

1. The path to the relatedlinks.js file was wrong and so file_get_contents() threw an error. The path used was "/modules/..." (note the leading slash, which makes this path an absolute one (at least on a *nix system)). I've added a "." in front of it, thus making it a relative one. I don't know which impact this change has, so someone will review this, I could only say, that this works for me.

2. The theme_relatedlinks() method was not registered, I've fixed this.

I'll append a patch file against the patched source tree. Maybe this is usefull to you, or to other people.

Edit: I have issues using the add manual links thingy while editing a node (everytime I edit a node, the links get changed (even if I don't edit them)) and broken.

Stephan

Zen’s picture

Are you missing some files in your patch, mehlvogel?

Thanks,
-K

mehlvogel’s picture

StatusFileSize
new21.5 KB

Hi,
hmm I don't think there are missing files. But as I've solved my problem from above and added some functionality I needed, I'll just try to append a new patch file. Tell me whether you have problems with it as I'm not very experienced in using the diff program, so hopefully the patch file is useable.

I've appended a patch against 5.x.2.x-dev. It should completely contain the patches posted above and the following additions:

- Corrected the RegEx used to parse the text area in the relatedlinks.js, as the old one has divided a URL by chars like '://' in my Firefox 3 and thus breaking the links when editing a node (as I'm not very experienced in using Javascript, this may cause problems on other browsers).
- Added support for multilingual environments, by only showing discovered nodes of the same language (this behaviour may be disabled in the admin section).
- Fixed the path in relatedlinks_form_alter() as described above.
- Fixed the call to _relatedlinks_taxonomy_select_nodes() in _relatedlinks_get_discovered_links(). The parameter count wasn't correct.
- Fixed the theme hook as described above.

I hope, my changes are useful for you.

Stephan

Zen’s picture

Stephan,

While I do appreciate the changes, it would be best if this issue deals _only_ with the D6 port - no bug fixes and no new features please. Those will need to be spun off into separate issues with separate patches and at the present moment, for D5 unless they are D6 related features.

Thanks again. I'm going to be AWOL for a bit, but I'll check back later.
-K

mehlvogel’s picture

Hi,

allright :), if I'm doing some more changes to that plugin, I'll keep that in mind. So I think, the part related to D6 is completely in my first patch file, if I've forgotten something you need, tell me.

Stephan

cutv’s picture

Is there any news on a timeline for this project? The last post was two weeks ago.

Can anyone suggest any alternate modules/techniques that can achieve a similar functionality in D6?

coltrane’s picture

I applied patch from #2 and only hunk #3 failed. I assume from Zen's and Stephan's comments in #6 and #7 that #2 is the patch to work from.

coltrane’s picture

Version: master » 5.x-2.x-dev

Oh, and the port should happen against DRUPAL-5--2? Or will recent changes make it over to the HEAD branch? Thanks.

Zen’s picture

Yes, please - against 5--2-dev. But more importantly, the patch should be bereft of any new features or bug fixes which should be handled via separate issues.

Cheers!

coltrane’s picture

Status: Needs work » Needs review
StatusFileSize
new19.65 KB

Patch from hswong3i in #2 rerolled. Applies against DRUPAL-5--2. Module installs and configuration works. I haven't tested anything else yet though.

Pedro Lozano’s picture

I applied this last patch and found 2 issues:

1. Autocomplete fields (title, url) in node edit form don't work. I've tried to fix this but didn't get it.

2. There is one theme_ function (relatedlinks) missing in hook_theme.

mbach’s picture

Would someone be so nice and integrate the patches in an initial D6 release?
Thanks for your support!!!

coltrane’s picture

Status: Needs review » Needs work

Rerolled to take care of the missing theme function. Verified autocomplete field not working on node add/edit form. I looked at what might be wrong but haven't discovered it yet. I looked at what nodereference module for CCK 6 does to autocomplete and with just a quick visual compare they look quite a bit different though perhaps something can be learned from noderef's style.

coltrane’s picture

StatusFileSize
new19.68 KB

Attachment didn't make it ... here we go again ...

Pedro Lozano’s picture

The problem with autocomplete is that you have to call Drupal.attachBehaviors() function after adding content to the page from javascript code.

From drupal.js

Developers implementing AHAH/AJAX in their
 * solutions should also call this function after new page content has been
 * loaded, feeding in an element to be processed, in order to attach all
 * behaviors to the new content.

Just add Drupal.attachBehaviors() after you add the textfield and it works.

mo6’s picture

subscribe

coltrane’s picture

@pl2, I'm not sure where you are saying to add Drupal.attachBehaviors(), can you roll a patch or post the code? thanks

Pedro Lozano’s picture

StatusFileSize
new549 bytes

@coltrane, this fixes the autocomplete issue. You may call attachBehaviors or just call the behaviour function that you need for your elements to work, as in this case.

psicomante’s picture

subs

dave reid’s picture

Love this module. Will help test a 6.x-dev branch. Subscribing.

nsilberman’s picture

subscribe

dbooth’s picture

subscribe

dbooth’s picture

I am running Drupal Core 6.3. I've downloaded relatedlinks-5.x-2.x-dev.tar.gz, untarred it and applied patches relatedlinks-6.x-222609-15.patch & relatedlinks-js-6.x.patch. When I go to Administer > Modules I see 'Related Links 5.x-2.x-dev Displays links related to content. This version is incompatible with the 6.3 version of Drupal core.' Have I missed something or can't this be used with 6.3?

Er, scrub that - it was TinyMCE causing the problem with Related Links all along, works fine if TinyMCE disabled.

JeremyL’s picture

Any update on when we might see an official alpha or beta port for 6?

dennys’s picture

subscribe

Antinoo’s picture

+1

chandrabhan’s picture

sub

theabacus’s picture

subscribe

lumi_v’s picture

Any news of a new release of Relatedlinks for drupal6??

I am trying to put relatedlinks in drupal 6.4, I am very new on drupal and not very much experience.
I followed all instruction to patche the modul and still tell me is incompatible . Could somebody help me with a relatedlink modul ready patched .Thanks very much.
Lumi

Somebody help and the module workk now in Drupal 6 but only in admin.For all other users or anonymos does not show the links.Any thoughts????

Anonymous’s picture

I'm waiting for this module upgrade , too

mrfelton’s picture

subscribing.

mimhakkuh’s picture

Subscribe

clint.davis’s picture

Subscribe

burgs’s picture

subscribing

spiffyd’s picture

subs

aledt’s picture

Hi folks, Just a quick update - I've rolled the patches together and deployed this on my 6.8 installation. So far, I've not been able to find any problems specific to RelatedLinks - the only problem I have found is a JS problem with Google Chrome (Add/Update functionality is broken).

I'll keep playing and raise any issues I find. Thanks for the hard work.

derekahmedzai’s picture

When are we likely to see a 6.x-dev release?

marvix’s picture

When are we likely to see a 6.x-dev release?

darumaki’s picture

subscribe

spiffyd’s picture

Those that want 6.x, try the Similiar mod

mrfelton’s picture

@spiffyd: the similar module doesn't really seem to do the same as this.

Anyway, I too have applied all the patches and it seems to be working ok for me so far.

scott859’s picture

subscribe

gustav’s picture

subscribe

bigjim’s picture

StatusFileSize
new27.93 KB
new20.05 KB

here's a patch, to 5.x.2.x-dev, and a full tar ball following the path laid out in #25. It works on a drupal 6.9 install.

I added the core=6.x to the info file and a bogus version just to make it easy to see on the modules page.

mrfelton’s picture

Noticed one bug. I don't know if this is specific tho the Drupal 6 version or not, but since there is no D6 -dev release, this is probably the most appropriate this...

If I add an invalid link (a link to a node that doesn't exist), then the link does not save. It all seems to be fine, and I get no warning that the link is invalid and therefore it will not be added, but when I do finally click save, the link is not actually saved.

moshe weitzman’s picture

The schema of term_node has changed to include a vid column. Thats means we have multiple nid => term records which ruins the taxonomy calculation AFAICT. Nodes with many versions (i.e. have ben edited a few times) are considered more related which is clearly wrong. The latest patch does not address this. I only took a quick look so I could be wrong here.

moshe weitzman’s picture

I solved this in another module with COUNT(DISTINCT(tn.tid))

tjb74’s picture

Get this error with v6 installed when applying taxonomies to uploads:

# user warning: Duplicate entry '255' for key 1 query: INSERT INTO relatedlinks_tracker (nid, keywords) VALUES (422, '') in ../modules/relatedlinks/relatedlinks.module on line 848.
# user warning: Duplicate entry '255' for key 1 query: INSERT INTO relatedlinks_tracker (nid, keywords) VALUES (423, '') in ../modules/relatedlinks/relatedlinks.module on line 848.

nnn’s picture

I see the same errors.

It was caused by the function _relatedlinks_update_discovered_links(), in which it always do _relatedlinks_add_links() and _relatedlinks_insert_tracker() , even if the link already has been added to the node.

The function _relatedlinks_update_discovered_links() was called from the relatedlinks_block(), and it is always called even though I have block caching on.

Could some one please provide a fix to this? I don't have the time these days. Thanks!

shah_waliuallah’s picture

subscribe, any updates on this

mrfelton’s picture

Title: Port to drupal 6.0 » Port Related Links module to drupal 6.x

updateing title to make it easily identifiable in my issue queue.

bigjim’s picture

The issues is the structure of the relatedlinks_tracker table the nid field is set to be a tinyint which has a maximum of 255, the same is true of the lid field in the relatedlinks table. So trying to insert a value of 422 into the nid field mysql converts the to 255 (as that is the maximum value) which it did previously for an earlier post and consequently you get a duplicate key error.

the solution is to change the type of the nid and lid field in relataedlinks_tracker and relatedlinks tables respectively to int in lieu of tinyint.

Z2222’s picture

How far away is the D6 version from completion?

I'd be willing to pay someone to finish putting this together and release even a working dev version for D6 early next week.

If there is a lot of work to do on it, maybe a few of us could chip in to have someone finish it.

Starminder’s picture

subscribe

billybag’s picture

subscribe

dr jason guo’s picture

StatusFileSize
new45.38 KB

I've quickly consolidated the above patches and made it work with D6, any wants to try it and let me know if there are any problems?

markalosey’s picture

I am trying this now and I have not seen any troubles yet....I will post back as soon as I see something funny.

federico’s picture

I've tested #58 and works fine on my localhost

qalkozai’s picture

I tested on localhost and the internal site does not work. I mean when entering an internal related page the database does a query and does not auto complete.

Z2222’s picture

Invisigoth's version (comment #58) works for me.

THANK YOU! :)

(Why not make it live on the modules page so people can find it?)

dr jason guo’s picture

Will certainly do this shortly:-)

vlad79’s picture

Just fixed the table myself after reaching 255 in the in the auto_increment of lid.
Anyways... it seems to me in the fix #58 above the "nid" is still of tinyint type, meaning after adding a node #255 it won't work.
Or may be I missed something.

authentictech’s picture

Is someone still intending to make the Drupal 6 version of this module from comment #58 a live release? Those who've tried it, is it still working without problems for you?

Thanks.

inders’s picture

I tried this mod and got this error:--

user warning: Duplicate entry '255' for key 1 query: INSERT INTO relatedlinks_tracker (nid, keywords) VALUES (341, '') in /home/singh123/public_html/www/indiauser.com/sites/all/modules/inder/relatedlinks/relatedlinks.module on line 848.

inders’s picture

Issue tags: +error, +Drupal, +relatedlink

I got it fixed by Using few code changes. However have not checked rest of code:-

/**
 * Insert a record into the relatedlinks_tracker table.
 * 
 * @param $nid
 *   Node ID of the node to insert a tracker record for.
 * @param $keywords
 *   Search module keywords that will allow discovered links to be calculated
 * using the search module.
 */
function _relatedlinks_insert_tracker($nid, $keywords) {
  if(trim($keywords)){
      $test_obj=db_fetch_object(db_query("SELECT * from {relatedlinks_tracker} where nid='%d' AND  keywords='%s'", $nid, $keywords));
      if(!$test_obj->nid)//means no result from db
        db_query("INSERT INTO {relatedlinks_tracker} (nid, keywords) VALUES (%d, '%s')", $nid, $keywords);
      else
        db_query("UPDATE {relatedlinks_tracker} SET keywords = '%s' WHERE nid = %d", $keywords, $nid);
  }
}
mcurry’s picture

subscribe

kansaj’s picture

Ok I tried to repair the next error after applying the last patch, but somehow cannot get it working.

/**
 * Insert related links into the database.
 * 
 * @param $nid
 *   Node ID of the node to add links for.
 * @param $links
 *   An associative array of URLs and titles.
 * @param $type
 *   The type of the links being inserted as denoted by the type constants.
 */
function _relatedlinks_add_links($nid, $links, $type) {
  foreach ($links as $link) {
    foreach ($links as $link) {
   $test_obj = db_fetch_object(db_query("SELECT * FROM {relatedlinks} WHERE nid=%d AND url='%s' AND title='%s' AND type=%d", $nid, $link['url'], trim($link['title']), $type));
   if(!$test_obj->nid) {   
    db_query("INSERT INTO {relatedlinks} (nid, url, title, type) VALUES (%d, '%s', '%s', %d)", $nid, $link['url'], trim($link['title']), $type);}
	else {
	db_query("UPDATE {relatedlinks} SET url='%s' AND $type=%d WHERE nid = %d AND title='%s'",  $link['url'], $type, $nid, trim($link['title']));
	}
  }

  }
}

nicolash’s picture

subscribe

bkat’s picture

StatusFileSize
new798 bytes

Here's a quick little patch that fixes two annoyances:

1. ignore mailto links
2. Strip html from the link title

the tar file in #58 appears to be working for me on a site that is being upgraded from D5 to D6.

bkat’s picture

StatusFileSize
new1.22 KB

I ran the schema module on my D5 to D6 upgrade and it flag a few mismatches in relatedlinks. I think there are some columns that are erroneously declared as tinyint in relatedlinks.install. The documentation for tinyint on mysql says that a tiny int is 1 byte and its values range from -128 to 128. For all the following columns, I have values in them that are outside this range. Fortunately the D6 upgrade didn't do any alter tables.

relatedlinks.lid - removed size tiny
relatedlinks.nid - removed size tiny, added not null
relatedlinkstracker.nid - changed type to int, removed tiny
relatedlinkstracker.updated - removed size tiny

dr jason guo’s picture

StatusFileSize
new16.41 KB

I've packaged the fix for the problem "Duplicate entry '255' for key..." by altering the schema much like what #72 has done. We are using this patched version for our site running D6.14. Hope this helps.

mrfelton’s picture

Why is development of the D6 branch of this module still taking place in this issue. This has been going on for the best part of a year now - it's crazy! Lets get a D6 branch in CVS and move the development to there.

@zen? I'll happily take co-maintainership of the module and sort it out for you if you like?

dr jason guo’s picture

@mrfeiton - I totally agree and would appreciate if someone could take the responsibility to co-maintain this fantastic module. I've tried to do this a few months ago but didn't pursuit it when I got no response for a while. I'll also try to contact Zen for this and hope we can get the work back on track through a proper channel.

bkat’s picture

Can we fork it if zen continues to be non-responsive?

mrfelton’s picture

No, we won't for it. If we continue to get no response I will ask the drupal.org webmasters to either transfer the project to me or set me up as a co-maintainer. It should take around take 2 weeks from the time I ask them.

mrfelton’s picture

I just put in a request to the webmasters: http://drupal.org/node/656026

@zen, if you read this anytime soon - please could you grant me CVS access so that we can get the code in ticket committed in one form or another.

juerg’s picture

The module as posted above in #73 seems to work fine for Drupal 6.15. However I had to manually apply the following patch http://drupal.org/node/133099#comment-536396

espenmoe’s picture

If it works fine, why did you have to apply the patch?

radiobuzzer’s picture

Hi,

I have started running the code mentioned at #73 in my drupal 6 installation. The module got the settings from the previous installation. But I have a problem:
Anonymous users cannot see the block. I double checked whether it's hidden by the block access settings, but it is not, it has the same settings as all blocks.

drupalina’s picture

I tried #73 - Manual links don't work. After I add a few titles in node's edit and save, none of the added article links are showing up. Then when I go to that node's edit again, there is no mentioning of the added articles. It's as if the module does not remember which articles were added to the story manually.
(The Discovered links block seems to work okey, but, as others are reporting, it's not visible to the anonymous users)

Please-please get this module working for 6.x -- it's a very important module! Thanks for trying to port this to 6.x !

UPDATE: In my logs I found a php error that might be related to the Manual links mulfunctioning:

Duplicate entry '255' for key 1 query: INSERT INTO relatedlinks (nid, url, title, type) VALUES (114, '/87', 'The Title of the Article in non-English', 3) in /home/example/public_html/example/sites/all/modules/relatedlinks/relatedlinks.module on line 710.

espirates’s picture

subscribe

dman’s picture

I have tried out #73, and it's working for what I expected so far. Cheers!

This did a good job for me in D5, and I'm looking forward to getting a D6 branch in CVS we can start to use, now that the maintainer is back in town.

edg’s picture

Thanks to all those who shared their work. Have been using patched version for over a year now on live site and don't appear to have had probs although would like to see an official release

drupalina’s picture

@dman and @edg , Are you able to add manual links to nodes? Do they display in a block?
Also, do the bocks "Manual Links", "Discovered Links" and "Parsed Links" show up for anonymous users too?
If yes, please attach your versions of this module in 6x. Thanks a bunch!

dman’s picture

#73 works with manual links for me!
Block visibility is normal, I'm pretty sure, though not really looked hard yet.

Detected links is a little odd as it uses the contextual text verbatim, when I'd prefer the title of the target (if local), but that's possibly old behaviour and what I want is a feature request.

radiobuzzer’s picture

I found what the problem was, for the module not being displayed to anonymous users. Or at least, partially.

When I enabled the module, I was using the Aggressive Cache (that's a setting at Performance section). The module didn't show up for any of the anonymous user.
I just managed to make it show up again, by disabling the cache for a second, cleaning all cached content, and then re-enabling it.
Unfortunately the block displays the same links, for all articles. If you do a cache clean, the block disappears again. Normal caching has the same problems, but the module doesn't disappear, it just stays the same.

I would suggest there is some template handling for blocks, that is being cached and the related links module doesn't handle properly. Don't forget that Drupal6 has introduced caching for blocks, which didn't exist in Drupal 5.
Btw is this v.6 CVS coming sooner or later? it gets annoying having to discuss everything in one thread.

mrfelton’s picture

Priority: Normal » Critical

@zen: What happened to making a D6 branch for this? If development of the D6 version of this module is going to continue in this ticket it will simply never happen. I for one am not going to waste my time downloading tarballs, applying patches, and generating new tarballs. Please get this code into CVS where people can actually work with it relatively hassle free, and where everyone knows which version of is the most current etc.

I have offered my help several times...

I am bumping this severalty of this issue to Critical. Very few people are using D5 these days, and in the not too distant future official support for it will start to be dropped. Since the majority of people are using D6, this issue is critical to those people.

Once again, I offer my help in getting this into CVS and closing this issue.

radiobuzzer’s picture

As far as I have noticed, mrfelton had submitted a ticket some time ago, in order to become a co-maintainer of the module. Unfortunately this ticket has been hidden, since zen re-appeared and I can't see why. I think that everybody would appreciate it if zen shared the responsibility of this project, as long as (s)he can't afford the workload. Being busy is fully understandable, most of us have been in this situation, but the project has to go forward.

Otherwise and since zen hasn't shown up for quite a while again, I would suggest going once again through the normal drupal process for marking the project as abandoned and asking the admins to grant access to mrfelton, or anybody who's shown interest by committing patches (eg bkat and invisigoth).

Last solution, forking

dman’s picture

ditto to #90.
Offer of co-maintainership and a working port needing commital and another month or two of inaction.
It shouldn't be too hard to get this rolling again.
I'd love to work through and possibly revise bits of what we've got here in the D6, but contributions will be no good unless we get a D6 -dev branch out there.

captcha’s picture

+1 to a D6 port.
Have been using Drupal 6 for a year now and using the patched module with code changes as issues come up.

radiobuzzer’s picture

Found how to solve block incompatibility with caching. The reason was block caching, and we need to specify that we ask for caching per page, and not for caching per role, as it is by default.

Insert this in line 161

        $blocks[$type]['cache'] = BLOCK_CACHE_PER_PAGE;

so that the loop looks like

  foreach ($link_types as $type => $config) {
     if ($config['enabled'] && ($config['block'] || $top)) {
          $top = FALSE;
          $blocks[$type]['info'] = t('Related links: ') . check_plain($config['name']);
          $blocks[$type]['cache'] = BLOCK_CACHE_PER_PAGE;
     }
 }

For users already having installed the moduled, you need to update the cache variable at the database, too. Go to your Database and run the query:

UPDATE `blocks` SET `cache` = '4' WHERE `blocks`.`module` = 'relatedlinks'

Sorry, I can't create a patch now, but if sb is in the mood, please do so.

inders’s picture

Hi guys,

I got My issues fixed as:-

1) Was getting duplicate entry in related links table fixed that by

lid tinyint(3) ----------> to lid int(10)
nid tinyint(3)----------> to nid int(10)

2) Was getting error for stdclass at 1136 on relatedlinks.module in function _relatedlinks_collate_links()

--$set = @array_merge(array_intersect_assoc($set1, $set2) , array_diff_assoc($set1, $set2));

++$set = array_merge(array_intersect_assoc($set1, $set2) , array_diff_assoc($set1, $set2));

Just thought to ignore error as links are working fine and module is collecting all data properly.

inders’s picture

you can check working module at: http://indiauser.com my testing & play site.

edwinwills’s picture

subscribe

Zen’s picture

Assigned: Unassigned » Zen
Status: Needs work » Active
Zen’s picture

I've made an alpha release. Please test and update this ticket as appropriate.

Thanks,
-K

inders’s picture

Hi Zen,

Just got chance to check and test your new dev version and here is result of test:-

# recoverable fatal error: Object of class stdClass could not be converted to string in /opt/lampp/htdocs/sites/all/modules/relatedlinks/relatedlinks.module on line 879.
# recoverable fatal error: Object of class stdClass could not be converted to string in /opt/lampp/htdocs/sites/all/modules/relatedlinks/relatedlinks.module on line 879.

Code At 879:-

$set = array_intersect_assoc($set1, $set2) + array_diff_assoc($set1, $set2);

as per array_intersect_assoc() php function except array of strings but we have similar to:-

Array
(
    [12] => stdClass Object
        (
            [nid] => 12
            [title] => DSC05358
            [type] => image
            [uid] => 1
            [count] => 2
            [comment_count] => 0
        )
)

Here array key is nid but value is a node object. So need to fix this. I think can be replaced with some loop..
just added quik fix and tested that:-

--$set = array_intersect_assoc($set1, $set2) + array_diff_assoc($set1, $set2);


++foreach($set1 as $nid=>$related_node){
++          if(isset($set2[$nid])){
++              $array_intersect_assoc[$nid]=$related_node;
++          }else{
++              $array_diff_assoc[$nid]=$related_node;
++          }
++      }
++    $set = $array_intersect_assoc+$array_diff_assoc;

This works fine. but have not checked if this do not effecting the results.

Thanks & regards
-Inder Singh
http://indersingh.com

btully’s picture

subscribe

AntiNSA’s picture

Can you make a patch with your fix?

AntiNSA’s picture

Im getting this error user warning: Duplicate entry '255' for key 1 query: INSERT INTO relatedlinks_tracker (nid, keywords) VALUES (12296, '') in /home/cyberfan/htdocs/sites/all/modules/relatedlinks/relatedlinks.module on line 602.

Im using the newest dev release from march 10th... any ideas?

AntiNSA’s picture

sorry I am using the exact version 6.x-1.0-alpha1

inders’s picture

Hi,

This can help:-

relatedlinks.module on line 602.

Change

if(trim($keywords))
        db_query("INSERT INTO {relatedlinks_tracker} (nid, keywords) VALUES (%d, '%s')", $nid, $keywords);

Thanks & regards
-Inder Singh
http://indersingh.com

AntiNSA’s picture

Thanks for your help! Starting on 601 and ending on 603 I have this code:

function _relatedlinks_insert_tracker($nid, $keywords) {
db_query("INSERT INTO {relatedlinks_tracker} (nid, keywords) VALUES (%d, '%s')", $nid, $keywords);
}

On 602

db_query("INSERT INTO {relatedlinks_tracker} (nid, keywords) VALUES (%d, '%s')", $nid, $keywords);

looks exactly like that you said

db_query("INSERT INTO {relatedlinks_tracker} (nid, keywords) VALUES (%d, '%s')", $nid, $keywords);

Im unsure what it is that you want me to change?

I really appreciate your help. I like this mod a lot... just these error codes I need to kill.

inders’s picture

Hi,

You can place this line in if() condition. Check if $keywords are not blank or check if same entry exits in table.

You can replace your current line with:

if (trim( $keywords )) {
        db_query("INSERT INTO {relatedlinks_tracker} (nid, keywords) VALUES (%d, '%s')", $nid, $keywords);
}

Thanks & Regards
-Inder Singh
http://indersingh.com

AntiNSA’s picture

Thanks again for your help! i have tried to alter the code and I keep getting errors... Im sorry I must be doing something wrong. Can someone help to make this into a patch for me? Im sorry I am so bad with php!

This by far is one of the most usefull modules and I really hope I can kill this error! Thanks!

Zen’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
Status: Active » Fixed

@inders: Please provide information on your setup. I am not running into this error. Please do so in a separate issue.
@AntiNSA: I see that a separate bug report has been created for your issue. I'll respond to it there.

-K

Status: Fixed » Closed (fixed)
Issue tags: -error, -Drupal, -relatedlink

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