The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
vBulletin 4 Request - Help Converting from MyBB to vBulletin
Hello,
I am looking for a little assistance with converting this code from mybb to vbulletin. Code:
<?php $servername = 'localhost'; $dbusername = 'Removed by'; $dbpassword = 'Staff!'; $dbname = 'mybb'; $con = new mysqli($servername, $dbusername, $dbpassword, $dbname); if ($con->connect_error) { die("Connection failed: " . $con->connect_error); } echo "<body style=\"background-color:#001500;\">"; $sqlquery = "SELECT subject, message, fid, tid, dateline FROM mybb_posts WHERE replyto = '0' ORDER BY dateline DESC"; $sqlresult = $con->query($sqlquery); while ($row = $sqlresult->fetch_array()) { if ($row['fid'] == 2 || $row['fid'] == 5) { echo "<a style=\"text-decoration:none;color:orange;\" href=\"http://swghuttcartel.com/forums/showthread.php?tid=" . $row['tid'] . "\">" . "<b>" . $row['subject'] . "</b>" . "</a><br>"; $message = preg_replace("#\s*\[.+\]\s*#U", "", explode('!', explode('.', $row['message'])[0])[0]); echo "<a style=\"color:#fff;\">" . $message . ".</a><br>"; echo "<i><a style=\"color:gray;\">" . gmdate("m.d.Y", $row['dateline']) . "</a></i><br><hr><br>"; } } echo "</body>"; $con->close(); ?> Thank you, |
#2
|
||||
|
||||
Which version of vB?
|
#3
|
|||
|
|||
vBulletin 4 according to the thread prefix. You can try something like below assuming you don't use a table prefix and that you want the latest 15 posts. I also moved the forumid check to the query instead of the check in the PHP code.
This is untested by the way. PHP Code:
|
2 благодарности(ей) от: | ||
Phillip, TheLastSuperman |
#4
|
|||
|
|||
Quote:
--------------- Added [DATE]1501184216[/DATE] at [TIME]1501184216[/TIME] --------------- Oh also: I have the code here: https://swghope.com/forums/launcher_news.php - I'm wondering if we can either remove the url text completely or have it display the full url instead of it being cutoff, right? Thanks, |
#5
|
|||
|
|||
plz tell me that's not your actual DB username and password!
|
#6
|
||||
|
||||
Removed database username + password ^.
|
2 благодарности(ей) от: | ||
MarkFL, RichieBoy67 |
#7
|
||||
|
||||
Mike, post #4 needs to be edited as well.
|
#8
|
|||
|
|||
No no, that was the information from an old database, thats why it was posted. The myBB database was taken offline a awhile ago.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|