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)
-   -   Add-On Releases - [AJAX] Helpful Answers - Allow users to rate individual posts (https://vborg.vbsupport.ru/showthread.php?t=233296)

FractalizeR 06-11-2010 10:58 AM

Ted, if you need help with mod... Why not to thematically split it into several *.php files so that there are only require_once() statements left in *.xml and use Launchpad for example for development?

It's hard to code in one big xml file and checkins/checkouts by several devs are not possible in this way.

I think there will be several devs, that are interested in helping with development including me.

Ted S 06-11-2010 05:36 PM

Quote:

Originally Posted by FractalizeR (Post 2051989)
Ted, if you need help with mod... Why not to thematically split it into several *.php files so that there are only require_once() statements left in *.xml and use Launchpad for example for development?

It's hard to code in one big xml file and checkins/checkouts by several devs are not possible in this way.

I think there will be several devs, that are interested in helping with development including me.

Completely open on bringing others in here, what functions do you see adding includes support for?

FractalizeR 06-12-2010 07:04 AM

I suggested to split *.xml into several *.php files only to ease collaboration. For example, I can work on adding mod data to user's profile and for that there should be ha_userprofile.php with the code for appropriate hook. And you just require_once() this file in main *.xml. I will be able to checkin/checkout this file independently from others and will not interrupt any other work.

mad@Max 06-12-2010 10:45 AM

FractalizeR, is not a panacea:)

FractalizeR 06-13-2010 12:31 PM

Panacea for what? I don't get you.

mad@Max 06-13-2010 05:18 PM

Выводить код в файлы для увеличения производительности. Плюс получим небольшое неудобство в редактировании:)

Ted S 06-14-2010 04:13 AM

Quote:

Originally Posted by FractalizeR (Post 2052390)
I suggested to split *.xml into several *.php files only to ease collaboration. For example, I can work on adding mod data to user's profile and for that there should be ha_userprofile.php with the code for appropriate hook. And you just require_once() this file in main *.xml. I will be able to checkin/checkout this file independently from others and will not interrupt any other work.

I'm not seeing the added benefit of the require files for splitting things up but I am all for making this extendable, and not just by me.

How about I add a hook to cover additional modules, you write your profile data tool and make it an addon release. I'm glad to support any modifications to the core code but this would help avoid the multiple devs working on the same source that you identified.

Aside from the profile I'm actually rather low on user input so I'm crafting up more ideas of my own. Lots of the stuff to do is really documenting... things like profile votes exist (for showing in posts), I just need to educate on how to use them better.

FractalizeR 06-14-2010 07:13 AM

Quote:

Originally Posted by mad@Max (Post 2053025)
To push code out to files to increase performance. Plus we will get a minor inconvenience for code editing

Please speak English here. I am not suggesting to split code out to files to increase performance. However, that will increase it if server have APC or similar op cache installed. VBulletin is executing it's hooks via eval() and that sucks in performance.

I am suggesting to split plugin into several files by functionality to improve the ability to collaborate. Editing one XML is like editing a... I don't know... Will you be able to code editor like Microsoft Paint all in one C++ source code file? Is that convenient? Of course, you can pull code parts out of XML at least to have some code highlighting and after editing - put it back there. But is that convenient? I prefer rich IDEs like Zend Studio for writing code. And they are, of course, no suitable for editing XML files with embedded PHP code.

Also if something like Git will be used, we will be able to push code for review by Ted and he will be able to easily pull it and import into the project.

Quote:

Originally Posted by Ted S
Aside from the profile I'm actually rather low on user input so I'm crafting up more ideas of my own. Lots of the stuff to do is really documenting... things like profile votes exist (for showing in posts), I just need to educate on how to use them better.

So... should we craft some code example on integrating data to user profile? Can you send me your latest plugin XML so that I could try to do that? FractalizeR@yandex.ru.

Ted S 06-15-2010 04:38 AM

Quote:

Originally Posted by FractalizeR (Post 2053325)
So... should we craft some code example on integrating data to user profile? Can you send me your latest plugin XML so that I could try to do that? FractalizeR@yandex.ru.

I was actually suggesting you write what you want and I'll make it work as an addon. This way you can modify as you see fit, and I can build any support needed to make it work.

I don't see a check in/ checkout system making sense for this mod as it's a pretty small project but am very open to supporting other coders working on addons / edits for it as needed.

FractalizeR 06-21-2010 06:35 AM

Patch for member profile info for 2.3.0:

1. Add to cache_templates hook:

PHP Code:

                if (THIS_SCRIPT == 'member')
                {
                    if(
$vbulletin->options['helpans_stats_ten']) {
                        
$cache[] = 'helpful_statsbit_ten';
                    } else {
                        
$cache[] = 'helpful_statsbit';
                    }
                } 



2. Delete member_build_blocks_start hook and make member_profileblock_fetch_unwrapped hook with the following contents instead:
PHP Code:

        <plugin active="1" executionorder="100">
            <
title>Helpful Answers -- Profile Stats</title>
            <
hookname>member_profileblock_fetch_unwrapped</hookname>
            <
phpcode><![CDATA[
            
            if (
$this->registry->options['helpans_stats_votes'] OR $this->registry->options['helpans_stats_ranks'] OR $this->registry->options['helpans_stats_ten']){
                
                
// if we're using standard 0/1 voting show counts
                
if(!$this->registry->options['helpans_rank_ten']){
                
                    if (
$this->registry->options['helpans_stats_votes']){
                    
$helpfulanswer $this->registry->db->query_first_slave("
                        SELECT COUNT(helpfulanswerid) as count 
                        FROM " 
TABLE_PREFIX "helpfulanswer as helpfulanswer
                        WHERE userid = " 
intval($userinfo['userid']) . "
                    "
);    
                    }
                    
                    if (
$this->registry->options['helpans_stats_ranks']){
                    
$helpfulposts $this->registry->db->query_first_slave("
                        SELECT SUM(helpfulpost.goodrank) as goodranks,SUM(helpfulpost.totalrank) as totalranks
                        FROM " 
TABLE_PREFIX "helpfulpost as helpfulpost
                        INNER JOIN " 
TABLE_PREFIX "post AS post ON(post.postid = helpfulpost.postid)
                        WHERE post.userid = " 
intval($userinfo['userid']) . "
                        GROUP by post.userid
                    "
);
                    }
                    
                    
$helpfulposts['badranks'] = $helpfulposts['totalranks'] - $helpfulposts['goodranks'];
                    if(
$helpfulposts['goodranks'] > AND $helpfulposts['totalranks'] > 0){ $helpfulposts['average'] = ($helpfulposts['goodranks'] / $helpfulposts['totalranks']); }
                    
                    (
$hook =  vBulletinHook::fetch_hook('helpfulanswers_user_stats')) ? eval($hook) : false;
                    
                    
$templater vB_Template::create('helpful_statsbit');
                    
$templater->register('helpfulanswer_count'$helpfulanswer['count']);
                    
$templater->register('helpfulanswer_goodranks'$helpfulposts['goodranks']);
                    
$templater->register('helpfulanswer_totalranks'$helpfulposts['totalranks']);
                    
$templater->register('helpfulanswer_badranks'$helpfulposts['badranks']);
                    
$templater->register('helpfulanswer_average'$helpfulposts['average']);
                    
$template_hook['profile_stats_last'] .= $templater->render();
                                
                
                
// if we're using 10 scale votes show different
                
} else {
                
                    if (
$this->registry->options['helpans_stats_ten']){
                    
                        
$helpfulposts $this->registry->db->query_first_slave("
                            SELECT SUM(helpfulpost.goodrank) as goodrank, SUM(helpfulpost.totalrank) as totalranks
                            FROM " 
TABLE_PREFIX "helpfulpost as helpfulpost
                            INNER JOIN " 
TABLE_PREFIX "post AS post ON(post.postid = helpfulpost.postid)
                            WHERE post.userid = " 
intval($userinfo['userid']) . "
                            GROUP by post.userid
                        "
);
                        
                        if(
$helpfulposts['goodrank'] && $helpfulposts['totalranks'] > 0){ $helpfulposts['avgrank'] = $helpfulposts['goodrank'] / $helpfulposts['totalranks']; }
                        
$helpfulposts['avgrank'] = number_format($helpfulposts['avgrank'], 1'.'' ');
                        
                        
$templater vB_Template::create('helpful_statsbit_ten');
                        
$templater->register('helpfulanswer_goodranks'$helpfulposts['goodranks']);
                        
$templater->register('helpfulanswer_totalranks'$helpfulposts['totalranks']);
                        
$templater->register('helpfulanswer_badranks'$helpfulposts['badranks']);
                        
$templater->register('helpfulanswer_average'$helpfulposts['average']);
                        
$template_hook['profile_stats_last'] .= $templater->render();
                        
                    }
                
                }
    
            }
            
            ]]></
phpcode>
        </
plugin

Also you can find ideas for next versions here: https://vborg.vbsupport.ru/showpost....&postcount=362


All times are GMT. The time now is 11:59 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.01888 seconds
  • Memory Usage 1,812KB
  • 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
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)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