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.
81 comments
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