One of our clients wanted to create a social networking site similar to Digg, it will go live just after Christmas but in the process we have learnt a lot about Drupal and how sites like Digg work.
What's Digg? You may have been sitting under a rock for years and not no anything about Digg. Digg is a user content driven site, users submit links to article and sites that interest them and other uses either give it the thumbs up or the thumbs down. The most popular sites get onto the front page and can have literally thousands of hits this is reffered to as the Digg effect.
How to create a site like Digg with no programming? We are going to go step by step how you can develop such a site using Drupal CMS which is available from drupal.org if your unfamiliar with Drupal we have an overview here.
Before we start you will need.. A web server running PHP 4+ and a relational SQL database such as MySQL this tutorial presumes you have access to both of these.
Contents
- Downloading required modules and Drupal
- Setting up Drupal 4.7
- Installing Modules
- Configuring Modules
- Testing the Site
Downloading required modules and Drupal. We are going to use Drupal 4.7 for this site, Drupal 5 beta 2 is available but currently several of the modules we will use do not support this version of Drupal. We will be using the following modules, which should be downloaded via drupal.org please make sure you download the 4.7 versions of these modules.
These packages come as a gzip files and will need to be unzipped before they can be used. Setting up Drupal 4.7 Unzip the Drupal 4.7 files into your web root or folder which you will be working from, then unzip all the above module files moving the individual module folders into the module directory of your Drupal install. So you should end up with a Module folder that has 6 folders with files in them in addition to the files in the original module folder. Next you need to insert your SQL into your Database if you have phpmyadmin this is really easy, I will go through generic steps below consult your database administration control documents for more details.
- Create a new database (if your using a cheap host they may have already created you one)
- Import the database .sql file in phpmyadmin this is done through the import tab.
- Navigate to the database folder in your Drupal install
- Select the database that corresponds to yours
- select that file to import, and off you go.
- You should see 94 queries are executed and 57 new tables have been added to the database
- Final step - edit the file settings.php in sites/default in your Drupal install, after the initial text there is a place for you to enter your database details
Next fire up your browser and point it at your site you should see something like this
If your not something has gone wrong, if you are congratulations you have just installed Drupal. Now make an administrator account by clicking "create the first account" and enter your email address and username, the next screen will offer you a chance to change these. Installing Modules Luckily all the hard parts are done so now we will install some modules to do this go to administer and then modules. you will see a big list of modules, some will have ticks next to them leave the ones that are ticked and tick the following
- actions
- Voting actions
- cre
- links
- path
- Vote_storylink
- vote_up_down
- votingapi
Note any errors if there are any, if it occurred successfully you are almost there now we need to configure the site to act like Digg
- Go to Administer/Access Control and set access control for your new modules
- For vote_story links set use and edit story links for authenticated user
- For vote_up_and_down set use to authenticated user and view to both authenticated and anonymous
- Go to Administer/actions - this will activate actions
- Go to Administer/Settings/Content types then configure StoryLink and un-select Promoted to front page.
- Go to Administer/Settings/vote_up_down
- Set the types to Story Link
- In widget settings for nodes - Set alternative +1 style disable vote widget display and link display
- In widget settings for comments - select don not display for both widget and link
- Go to Administer/voting actions
- Set the name as Promote node to front page and save
- Press edit and add the following
- Value type = points
- Tag=vote
- function=sum
- comparison=Greater than
- Value however many points you want to set before an item appears on the front page I suggest 5
- Action choose Promote node to front page
The final thing to do is go into the module folder of vote_up_down and you will find 2 files node-storylink.tpl.php and template.php move them to the bluemarine folder. (note you will have to copy these files to which ever theme your using!) bluemarine is the default. Testing the site If your still with us by the end you have a Digg like site you can create new links by going to create content and the ability to vote up a story to get it to the front page, you can see your story links in the navigation window, now you just need some users. In part 2 we will look at some more useful modules to our Digg like site and part 3 looks at categories.








