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)
-   -   Show Thread Enhancements - [AJAX] Post Thank You Hack (https://vborg.vbsupport.ru/showthread.php?t=231666)

raicars 05-18-2011 01:47 PM

Quote:

Originally Posted by channelfuse (Post 2196762)
Here's the fix for the searching. Replace post_thanks.php with this file.

What was wrong:
It was looking in an old table 'search' for the results. This no longer works.

What was fixed:
I have the initial SQL statement grab the thread IDs and post IDs:
PHP Code:

$posts $db->query_read("
            SELECT postid, post.threadid as threadid 

Then, we need to throw them into an array:
PHP Code:

while ($post $db->fetch_array($posts))
        {
            
$orderedids[] = array("1"$post['postid'], $post['threadid']);
        } 

The old code is commented out in other areas.

Then, we need to create our query to match the way vB 4.x wants it.
PHP Code:

$scriteria $search_core->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
        
$scriteria->set_advanced_typeid($vbulletin->GPC['contenttypeid']);
        
$scriteria->set_grouped(vB_Search_Core::GROUP_NO);
        
$crit "'" $db->escape_string(serialize($scriteria)) . "'";
        
$hash "'" $db->escape_string($scriteria->get_hash()) . "'";
                    
//results, confirmed, groups_seen, groups_rejected
        
$sresults serialize(array($orderedids"0", array(), array()));
        
$db->query_write("
            INSERT INTO " 
TABLE_PREFIX "searchlog (userid, ipaddress, searchhash, sortby, sortorder, searchtime, dateline, completed, criteria, results)
            VALUES (" 
$vbulletin->userinfo['userid'] . ", '" $db->escape_string(IPADDRESS) . "', $hash, 'groupdateline', 'desc', '0.999', UNIX_TIMESTAMP(NOW()), 1, $crit, '$sresults')");
        
$searchid $db->insert_id(); 

We create our search criteria, serialize it and then get the hash of it. We then serialize our IDs. The way vB's results.php wants the results is ordered such as:

array of threadIDs/postIDs
number of 'confirmed' posts (No idea what this is, left it as 0).
array of groups seen (No idea on this, just make an empty array).
array of groups denied (Again, no clue. Just made an empty array).

We then insert the data into the searchlog table and use that to generate the search results. I also included some various files at the beginning and setup a variable for the whole search thing:
PHP Code:

require_once(DIR "/vb/search/core.php");
require_once(
DIR "/vb/search/resultsview.php");

$search_core vB_Search_Core::get_instance(); 

That's it. Searching via User CP should work.

Good man!!
Thanks :up::up:.
Please give for me temp
post_thanks_member_info

Thankssssssssss

robsta 05-18-2011 02:28 PM

how can i add post thx manually in postbit legacy ?

raicars 05-18-2011 02:34 PM

Quote:

Originally Posted by raicars (Post 2197166)
Good man!!
Thanks :up::up:.
Please give for me temp
post_thanks_member_info

Thankssssssssss

Find all thanked posts by User
Find all posts thanked by User


Postbit_legacy

Add new Temp
post_thanks_member_info
Code:

<fieldset class="fieldset">
        <legend>$vbphrase[post_thanks_thanks]</legend>
        <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr>
                        <td>
                                $vbphrase[post_thanks_total_thanks]: <strong>$userinfo[post_thanks_user_amount_formatted]</strong>
                                <br />
                                <if condition="$userinfo[post_thanks_thanked_times] == 1">
                                        $vbphrase[post_thanks_time_post]
                                <else />
                                        <if condition="$userinfo[post_thanks_thanked_posts] == 1">
                                                <phrase 1="$userinfo[post_thanks_thanked_times_formatted]">$vbphrase[post_thanks_times_post]</phrase>
                                        <else />
                                                <phrase 1="$userinfo[post_thanks_thanked_times_formatted]" 2="$userinfo[post_thanks_thanked_posts_formatted]">$vbphrase[post_thanks_times_posts]</phrase>
                                        </if>
                                </if>
                        </td>
                </tr>
                <tr>
                        <td>
                                <a href="post_thanks.php?$session[sessionurl]do=findthanks&amp;u=$userinfo[userid]"><phrase 1="$userinfo[username]">$vbphrase[post_thanks_search_user]</phrase></a>
                        </td>
                        <td>
                                <a href="post_thanks.php?$session[sessionurl]do=findthanks_user_gave&amp;u=$userinfo[userid]"><phrase 1="$userinfo[username]">$vbphrase[post_thanks_search_user_gave]</phrase></a>
                        </td>
                </tr>
        </table>
</fieldset>

Replace temp: post_thanks_memberinfo_block

Code:

<h5 class="subsubsectionhead">{vb:rawphrase post_thanks_total_thanks}</h5>
<dl class="stats">
        <dt>{vb:rawphrase post_thanks_total_thanks}</dt>
        <dd>{vb:raw userinfo.post_thanks_user_amount_formatted}</dd>
</dl>
<ul class="group">
        <li>
        <vb:if condition="$userinfo[post_thanks_thanked_times] == 1">
                {vb:rawphrase post_thanks_time_post}
        <vb:else />
                <vb:if condition="$userinfo[post_thanks_thanked_posts] == 1">
                        {vb:rawphrase post_thanks_times_post, {vb:raw userinfo.post_thanks_thanked_times_formatted}}
                <vb:else />
                        {vb:rawphrase post_thanks_times_posts, {vb:raw userinfo.post_thanks_thanked_times_formatted}, {vb:raw userinfo.post_thanks_thanked_posts_formatted}}
                </vb:if>
        </vb:if>
        </li>
<li>
                <a href="post_thanks.php?{vb:raw session.sessionurl}do=findthanks&amp;u={vb:raw userinfo.userid}">{vb:rawphrase post_thanks_search_user, {vb:raw userinfo.username}}</a>
        </li>
        <li>
                <a href="post_thanks.php?{vb:raw session.sessionurl}do=findthanks_user_gave&amp;u={vb:raw userinfo.userid}">{vb:rawphrase post_thanks_search_user_gave, {vb:raw userinfo.username}}</a>
        </li>
</ul>




Demo: http://www.yhanoi.com/forum/member.php?u=1

Vaira 05-18-2011 05:21 PM

It finally works! (I am using legacy display mode).

(I have reverted the hack to abe1's original one before, replaced the post_thanks.php, edited the alignment to {vb:stylevar left}, and fixed the inline mod issue at post_thanks_box template)

A big thanks to channelfuse. :up::up::up:

Also for raicars reminding me to add / modify the 2 templates to get it finally to work. :up:

I am really grateful that I (we) still can use the original hack and don't have to go for a paid copy with more features I don't need at all.

Thanks to all who have contributed with useful solutions, I'm happy. :)

raicars 05-19-2011 01:23 AM

1 Attachment(s)
Product update
Find all thanked posts by User
Find all posts thanked by User

Fix temp:
post_thanks_postbit_info
post_thanks_javascript template

Fix version

raj4x 05-19-2011 09:48 PM

Wow, nice updates, thanks Abe of course....and channelfuse for the updates..!

Can someone direct me towards moving these lines in the Postbit info (want to nudge them a bit to the right and down by 2-3 points - don't even know if that's possible...):

Thanks: 0
Thanked 1 Time in 1 Post

Once again, thanks for the help! :)

Raj.

andy626 05-19-2011 11:54 PM

Quote:

Originally Posted by raicars (Post 2197392)
Product update
Find all thanked posts by User
Find all posts thanked by User

Thanks a million for this, exactly what I was after!!!:up:

andy626 05-20-2011 12:09 AM

Quote:

Originally Posted by raicars (Post 2197392)
Product update
Find all thanked posts by User
Find all posts thanked by User

Does anyone know if this will delete all of the current thanks that the members have already?

raicars 05-20-2011 02:15 AM

Quote:

Originally Posted by andy626 (Post 2197803)
Does anyone know if this will delete all of the current thanks that the members have already?

This is upgrade product. This will not delete all of the current thanks that the members ;).
Demo new version:
http://www.yhanoi.com/forum/member.php?u=1
Code:

Total Thanks

Total Thanks
    382

    * Thanked 1,200 Times in 332 Posts
    * Find all thanked posts by Phở
    * Find all posts thanked by Phở


andy626 05-20-2011 09:50 AM

Quote:

Originally Posted by raicars (Post 2197839)
This is upgrade product. This will not delete all of the current thanks that the members ;).
Demo new version:
http://www.yhanoi.com/forum/member.php?u=1
Code:

Total Thanks

Total Thanks
    382

    * Thanked 1,200 Times in 332 Posts
    * Find all thanked posts by Phở
    * Find all posts thanked by Phở


Thanks for getting back to me, appreciate it!


All times are GMT. The time now is 02:33 PM.

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.04085 seconds
  • Memory Usage 1,783KB
  • 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
  • (4)bbcode_code_printable
  • (4)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (6)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