MyBB Hacks

Full Version: Using XThreads Custom Thread Fields For Plugin Settings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
I'm not sure if this is the fault of ProPortal, but with MyBB modifications, mysql_query really should never be called (as it is in the above attached PHP file).  Will most likely error if MyBB is using MySQLi for example.
I will check that out Zinga - I THINK its in all the pro_portal blocks, but I will do some testing.

Thanks for pointing this out Smile
Ok, I had a look at the file and yes, it will also work with the more usual (and correct)

Code:
$query = $db->query(" 
		SELECT select stuff here
");
		while($stuff = $db->fetch_array($query)){
etc etc


New file attached.

Thanks leefish, worked like a charm!

Kinda offtopic but, do you know a way to exclude a forum id from showing up on latest threads block? This way the same posts won't be showing twice in my portal Smile

Again, awesome job by xthreads and its community..turned mybb into a sandbox bb..tyvm!!
Ok, sorry about that mistake. I have edited the latestthreads block for you, but I am not as good and secure a coder as ZingaBurga or RateU, so I am not 100% sure it is secure.

basically, I have added a variable called $excluded and in there you can put the forums you want to have excluded from the block. There may well be a smarter way to do it, but I don't know it.

You need to open the block in your php editor (notepad++ is what I use) and put which forums you want to have excluded

Its this line

Code:
	$excluded = "AND fid NOT IN ('2')";


If you wanted to exclude forums 3 and 7 then you replace/edit that line as in the line below:

Code:
	$excluded = "AND fid NOT IN ('3','7')";


The attached file is a replacement for the proportal latest threads block. You might want to put the original somewhere safe.

Thanks again lee, will change my latestthreads block Smile

Btw, I've found that my portal page only works when I'm logged as a user, if not logged in I get an error loading the page:

Erro de SQL:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '66','61','66','58','62','61').' ORDER BY t.dateline desc LIMIT 5' at line 6
Consulta:
SELECT t.*, t.username AS tusername, u.username, u.avatar, u.usergroup, u.displaygroup, f.name FROM mybb_threads t LEFT JOIN mybb_users u ON (u.uid=t.uid) LEFT JOIN mybb_threadfields_data td ON (td.tid=t.tid) LEFT JOIN mybb_forums f ON (f.fid=t.fid) WHERE t.visible=1 AND td.xtdispportal='Yes' AND t.closed NOT LIKE 'moved|%''. AND t.fid NOT IN ('66','61','66','58','62','61').' ORDER BY t.dateline desc LIMIT 5

Removing custom thread block solves the problem, I've double checked and everything seems to be ok =/
As you can see it is fine for me on my board as a guest - and the mysql error should be solved. I think you need to check that the block is enabled for guests and that you have guests allowed to view the forums. Other than that I can take a look on your site for you if you wish to give me admin access.

I dont think it will make a big difference, but you have forum 66 and 61 specified twice in that list.
Hey lee, sent you a PM Smile
Updated (trying to "integrate" it more with XThreads):
  • Trying to use some hooks provided by XThreads to automatically deactivate our XThreads related plugins if user deactivates/uninstalls XThreads (maybe it is better if our XThreads related plugins use install-uninstall function).
  • Trying to prevent user to be able to activate our XThreads related plugins if XThreads isn't installed or activated, or some XThreads functions to be used for our plugins isn't available (depends on which XThreads functions we'll use for our plugins).
  • Trying to use a XThreads function to "detects" in which forum id(s) our custom thread fields applied by user (in this example, xtdispportal), and use the forum id(s) in our query (if user selects some forum(s) only), and trying to run our codes, only if the specific custom thread fields already available/created (trying to prevent SQL error if user deletes the custom thread fields later).
Please tell me if there is something wrong with the codes. I'm still learning Biggrin
Hi, I would like to ask a help with this plugin.

I have installed it and it works (there are titles, posted in:, replies: preview etc) but I would like to add also an image.

- I have added {$xtdispportal_threads} in a portal page outside of forum (place where show result: title post and image);
- Created new Custom Thread Fields for image files, with Image Thumbnail Generation 100x100;
- In xtdispportal_threads_thread template added:

Code:
<a href="{$mybb->settings['bburl']}/{$xtdispportal_thread_link}"><img src="{$GLOBALS['threadfields']['test']['url']}/thumb100x100" width="{$GLOBALS['threadfields']['test']['thumbs']['100x100']['w']}" height="{$GLOBALS['threadfields']['test']['thumbs']['100x100']['h']}"  alt=" " /></a>


But it doesn't work..where I wrong?

(01-08-2013 09:08 AM)nier3 Wrote: [ -> ]But it doesn't work..where I wrong?

Unfortunately, it is not designed for displaying images.
Pages: 1 2 3 4 5 6
Reference URL's