The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Is there any good resource for the best practices when writing plugins?
I have written a few for my personal site so far, however I would like to get into the practice of using the available VB functions when doing this. For example, here is a snip of code Code:
$content = "";
$query = "SELECT title, sid, summary, username, rid, unix_timestamp(updated) from fanfiction_stories as s,vb_user as a WHERE a.userid = s.uid AND s.validated > 0 AND s.uid = $userinfo[userid] ORDER BY updated DESC";
$results = mysql_query($query) or die(_FATALERROR."Query: ".$query."<br />Error: (".mysql_errno( ).")");
while($story = mysql_fetch_array($results)) {
$content .="$story[title] By $story[username]<br />";
}
if ($content<>"")
{
$efic_mystory = $content;
} else {
$efic_mystory = "No Stories";
}
Just small stuff like that....if there is a good reference around somewhere it would save me a lot of questions here ![]() Thanks |
|
#2
|
|||
|
|||
|
1- ... it is $results = $db->query_read("writethequeryhere,not seperate!");
2- no need of the "$content<>""" is the $content is not an array... !empty($content) or simply $content would do in the if-condition... also, for a good way to code vBulletin, simply read vBulletin core files and comprehend the rules of their protocol.. it is clear. |
|
#3
|
|||
|
|||
|
Check out the articles section. Some of your code could be better.
Eg. Code:
$query = "SELECT title, sid, summary, username, rid, unix_timestamp....... PHP Code:
while($story = mysql_fetch_array($results)) { More like while ($story = $vbulletin->db->fetch_array($results)) { Things like that |
|
#4
|
||||
|
||||
|
I had been browsing the article section for a bit, but I was looking in the wrong area. Found this one that explains using $vbulletin->db
https://vborg.vbsupport.ru/showthread.php?t=119350 I can spend an hour looking...but as soon as I post the question I will stumble on the answer in 5 minutes ![]() Do you mean reading the source files when you say "simply read vBulletin core files"? I would rather not be digging deep into the php files for what are probably simple questions and answers if possible. Thanks for the feedback..now that I know where to look in the article section I will start reading up...need to learn how to add admin options and settings
|
|
#5
|
|||
|
|||
|
Turn on debug mode
. Then you can add settings easily
|
|
#6
|
|||
|
|||
|
sure i suggest to read the source files... they are all built the same way, so you learn quickly
|
|
#7
|
|||
|
|||
|
I agree with nexialys. Reading the source files is one of the best ways to learn. Many coders use that method
|
|
#8
|
|||
|
|||
|
vBulletin has their Coding Standards available in the documentation:
http://www.vbulletin.com/docs/html/codestandards This could help you out a bit.
|
|
#9
|
|||
|
|||
|
damn, i hope you will crawl across your entire script before releasing 4.0, because a lot of these standards are not applied to the actual version.. lol (like it always had)
|
|
#10
|
||||
|
||||
|
Thanks for the great feedback. My goal is to expand the eFiction bridge I threw together into a much tighter integration, and if I am going to do that I want to do it right
![]() Working on setting up a test server for development on VMWare, that way I wont thrash my site while trying to do this
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|