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
  #1  
Old 04-09-2008, 01:56 PM
lthanos lthanos is offline
Member
 
Join Date: Feb 2008
Posts: 47
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder Geek Gazette License Holder 
Default Use queries results in userinfo module

Hi, I have been using an SQL query that returns the count of a user's topics in certain forums (in our case, all gars forums). So I have created a plugin with this code in postbit_display_start hook ;

PHP Code:
if (isset($post['userid'])) {
$stories $this->registry->db->query_first(
                    SELECT count(threadid) AS num 
                    FROM vbthread AS thread 
                    WHERE  
                     (
                        forumid = 57 OR 
                        forumid = 58 OR 
                        forumid = 59 OR 
                        forumid = 60 OR 
                        forumid = 61 OR 
                        forumid = 62 OR 
                        forumid = 63
                     ) AND postuserid = " 
$post['userid'] . 
"
);

And then I use this conditional and code part to display the number of these topics in the user postbit;

PHP Code:
<if condition="$stories[num]>0">
<
div class="postdata">Stories: <a href="http://www.mydomain.com/search.php?do=finduser&u=$post[userid]&starteronly=1&forumchoice[]=57&forumchoice[]=58&forumchoice[]=59&forumchoice[]=60&forumchoice[]=61&forumchoice[]=62&forumchoice[]=63" target="_blank">$stories[num]</a></div>
</if> 
But when I use this code in the gars_userinfo template, the variable doesn't come back, I just get a blank after the "stories:" part. Do I need to define this variable somewhere else as well?

I have the exact same problem with photopost "photos uploaded by user in postbit" part;

PHP Code:
<if condition="$post['field7'] == 'Yes'">
<
div class="postdata">My photos: <a href="/photo/showgallery.php?cat=500&ppuser=$post[userid]" target="_blank">
$trackpadspppbit</a
Any ideas?
Reply With Quote
  #2  
Old 04-09-2008, 03:13 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

Not sure, try looking at the HTML source for the page where those HTML links are to appear. Maybe that'll give a clue.
__________________
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
  #3  
Old 04-09-2008, 04:06 PM
lthanos lthanos is offline
Member
 
Join Date: Feb 2008
Posts: 47
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder Geek Gazette License Holder 
Default

The HTML links are not the problem, the variables are.

Even if I delete the html links AND the conditionals and leave it like this:

PHP Code:
<div class="postdata">Stories$stories[num]</div

PHP Code:
<div class="postdata">My photos$trackpadspppbit 

we only expect the variables to return the number of $stories and the number of the user photos. But they don't.

Maybe something with the postbit_template_start hook? Should I place it in another hook or something?

Edit: for the photos count thing, here is the query that builds the variable;

PHP Code:
    $ppphotosinpostbit $db->query_first("SELECT COUNT(*) AS count FROM pptablename WHERE userid = $post[userid]");
    
$trackpadspppbit vb_number_format($ppphotosinpostbit['count']); 
Is it possible that GARS uses a diferrent variable for $post[userid] ? Because maybe that's where the problem is for both of these errors.

Last edited by lthanos; 04-09-2008 at 04:18 PM..
Reply With Quote
  #4  
Old 04-09-2008, 04:38 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

It might be a scope issue. Variables defined in functions, stay in functions. Maybe you need the following line somewhere:
Code:
global $stories, $trackpadspppbit;
Another thing to consider is to not run a query per post. Probably works okay on small forums, but it could tank large ones.
__________________
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
  #5  
Old 04-09-2008, 05:42 PM
lthanos lthanos is offline
Member
 
Join Date: Feb 2008
Posts: 47
Geek Article and Review System License Holder Geek Auto-Linker Pro License Holder Geek Gazette License Holder 
Default

Yes, I know, but my forum is very small and I have absolutely no idea how to do this any other way.

Anyway, I used this line in the respective plugins but no-go.

Thanks for your help on this.
Reply With Quote
  #6  
Old 04-10-2008, 08:47 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

The $post variable should be globaled where it needs to be globaled, so you might try assigning your variables to $post['your_unique_varname1'] and $post['your_unique_varname2'] and then use those variables in the templates instead.
__________________
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
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
external.php results with gars dawgbone Geek Article and Review System 4 11-14-2008 07:11 PM
Listing custom fields in vbulletin search results stckhlm Geek Article and Review System 1 09-30-2008 07:06 PM
Cache setting queries ccplim Geek Article and Review System 4 05-02-2008 12:45 AM
Any way to change the appearance of results from multiple checkboxes?? -RL- Geek Article and Review System 3 05-09-2007 10:48 PM
A way of putting Date Selector results into threadtitle? COBRAws Geek Article and Review System 5 07-04-2006 01:26 AM


All times are GMT. The time now is 10:43 PM.


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