MyBB Hacks

Full Version: XThreads
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
You're searching for an element with the id="xthreads_diet", but there is no such thing on the page, which is why it fails (you've only got name="xthreads_diet", not the id).
If your form has an id, you can traverse down to find something with the correct name.
I DID IT!!!! (lee dances)

This is what I did:

I put the Custom thread field  with the radio buttons inside a span and gave it an ID of "yes".

I did the same with my textbox custom thread field, put it in a div with id="field", gave it a style="display:none;"

Then I did my javascript .

Javascript Code
<script language="javascript" type="text/javascript">
var el = document.getElementById('yes');
if (el)
el.onchange = function() 
{document.getElementById('field').style.display = "block";}
else
alert("element not found");
</script>


Its scraffly, and not very slick, but it works. Smile

Reporting back on the editable fields.

It could be that I am not really 100% sure on how to get files off git hub, but I got the 7 files from the github. They were in two groups:

ACP component for threadfield value permissions (5 files)
User-level component for threadfield value permissions (2 files)

I got the files by clicking on view file, then on raw then save as.

I put them in the folders (as defined on the git hub, eg: Upload / inc / languages / english / xthreads.lang.php ) and put them on my FTP. I went to ACP and was a bit surprised that it did not call the upgrader. Anyway, I went to my Custom Thread Fields and added a textbox using the new Settable Value Permissions. All went fine until I hit save - then I got this error.


Code:
MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1054 - Unknown column 'editable_values' in 'field list'
Query:
INSERT INTO test_threadfields 
(`field`,`title`,`forums`,`editable`,`editable_gids`,`editable_values`,`viewable_gids`,`unviewableval`,`blankval`,`dispformat`,`dispitemformat`,`formatmap`,`datatype`,
`textmask`,`maxlen`,`vallist`,`multival`,`sanitize`,`allowfilter`,`desc`,`inputtype`,`disporder`,`tabstop`,`hideedit`,`formhtml`,
`defaultval`,`fieldwidth`,`fieldheight`,`filemagic`,`fileexts`,`filemaxsize`,`fileimage`,`fileimgthumbs`)
 VALUES ('test','test','2','1','','a:2:{i:1;a:1:{i:0;i:2;}s:0:\"\";a:1:{i:0;i:1;}}','2',' ','','{VALUE}','{VALUE}','','0','','0','1\r\n0','','0','0','test box','2','1','1','0','','','40','5','','','0','','')


Its probably me being a noob at getting files off github, but here is the report.

Click the big Download button on the right near the top of the page.

https://github.com/zingaburga/XThreads-M...https://github.com/zingaburga/XThreads-MyBB-Plugin/zipb
LOL - this is why I always wait for the proper release - scared of breaking stuff due to being a bit thick on some things....

REPORT: It sort of works. (I think I am a crap tester TBH)
I set up a group based on the registered users, called it tester (usergroup 8), and put that usergroup in the Allowed to edit group.
I set a field to be custom usergroups (not required) and then defined who was allowed to edit a field in the Editable by Usergroups setting.
Field values were Yes or No. No default field value set.
In the editable values I chose the values that could be inputted by the user. I chose the allowable values to be yes or no.  My settings looked like this:

Yes{|} 3,4,8
No {|} 3,4,8

I made some test posts:

As a standard registered user I did not see the field and did not need to fill it in and thread was accepted = expected result
As a tester I did see THREE values - not set, yes and no. I did not fill anything in (ie left the value at (Not Set), and the thread was accepted = unexpected result.

I changed the settings to be "Everyone(Required)" and as I expected, a standard registered user who could not see the field also could not complete it = thread not accepted due to missing value.

I hope this is useful info......

PS. If it turns out that its because I have not fully understood how to set this up and that is why it appears not to work I apologise.
If you want to hide the (not set) value, use a blank value in the permissions field, and set it to something like administrators group, eg:

Code:
Yes{|}3,4,8
No{|}3,4,8
{|}4

Updated to v1.41:
  • minor bugfixes and slight tweaks (thanks to RocketFoot for pointing out an issue)
  • ability to set permissions (by usergroup) for using certain values in threadfields [eg, imagine that only moderators are allowed to mark a thread as 'technical']
  • add ability to offset the {$colspan} variable in forumdisplay_threadlist template
Zinga - can I still download this with the Github code in my forum?
You might already be using it, since I don't think I've updated it since you downloaded it.  Check the dates of the files in GitHub, they're probably the same.
Hi  - something has gone horribly wrong....I have run the upgrader, and all is fine on the board, but I am getting this message in my plugins list. It is also saying I am not upgraded. However, the new functions are on the board - I can add fields, set the editable, download and upload files fine.

Fatal error: Cannot redeclare class _objcont_1 in /home/leefish/public_html/mybb/inc/plugins/xthreads.php(792) : eval()'d code on line 15

Thats all I can see _ I can't see the plugin list.

I am also seeing this:

Fatal error: Cannot redeclare class _objcont_1 in /home/leefish/public_html/mybb/inc/plugins/vbquote.php(304) : eval()'d code on line 15
Fatal error: Cannot redeclare class _objcont_1 in /home/leefish/public_html/mybb/inc/plugins/preparser.php(321) : eval()'d code on line 15

It looks like my obj_control object is buggered somehow.

as a very quick temp fix I have changed the static count in these three files (as in the code below) to 1, but that is not the right thing to do I know. I can now see the plugin list.

PHP Code:
if(!function_exists('control_object')) {
	function control_object(&$obj, $code) {
		static $cnt = 0;
		$newname = '_objcont_'.(++$cnt);


EDIT: I should also mention that I did not have the 1.41 files on leefish - they were on another site. I did have to ABORT uploading 1.4 to leefish due to an error - but all seemed fine - I replaced the 1.4 files with the 1.337 files. That was a while ago - like on the release day plus 1 of 1.4. I thought it was MyNetwork being a pest.

Reference URL's