Closed (fixed)
Project:
External Link Popularity
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2011 at 23:24 UTC
Updated:
15 Sep 2011 at 03:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
scuba_flySince there is no reaction...
Did you start on the drupal 7 version?
I'm a bit new to drupal development but I wanna help porting this to D7.
I need something like this for my drupal7 site.
How do i start creating the D7 version? I'm experienced in PHP / mySQL and javascript. also using drupal6 and 7 for some months now. but it's time to really get involved ;)
thnx!
Comment #2
Tim Jones Toronto commentedHi there! Cool.
I made an early start from latest 6.x dev. Notes as follows:
1. Run thru Coder and made recommended changes.
2. Created the basic 7.x structure so that it can be worked on (attached).
3. Next job is hook_menu() - change menu path to Version 7 http://drupal.org/node/719612
4. Then to change 'node_get_types(' line for admin form.
http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...
I'm sorry I didn't get time to do more. I can do some testing if you want to carry on coding this?
Cheers,
Tim
Comment #3
hydra commentedsubscribe
Comment #4
nkschaefer commentedHi,
I picked up on this and have completed a working Drupal 7 version. I did make a couple of changes:
Anyway, try it out and let me know if there are problems. I think it'll be handy to get this working.
Also, is anyone still maintaining this module? Should some of us apply for co-maintainership? And in the meantime, should I start a sandbox project with this D7 version?
Edit: I've also considered letting Views take over the block provided by this module. Would that be overkill?
Thanks,
Nathan
Comment #5
nkschaefer commentedAnd of course, I forgot something.
I just added back in an access check I had commented out, and I also made sure the module cleans up after itself -- when a node is deleted, all associated data from this module, in the pop_links_stats table as well as the votingapi tables, is deleted as well.
Please use this version when you check it out (ignore the other file I uploaded).
Thanks,
Nathan
Comment #6
nkschaefer commentedAfter thinking about this some more, I realized that this is going to need some more flexibility. In the interest of making this more extensible (so we could include entity types other than nodes in the future), this now works off Javascript settings instead of automatically looking for node divs.
I also wanted to handle the case where a node's links are shown in Views rather than in the node body. To do this, I wrote a new Views handler that extends the one for Field API fields -- it adds the needed Javascript file and settings when the view is rendered so that users who click on a link in a views field belonging to a node will have their votes counted as clicks on the parent node.
Additionally, in the interest of future-proofing and increasing flexibility, I removed the "Popular links" block code and replaced it with another default view that builds that block. This way, if Voting API's code ever changes, this code won't break, as long as they keep their Views integration working.
I've added another updated (zipped) version of the module; I've also created a sandbox page at http://drupal.org/sandbox/nkschaefer/1238548 where you can all pull the project with git and create issues for suggestions/questions/patches/bugs/whatever.
I hope to get this version up on the main project page, if possible.
Comment #7
Tim Jones Toronto commentedGreat Nathan! I have only just caught up on this, so will do some testing...
Thanks for your work.
Tim
Comment #8
Tim Jones Toronto commentedSo far, I have the following errors with Drupal (7.7):
1. After enabling the module, it gives:
DatabaseSchemaObjectExistsException: Table pop_links_stats already exists. in DatabaseSchema->createTable() (line 629 of C:\xampp\htdocs\includes\database\schema.inc).
2. On adding a link (after node submit), it gives:
Warning: Parameter 1 to pop_links_node_view() expected to be a reference, value given in module_invoke_all() (line 819 of C:\xampp\htdocs\includes\module.inc).
Cannot get much further showing any Views data with above errors so far.
Cheers!
Comment #9
nkschaefer commentedHey -
Thanks for testing this out. It's nice to get some feedback (after posting many patches and hearing nothing from anyone).
I can't figure out why the hook_install() is being called whenever the module is enabled - I was getting the same "table exists" error. As a quick fix, I added a check for !db_table_exists() before attempting to add the table.
As for the other error - it's weird that I wasn't getting it. Maybe we have different versions of PHP, and mine is more laid back about passing variables by reference or something. Anyway, I split the hook_node_view() into a hook_node_view() and hook_node_view_alter(), the latter of which can definitely handle receiving variables by reference. This seems to work just as well for me and should hopefully stop the errors on your end. Let me know if this works better.
If anyone cares, I also pushed the changes to the sandbox project, if you're using Git or whatever.
Thanks,
Nathan
Comment #10
nkschaefer commentedI should add that I also changed the code a little, so when counting the number of clicks, it selects the sum, not number, of all votes. This shouldn't matter for many people, but I'm currently importing stuff from another website and rather than creating a bunch of individual votes, I just imported all clicks-to-date as single, high-value votes. That change allows this to work well and shouldn't hurt anything for those using this module normally.
Comment #11
Tim Jones Toronto commentedCool. I will test tomorrow I hope :) Bye for now.
Comment #12
nkschaefer commentedOkay - I'm a maintainer now, and there's a 7.x dev release up. Please open new issues for any problems you encounter with the new release. Thanks!