The vB Geek

Go Back   The vB Geek > vB Geek Products > Geek Article and Review System

Geek Article and Review System GARS is the mega popular system for turning forums into articles, tutorials, or even reviews.

Advertisement
  Learn how to remove ads

Reply
 
Thread Tools Display Modes
  #11  
Old 06-05-2008, 04:27 PM
Morgan's Avatar
Morgan Morgan is offline
Administrator
 
Join Date: Jul 2006
Posts: 2,255
Geek Article and Review System License Holder GeekMart License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder Geek Gazette License Holder 
Default

Go to the ACP -> GARS -> Modules -> click the module set with custom fields -> click the Custom Fields link -> see what Cache Method is selected. Maybe something old is set and if so go to the ACP -> GARS -> Tools -> Clean Cache.
__________________
Please use the forums for support, feature requests, and similar such things. Support does not include custom code, custom template edits, or third-party modifications. PMs and emails to me should be for private information only, such as login information. If you PM or email me a support question, chances are good that I'll ignore it. Thanks.
While the work or play is on, it is a lot of fun if while you are doing one you don't constantly feel that you ought to be doing the other. -- Franklin Pierce Adams
Reply With Quote
  #12  
Old 06-07-2008, 05:54 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
Junior Member
 
Join Date: Jul 2006
Posts: 22
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder 
Default

Morgan,

The problem with required fields seems to be what I'd consider a bug in vB.

When submitting a new thread, $errors gets passed in to build_new_post() by reference. And build_new_post() then does this:

PHP Code:
    $errors = array(); 
So of course the $errors you set previously in the newthread_start hook get blown away.

I guess the obvious work around would be to hang something on newpost_process to restore $errors.

-- hugh

Last edited by cheesegrits; 06-07-2008 at 05:59 PM..
Reply With Quote
  #13  
Old 06-08-2008, 08:30 PM
Morgan's Avatar
Morgan Morgan is offline
Administrator
 
Join Date: Jul 2006
Posts: 2,255
Geek Article and Review System License Holder GeekMart License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder Geek Gazette License Holder 
Default

GARS runs its persist_values function (which calls load(...) which calls process_post(...) which sets custom field $errors) from the newpost_complete hook, so that is after $errors = array(); is set, but I agree, there appears to be some strange scope/reference issue with vB 3.7 and GARS custom fields, but from the below test code, there shouldn't be an issue. If anyone with this issue wants to be a guinea pig, then PM me both FTP login info and admin level ACP access.
Code:
$errors = array(1,2,3);

test1($errors);

function test3()
{
	global $errors;
	$errors[] = 8;
}

function test2()
{
	global $errors;
	$errors[] = 7;
	test3();
}

function test1(&$errors)
{
	$errors = array();
	$errors = array(4,5,6);
	test2();
}

print_r($errors);
Code:
Prints...

Array
(
    [0] => 4
    [1] => 5
    [2] => 6
    [3] => 7
    [4] => 8
)
__________________
Please use the forums for support, feature requests, and similar such things. Support does not include custom code, custom template edits, or third-party modifications. PMs and emails to me should be for private information only, such as login information. If you PM or email me a support question, chances are good that I'll ignore it. Thanks.
While the work or play is on, it is a lot of fun if while you are doing one you don't constantly feel that you ought to be doing the other. -- Franklin Pierce Adams
Reply With Quote
  #14  
Old 06-08-2008, 09:42 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
Junior Member
 
Join Date: Jul 2006
Posts: 22
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder 
Default

Quote:
Originally Posted by Morgan View Post
GARS runs its persist_values function (which calls load(...) which calls process_post(...) which sets custom field $errors) from the newpost_complete hook, so that is after $errors = array(); is set,
Except that persist_values() never calls load(), because ...

PHP Code:
                if (!is_array($this->values))
                {
    
$this->load($threadinfo['threadid']);
                } 
... $this->values already exists.

-- hugh
Attached Images
File Type: jpg gars_errors.JPG (111.4 KB, 5 views)
Reply With Quote
  #15  
Old 06-08-2008, 11:33 PM
Morgan's Avatar
Morgan Morgan is offline
Administrator
 
Join Date: Jul 2006
Posts: 2,255
Geek Article and Review System License Holder GeekMart License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder Geek Gazette License Holder 
Default

Thanks, see it. Haven't had a chance to test these, but add the following two plugins (how to add a plugin):
  • newthread_post_start
    Code:
    if (is_object($vbulletin->gars) && is_array($errors))
    {
    	$gars_errors = $errors;
    }
  • newpost_process
    Code:
    if (is_object($vbulletin->gars))
    {
    	global $gars_errors;
    
    	if (is_array($gars_errors))
    	{
    		if (is_array($errors))
    		{
    			$errors = array_unique(array_merge($errors, $gars_errors));
    		}
    		else
    		{
    			$errors = $gars_errors;
    		}
    	}
    
    	unset($gars_errors);
    }
__________________
Please use the forums for support, feature requests, and similar such things. Support does not include custom code, custom template edits, or third-party modifications. PMs and emails to me should be for private information only, such as login information. If you PM or email me a support question, chances are good that I'll ignore it. Thanks.
While the work or play is on, it is a lot of fun if while you are doing one you don't constantly feel that you ought to be doing the other. -- Franklin Pierce Adams
Reply With Quote
  #16  
Old 06-09-2008, 12:45 AM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
Junior Member
 
Join Date: Jul 2006
Posts: 22
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder 
Default

Yup, that works.

I think I'll submit a bug report on that vB behavior though. Taking $errors as a pass by reference and then immediately blowing it away is just Bad Form.

-- hugh
Reply With Quote
  #17  
Old 06-10-2008, 04:29 PM
Morgan's Avatar
Morgan Morgan is offline
Administrator
 
Join Date: Jul 2006
Posts: 2,255
Geek Article and Review System License Holder GeekMart License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder Geek Gazette License Holder 
Default

Second plugin tweaked with array_unique for those using vB where $error isn't wiped out.
__________________
Please use the forums for support, feature requests, and similar such things. Support does not include custom code, custom template edits, or third-party modifications. PMs and emails to me should be for private information only, such as login information. If you PM or email me a support question, chances are good that I'll ignore it. Thanks.
While the work or play is on, it is a lot of fun if while you are doing one you don't constantly feel that you ought to be doing the other. -- Franklin Pierce Adams
Reply With Quote
  #18  
Old 06-12-2008, 01:29 PM
Namaless Namaless is offline
Member
 
Join Date: Oct 2007
Posts: 50
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder 
Default

One question: this bug is the GARS or vBulletin?

Now works correctly.. thanks

Regards.
Reply With Quote
  #19  
Old 06-13-2008, 12:46 AM
Morgan's Avatar
Morgan Morgan is offline
Administrator
 
Join Date: Jul 2006
Posts: 2,255
Geek Article and Review System License Holder GeekMart License Holder Geek Auto-Linker Pro License Holder Geek Advertising Banner License Holder Geek Gazette License Holder 
Default

IMO neither is a bona fide bug. vB code changed, $errors is now cleared before a hook, and that change wiped out the GARS $errors. The plugins in post fifteen preserve the GARS $errors, should work on vB 3.6 and vB 3.7, and have already been added to the GARS v.2.1.9 package.
__________________
Please use the forums for support, feature requests, and similar such things. Support does not include custom code, custom template edits, or third-party modifications. PMs and emails to me should be for private information only, such as login information. If you PM or email me a support question, chances are good that I'll ignore it. Thanks.
While the work or play is on, it is a lot of fun if while you are doing one you don't constantly feel that you ought to be doing the other. -- Franklin Pierce Adams
Reply With Quote
  #20  
Old 06-13-2008, 06:15 AM
Namaless Namaless is offline
Member
 
Join Date: Oct 2007
Posts: 50
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder 
Default

All right, I need to upgrade Gars Package? Or not necessary for now?

Thanks.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Users can post threads without entering the required custom fields! Milad Geek Article and Review System 5 06-21-2008 05:29 PM
Custom Fields Damir Geek Article and Review System 27 10-13-2006 04:38 PM
required fields * benj Geek Article and Review System 2 09-12-2006 02:07 PM
Custom field values not showing when editing SoloX Geek Article and Review System 7 07-24-2006 01:54 AM
Upload Custom Submission Avatars and custom fields question. Praetorian Geek Article and Review System 1 06-14-2006 01:50 PM


All times are GMT. The time now is 07:53 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.