vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Mark Threads As "Solved" (https://vborg.vbsupport.ru/showthread.php?t=234935)

Tim Wheatley 09-13-2013 04:51 PM

Had to alter the uninstall code to get it to uninstall without the fatal error.

karel1985 09-15-2013 01:29 PM

Hi Eric,

As user of your mod since the beginning, i'm wondering if you are working on a vb5 version? I would really need to have this working in vb5...

Without this mod, we will never upgrade i guess, we can't live without...

ozzy47 09-15-2013 01:59 PM

I believe another developer would have to pick up work on the mod to port it to vB5 as Eric said, he is very limited with time as of now.

PrivateFTA 02-18-2014 05:53 PM

let me know if I can do several way to use a new place to settle and accepted our

djvj 05-01-2014 07:53 AM

Does this work on 4.2.2?

NM, just tested and it works fine.

john7911 05-01-2014 09:02 AM

I install it on 4.2.2 but I don't see it in the list.
https://vborg.vbsupport.ru/external/2014/05/78.png

aminp30 06-27-2014 06:10 AM

Hi
thank you Eric. very nice hack

would you please tell me is that possible to use this hack as a button?
I need to add a button in first post of thread to let starter set solved or not.

best regards

fxdigi-cash 08-02-2014 06:08 AM

Quote:

Originally Posted by aminp30 (Post 2503987)
Hi
thank you Eric. very nice hack

would you please tell me is that possible to use this hack as a button?
I need to add a button in first post of thread to let starter set solved or not.

best regards

maybe you didn't read whole main post...

from there, this code you need to add it to your showthread template to see the button:

HTML Code:

<vb:if condition="$show['solvedthread']">                        <li><a href="solved.php?{vb:raw session.sessionurl}do=marksolved&amp;t={vb:raw threadid}">{vb:rawphrase solvedthread_marksolved}&hellip;</a></li>                    <vb:else />                        <vb:if condition="$show['solvedthread_unsolve']">                        <li><a href="solved.php?{vb:raw session.sessionurl}do=markunsolved&amp;t={vb:raw threadid}">{vb:rawphrase solvedthread_markunsolved}&hellip;</a></li>                        </vb:if>                    </vb:if>

majickal 08-23-2014 12:01 PM

I can confirm this is working on 4.2.2 Patch Level 1 :D

majickal 08-24-2014 07:55 AM

1 Attachment(s)
Is there anyway to remove the following prefix option when starting a new thread in a Q & A forum?

https://vborg.vbsupport.ru/attachmen...1&d=1408869921

I guess, I'm wondering if there is some form of identifier I can test against to hide this option when a forum is detected that is running the solved feature.

I found this:

https://vborg.vbsupport.ru/attachmen...1&d=1408870162

But am currently unsure how it is evaluated when the newthread template is evaluated.

The following code block shows the section in the section I am referring to:

Code:

                                        <vb:if condition="$prefix_options">
                                                <label for="prefixfield" class="full">{vb:rawphrase prefix}:</label>
                                                <select name="prefixid" id="prefixfield" class="full" tabindex="1">
                                                        <option value="">{vb:rawphrase no_prefix_meta}</option>
                                                        {vb:raw prefix_options}
                                                </select>
                                                <p class="description"></p>
                                        </vb:if>

I'll keep digging and if I find a solution, I'll post it, else if someone else knows, please let me know.

Cheers

M

update

I have had some success with this:

Starting @ line 45 in the newthread template, find the code noted above and replace with the one below:
Code:

                        <!-- Start hiding the prefix option if Q & A thread -->
                        <vb:if condition="$forumid == 16">
                                <!-- Do Not show prefix options-->
                        <vb:else />
                                <!-- Start Prefix Options Display -->
                                        <vb:if condition="$prefix_options">
                                                <label for="prefixfield" class="full">{vb:rawphrase prefix}:</label>
                                                <select name="prefixid" id="prefixfield" class="full" tabindex="1">
                                                        <option value="">{vb:rawphrase no_prefix_meta}</option>
                                                        {vb:raw prefix_options}
                                                </select>
                                                <p class="description"></p>
                                        </vb:if>
                                <!-- End Prefix Options Display -->       
                        </vb:if>       
                        <!-- End hiding the prefix option if Q & A thread -->

you will note in the following line:

Code:

<vb:if condition="$forumid == 16">
You will need to change the number 16 for whatever your Q & A forumid is.

To find this out, you can execute the following SQL against your DB:

Code:

select * from forumprefixset;
This will provide you a list of all forums where you have selected them as Q & A type forums as shown below: (I'm using mysql workbench in this example)

https://vborg.vbsupport.ru/attachmen...1&d=1408873908

Hope this helps someone.

Next I'll see if I can get an array of forums based on the table forumprefixset

SQL will be something like:

Code:

SELECT forumid from forumprefixset WHERE prefixsetid = 'solvedthread';
Once I can get this into an array and register that array as a variable vBulletin can accept, perhaps I can test against that array in the template and not have to manually code the forum ids in. This would mean a one time change in the newthread template and any forum could have this feature.

Any help with this would be really awesome as I am really unfamiliar with the vBulletin codebase and have just started looking into it.


I'll report back as I make progress.

Cheers

M

Update

Can select from an array now

Code:

                        <!-- Start hiding the prefix option if Q & A thread -->
                        <vb:if condition="in_array($forumid, array(16))">

Update

So I got this working,

I created a new plugin by using the Add New Plugin in the Products & Plugins section as shown below. The only reason I went down this route is to avoid changing any of the original plugins code. So I hope this method for extending the plugin is OK.

https://vborg.vbsupport.ru/attachmen...1&d=1408916968

Then I added the following PHP code:

Code:

$result = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "forumprefixset WHERE prefixsetid = 'solvedthread'");
$returnSolvedForumIDS = array();
                while ($output = $vbulletin->db->fetch_array($result))
                {
                        $returnSolvedForumIDS[] = $output['forumid'];

                }



if(is_array($returnSolvedForumIDS)){

vB_Template::preRegister('newthread', array('returnSolvedForumIDS' => $returnSolvedForumIDS));

}

Finally in the newthread template, as noted in the above template edits, the following change was made:

Find:
Code:

                                        <vb:if condition="$prefix_options">
                                                <label for="prefixfield" class="full">{vb:rawphrase prefix}:</label>
                                                <select name="prefixid" id="prefixfield" class="full" tabindex="1">
                                                        <option value="">{vb:rawphrase no_prefix_meta}</option>
                                                        {vb:raw prefix_options}
                                                </select>
                                                <p class="description"></p>
                                        </vb:if>

Replace with:

Code:

                        <!-- Start hiding the prefix option if Q & A thread -->
                        <vb:if condition="in_array($forumid, $returnSolvedForumIDS)">
                                <!-- Do Not show prefix options-->
                        <vb:else />
                                <!-- Start Prefix Options Display -->
                                        <vb:if condition="$prefix_options">
                                                <label for="prefixfield" class="full">{vb:rawphrase prefix}:</label>
                                                <select name="prefixid" id="prefixfield" class="full" tabindex="1">
                                                        <option value="">{vb:rawphrase no_prefix_meta}</option>
                                                        {vb:raw prefix_options}
                                                </select>
                                                <p class="description"></p>
                                        </vb:if>
                                <!-- End Prefix Options Display -->       
                        </vb:if>       
                        <!-- End hiding the prefix option if Q & A thread -->

The core bit of information I was missing, was the method used to return variables from PHP in a way that they can be used in conditional statements in vBulletin templates. This eluded me for a while but was the key to making the changes I required work. See below for the exact code I used to register the PHP variable for use in the template system:

Code:

vB_Template::preRegister('newthread', array('returnSolvedForumIDS' => $returnSolvedForumIDS));
As soon as this variable was registered, everything fell into place. :)

You could easily modify the original Plugins PHP code to return this information. It is probably the best way forward too, as the method outlined in this post does add an additional query, which is not really required, as the same query exists in the original plugin. As stated previously, I did this to:
  1. Separate the test/modification code from the actual plugin code
  2. Avoid changin the plugin code as I am not 100% sure if this is an OK thing to do?
  3. Teach myself and provide an example to others how to accomplish such modifications to the original plugin without changing any of the core plugin code.

I hope this helps someone else understand how this system works. I'll continue to extend this plugin via the separate plugin code.

Unless anyone has an issue with it, I'll keep posting updates on my progress.

Hope you have found this useful.

Cheers

M


All times are GMT. The time now is 12:19 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01261 seconds
  • Memory Usage 1,780KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete