Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2005, 10:18 AM
Allan's Avatar
Allan Allan is offline
 
Join Date: Jun 2003
Location: France
Posts: 1,513
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Mod for Geek's hack Article


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For this hack
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Would it be possible to carry out a MOD which makes it possible to see in the postbit the number of articles written by the user ?

and if possible that one can click above to go directly to the articles
Reply With Quote
  #2  
Old 04-19-2005, 11:40 AM
Allan's Avatar
Allan Allan is offline
 
Join Date: Jun 2003
Location: France
Posts: 1,513
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nobody ??
Reply With Quote
  #3  
Old 04-19-2005, 03:04 PM
Lizard King Lizard King is offline
 
Join Date: Jan 2005
Location: Mersin
Posts: 907
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think it is impossible because the articles are also regular threads so i cannot imagine a way to count this special threads.
Reply With Quote
  #4  
Old 04-19-2005, 03:12 PM
Allan's Avatar
Allan Allan is offline
 
Join Date: Jun 2003
Location: France
Posts: 1,513
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I the opinion of front Geek waits, but it is a pity
Reply With Quote
  #5  
Old 04-19-2005, 03:25 PM
The Geek's Avatar
The Geek The Geek is offline
 
Join Date: Sep 2003
Location: Behind you
Posts: 2,779
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually - I dont think it would be very difficult to do.

Here is one way of doing it:
1- Create a new userprofile field
2- Add an update to that userprofile field in the insert_new_article function of functions_geekarticles (in the if branch that has the INSERT statement - meaning it was a new article).
3- You would have to do the same for when a thread gets deleted that is in an article forum (currently - GAS doesnt go there).
4- I would recommend creating a script that would pull all userids from threads that are posted in gas forums. THen look through to override the userprofile field. This can be a one off 'importer' and/or an occasional cron job to make sure you are in sync.
5- As a userprofile field - its a bit o cake to pull that info into the postbit
6- Link to search.php to search GAS forums by userid.

Seriously - wouldnt be that big of a job. I would do it if I wasnt already swamped. I am more than happy to assist anyone wanting to do it.
Reply With Quote
  #6  
Old 04-19-2005, 03:34 PM
Telkman Telkman is offline
 
Join Date: Jul 2003
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not got the time to do a full hack for this, but hopefully this quick example will get you started...

This example is only changing showthread.php, if you wanted to make the same changes to showpost.php, announcement.php and others that use the postbit, it's easy enough. I'm trying to keep this as simple as possible, so this is just a replace in showthread.php rather than a $post[...] value. It will add one additional query, which could probably be avoided, but again, I'm in a hurry and trying to keep it simple.

In showthread.php:

PHP Code:
Find both occurences of:
    
$postbits .= construct_postbit($post$template); 

PHP Code:
Add below each:
    
$acs[$post[userid]] = intval($post[userid]); 

PHP Code:
Then find:
            
$postbit construct_postbit($post$template); 
PHP Code:
Add below:
            
$acs[$post[userid]] = intval($post[userid]); 
PHP Code:
Then find:
    eval(
'print_output("' fetch_template('SHOWTHREAD') . '");');
}
// === /GAS step 615 === 

PHP Code:
Add above:
    
$acs2 implode(","array_values($acs));
    
$act $DB_site->query("SELECT COUNT(threadid) AS threads, postuserid AS userid FROM " TABLE_PREFIX "thread WHERE postuserid IN ($acs2) AND forumid IN (" $GAS_setting['forums'] . ") GROUP BY postuserid");
    while (
$act2 $DB_site->fetch_array($act))
    {
        
$search[] = "ac[$act2[userid]]";
        
$replace[] = vb_number_format($act2[threads]);
        unset(
$acs[$act2[userid]]);
    }
    foreach (
$acs as $acid)
    {
        
$search[] = "ac[$acid]";
        
$replace[] = 0;
    }
    
$postbits str_replace($search$replace$postbits); 

In your postbit template you would then need:
PHP Code:
<if condition="THIS_SCRIPT == 'showthread'"><div><a href="search.php?$session[sessionurl]do=process&amp;showposts=0&amp;starteronly=1&amp;exactname=1&amp;searchuser=$post[username]&amp;forumchoice=*****">Articles Writtenac[$post[userid]]</a></div></if> 
Replace ***** with the article forumid. If you need more than one forumid, use forumchoice[]=*****&amp;forumchoice[]=***** etc for each forumid. This could be generated from $GAS_setting['forums'] fairly easily if you wanted to.

Having reread it, it doesn't make a huge deal of sense, but hopefully you can find your way though it if it's of use to you.
Reply With Quote
  #7  
Old 04-19-2005, 04:00 PM
The Geek's Avatar
The Geek The Geek is offline
 
Join Date: Sep 2003
Location: Behind you
Posts: 2,779
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is something else you can either add to, or alter how you see fit.

Edit search.php

Find:
PHP Code:
// #############################################################################
if ($_REQUEST['do'] == 'finduser')
{
    
globalize($_REQUEST, array('userid' => INT'forumid' => INT)); 
replace with:
PHP Code:
// #############################################################################
if ($_REQUEST['do'] == 'finduser')
{
    
globalize($_REQUEST, array('userid' => INT'forumid' => INT,'GAS'=>INT));
 
if(
$GAS AND !$forumid){
$GAS_result=$DB_site->query_first("SELECT data FROM " TABLE_PREFIX "datastore WHERE title='GAS_settings'");
$GAS_setting=unserialize($GAS_result['data']);
if (
$GAS_setting['forums']){
    
$forumid=explode(",",$GAS_setting['forums']);
}

Then you can stick something like:
PHP Code:
<a href="search.php?do=finduser&u=$bbuserinfo[userid]&GAS=1">Find all of $bbuserinfo[username]'s articles</a> 
I know that wont get you the article count - but its alomst there
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:38 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.04292 seconds
  • Memory Usage 2,254KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (10)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete