Back to vBulletin 3 Articles

Want to be a Hacker and not a Copy and Paster?
by amykhar 28 Apr 2003

One of the very best ways to learn a new coding language is to create a real-world application for yourself and then code it. Tutorials and books have their place, but you will learn more, faster if you try to solve a real problem on your board.

For example, lets say you see a hack that shows the last 10 posts on a different forum page. You like that hack just fine, but you don't want to show 10 posts, only 5. A copy and paster will post a request in the hack's thread to modify the hack for 5 posts instead of 10. A hacker will look at the hack's code and try to figure out HOW the hack gets the 10 posts and change that to 5.

In modifying code, there are a few concepts that are key.

1. If / else clauses: These little conditional clauses allow your code to make choices. Do this if the logged in person is a moderator but do that if they are an admin.

http://www.zorka.com/home/phptutorial/main/event=lesson/if

2. OR and AND: Those two little words will allow you to do extraordinary things. I can't tell you how many times I have been asked to modify a hack so that it includes an extra usergroup, user, style, whatever. So many times, it is merely a matter of adding an OR or an AND to a query.

http://hotwired.lycos.com/webmonkey/01/48/index2a_page9.html?tw=programming

3. Queries: You don't have to memorize writing queries. Find similar queries in the vbulletin code and then copy, paste and modify! If you need to find all the users in your forum who have made more than a thousand posts, find another query that is looking for users and copy the code and tweak it. Look in phpmyadmin to see the names of the columns you are interested in and experiement. HINT: When writing code to delete data, test your queries with SELECT first. That way you won't accidentally delete the wrong thing.

You are not going to learn how to customize your board if you don't get in there and get your hands dirty. Figure out what you want to do to your board and then find example code that can get you started. Your code won't be neat. It won't be efficient. But, it will be yours. And, after a bit of practice, your code will improve and you will be releasing your own hacks instead of having to depend on others to do it for you.

Amy

vblts.ru supports vBulletin®, 2022-2024