You might also be able to use the queue.module.
agreed the next part of the article goes through a group of modules suggesting improvments along with a few cosmetic ones.
What about the voting_actions module? You tell us to download it, but do we not enable it? Sorry, I’m a newbie at Drupal. Great guide, though.
Well spotted enable it as well its some what important
and is referred to later I will edit the post.
I’m also having a problem with the votingapi module after I enable it. Here’s the error I get: user warning: Table ‘kelp_tutorialwhore.votingapi_vote’ doesn’t exist query: SELECT DISTINCT uid from votingapi_vote in /home/kelp/public_html/tutorialwhore/includes/database.mysql.inc on line 121. Any ideas what causes this?
Hi Chuck, try disabling the module, then renabling and running the update.php also continue through the tutorial if its possible to do so, if you still have the error reply and we will do some digging into why that query isn’t working, I would have suggested posting on drupal.org as well but I notice you have already done that
Hey, Now that I actually completed the tutorial, I don’t think the error effected the outcome much. I have the website running like a Digg site. I just need to create my own personal theme. Thanks a lot, this is a great tutorial! I better go address the problems I posted on the forum
BTW, if someone’s looking for a digg-clone, forget pligg, use this tutorial along with Drupal for better results. Drupal is much more advanced, while pligg is still at its baby stages. There is almost no flexibility with pligg. You’re almost helpless if you’re not a programmer.
Going through your tutorial now. Thanks!
cool, I’m in fact testing the final section of the part3 of the tutorial for bugs, all being well should be out this afternoon (or tomorrow)
where is the part 3 of tutorial do you have a sample web site that shows digg like drupal
Part 3 is coming honest… In the mean time try our new series on CCK & Views part 1 of which is up now. As for sites using Digg like Drupal we are in the final stages of finishing a site for a client which has been the bases of this tutorial when completed we will post a link. There are however several good Digg clones using Drupal I believe if you visit the vote up/down project page it has a link to several.
I’m new to Drupal and just mucking about but I love the tutorial. Except none of my stories links actually link to the source as I specify it – they all just point internal – what am I doing wrong please?
Just check with me, when your creating content your going to create content -> Story Link Then adding the title, URL (full including http?) and description If you do this what does the node look like once its up?
Hey the tutorial worked great! Now how do I enable the same thing for a story. In other words I’d like to let users submit news stories on their own as editorials. When I enabled Storys it lets me submit a story but there is no vote box next to it. Any ideas? (also any way to add a tag cloud?) Thanks! N
repeat the above replacing stoy link with which ever node type you want. tagadelic module for all your tag cloud goodness
I’m having the same problem that Shaun is having. The link just points to http://www.example.com/?q=node/3 which doesn’t do us much good. The URL is apparently set up to point elsewhere on the web so I don’t know what’s wrong.
BTW, don’t click on the fake link I provided, unless you want to buy “ourdomain.com”…for about $14,000! I probably should have checked to see what was there before I posted P->
That’s odd, I will send you an email with some more detailed questions, did you have Drupal installed prior to this? and are you using Drupal 4.7?
“The final thing to do is go into the module folder of vote_up_down and you will find 2 files node-storylink.tpl.php and template.php move them to the bluemarine folder. (note you will have to copy these files to which ever theme your using!) bluemarine is the default.” Guessing that’s the problem if your using a different theme it may already have a template.php file don’t over ride it simply open the template.php from vote_up_down and copy the function to the themes template.php.
Thanks for the hard work on this guys. Seems a shame to restrict it to an old version of Drupal though. Any chance of updating it for version 5.0+? (Or are you restricted by the versioning of the modules? – I see Voting_Actions appears to only be for 4.7) Thanks
only voting actions needs to be updated so when the module owner updates it we will rewrite the tutorial for Drupal 5!
Yeah, cool beans. Thanks again!
If you put a site up place a link in the comments and I will add it to the article.
Thanks Tim, Regarding the link problem, I *did* in fact overwrite the template.php file so that may be my problem. My bad. I’ll repair this and try it again. Thanks!
Would you know how to do on drupal the server side of “digg it” button. http://www.digg.com/tools/integrate gives some explaination digg’s user to do on there webpage. But for obvious reason not on the server side. I think it’s a great feature to go viral. Thanks for your great works.
Hello JandB, The digg buttons are nearly always javascript, and so a server side version wouldn’t be required, however you have a look at this post for a couple of modules that may help.
Thank the link that gives interesting answer about SEO. However when a blogger submit a link in Digg he can put an icon in his post (with some javascript indeed) that would enable to vote for him on Digg. As I want to do the same thing in drupal I need to do something in my website to count those vote. Any idea how to do it ? Thank As we speak of SEO I’m sure it’s very good way to improve my page rank.
JandB look at service links in that article, alternativly add the Digg javascript code, to your nodes directly, by changing the content type to full html, finally put the code in your node template, if you want it set up that way.
Thank you but I don’t understand how to use the service ‘links’ I think you misunderstood my question I don’t want to put link from my site to Digg but to put in place the same mechanism than Digg. I want to count the number of person that on an icon from other website. In this way bloggers that put there links in my digg like website would put in place the link in there blog to increase the chance to increase there score in my digg like website.
I completely misunderstood, hmm let me give it some thought, I will see if we can create something…
Thank you. I think it’s a great part of seo benefit that involve in the digg mechanism. JB
Thanks for great advice, but i am having some difficulty. After following all the steps on this page, I am getting an error when I try to submit content Fatal error: Call to undefined function: links_normalize_url() in /home/.kemage/doc_web/news2.co.uk/modules/vote_up_down-4.7.x-1.0/vote_up_down/vote_storylink.module on line 544 How should I rectify it, plz advice Thanks Deepak
Ignore it and carry on through, it seems to be a small bug in the code, but does not effect the overall result (may have some other side effects) its been raised as an issue with the module developers.
But this message comes when I click on submit content/ story_link page, which means I cant submit story at all. So it wudnt work Thanks
have you gone through and done all the steps detailed on this page?
yes Link to my site is http://www.news2.co.uk
which version of the module are you using? , the site link doesn’t show any content, do you have an account I can log into (you can send the details to t.nash @ venture-skills.co.uk)
Thanks for the nice tutorial. I just got my site up and running. But I have a question. When user posts new story link, where do others see it? The story is not by default promoted to front page, so “Home” or frontpage does not list the new storylink. So as users can’t see it, they can’t vote. So only admin can promote the story to frontpage. I guess that is bad. So is there a link/page to view new stories? Thanks Rohan
the story links can be found on the node storylink, though you would be better off using the view module, combined with a good taxonomy structure. http://ventureskills.wordpress.com/2007/02/07/cck-views-the-ultimate-combination-part-2/
It takes a hell of a lot more than what you explainined. My site, tweako.com, was previously a “digg clone”. It took a good three months to develop and I just wanted to point out that there is a ton of things not explained in this article that need to be done in order to actually have a good site ready to be torn apart by tons of users.
The 3 part series will make a pretty robust site, but like all things it needs tweaking, I’m not sure what things you feel we have missed perhaps we could do a follow up article?
I’ve been wondering when this tutorial will be updated for Digg 5? It looks like releases for each of the required modules are now available. I tried to make it work with 5, however, without success. Up for a challenge?
Its on the cards but I believe a couple of modules haven’t been updated yet, however we have a sightly hacked Drupal 5 version running on a test server, so expect one soon.
Guys, really need some help, done all stages of part 1 and can publish a story/note etc and it appears on the front page, but there is no option to vote it up/down. I’m not too clued up on all this but am i doing something wrong? What i want is a system where by i can place adverts on a page, and customers can digg them up/down accordingly depending on service. From there the advert will either rise or fall in position. What would be the best method of doing this? Thanks for any help.
Well following this article would have got you to that stage
so I’m guessing at some point you didn’t quite follow the article fully. When creating your adverts are you using the storylinks content type?
How do i make all the story linsk open in a new window?
I am getting the following error when I am activating actions module from ‘administer->actions’: “Table ‘Drupal.actions’ doesn’t exist query: SELECT * FROM actions …” I am using actions-4.7.x-1.x-dev.tar.gz and drupal-4.7.6.tar.gz. The ‘actions’ tables is not created for some reason. I also don’t see any tables for ‘cre’ module. The new tables created other than the default 57 tables are: votingapi_action votingapi_action_condition votingapi_action_set I tried running ‘update.php’ with no luck. I am stuck, please help.
I looked a little deeper in the modules to solve my problem mentioned earlier about tables not getting created. I still dont know the reason, but I learned that as of Drupal 4.7, modules have an .install file so that any database tables which the module requires are created automatically when the module is enabled. Earlier versions 4.6 and older used to have a modulename.mysql and/or modulename.pgsql file that had the SQL queries to create/update the database tables. To get around my problem, I had to create these .mysql files from the .install files manually (Simply cut pasting the SQL queries). This was really annoying but I got it working. Now, I just need the answer that: – How are .mysql files gets created from .install files automotically. – Why is it not working for me?
sorry missed your first comment have you removed or made update.php unreadable?
The storylink does not link to the external url. Is there a setting for this? Great work though.
I need some help. I was doing fine until I got to step 5. 5. Go to Administer/voting actions Set the name as Promote node to front page and save Press edit and add the following … I don’t have this directory “Administer/voting actions” I do have voting actions in my settings though. Anyways I could not figure this out so I skipped 5 and did the rest on page 1. As a result my front page is “Welcome to your new Drupal website”. I assume that’s because of step 5. How can I fix this. Thanks.
It turns out that I accidently downloaded voting_actions-5.x-2.0b2. Anyways, I put up the 4.7 and the directories look fine. But now I am getting the error message: user warning: Table ‘mysite_imga1.voting_actions’ doesn’t exist query: SELECT va.vasid, va.name, va.content_type, va.weight FROM voting_actions va ORDER BY va.weight in /home/ladipp/public_html/includes/database.mysql.inc on line 121. And I still can’t get rid of the Drupal front page. I might just start all over.
I have just released Drupaligg: Digg clone using Drupal. Check out at: http://www.programmingbulls.com/drupaligg-open-source-diggreddit-clone-using-php-b The demo is available at: http://drupaligg.programmingbulls.com/
Hello Very interesting information! Thanks! Bye
Thanks for the excellent step by step guide. I am incorporating some of the features described above in a website which is due in December.
Hi, I’m at step 5: Go to Administer/voting actions * Set the name as Promote node to front page and save * Press edit and add the following” I clicked on submit, but don’t have any EDIT button. Can you tell me what happend? I use drupal 5 Thanks
I did it:) but still have a problem…I go to create content/storylinks , put the title, the URL of the website, promote to the frontpage. the final result doesn’t provide the URL!
As designers we are often asked about these kind of scripts for social bookmarkers and news sites its great to see someone putting out the codes.
Not sure if it was covered, but theres an easier way, using drupal, or a custom install of it, called drigg. http://www.drigg-code.org for more information.
I followed all the steps but step 5 where it says Go to Administer/voting actions * Set the name as Promote node to front page and save * Press edit and add the following etc….etc…… I’m using Drupal 5, I downloaded the module voting actions for version 5 and when I to the administer area of the moudle there’s no edit link to take me to the area where I’m supposed to add: # Value type = points # Tag=vote # function=sum # comparison=Greater than # Value however many points you want to set before an item appears on the front page I suggest 5 # Action choose Promote node to front page Could you explain a bit more on how to do this. Thanks
Responses to this post: