Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2009, 09:49 PM
EagleNick's Avatar
EagleNick EagleNick is offline
 
Join Date: Dec 2007
Location: Florida
Posts: 517
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Variable for userid

I have created plugin for the member_build_blocks_start hook and I need to use the UserID variable. I've tried a slew of things such as:
$user['userid']
$prepared[userid]
$bbuserinfo[userid]

And none of them work.

What is the proper variable to use?

Thanks.
Reply With Quote
  #2  
Old 04-12-2009, 10:12 PM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EagleNick View Post
I have created plugin for the member_build_blocks_start hook and I need to use the UserID variable. I've tried a slew of things such as:
$user['userid']
$prepared[userid]
$bbuserinfo[userid]

And none of them work.

What is the proper variable to use?

Thanks.
$prepared['userid']

You were missing the ' '
Reply With Quote
  #3  
Old 04-12-2009, 10:50 PM
EagleNick's Avatar
EagleNick EagleNick is offline
 
Join Date: Dec 2007
Location: Florida
Posts: 517
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some reason, it's not working. Whenever I use that variable, the entire plugin just stops working.

I know for sure that it's this variable causing the problem because when I change it to something else or remove it, it works fine.

I thought maybe I need to escape the single-quotes so I inserted backslashes before each one ($prepared[\'userid\']). The plugin worked when I did this, but the variable didn't parse. I simply gave "$prepared[\'userid\']" as the output.

I don't know what the problem is.
Reply With Quote
  #4  
Old 04-12-2009, 11:35 PM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm using it in a query like this

Code:
WHERE userid = '".$prepared['userid']."'
If that doesn't work you can also try $userinfo['userid']
Reply With Quote
  #5  
Old 04-13-2009, 12:23 AM
EagleNick's Avatar
EagleNick EagleNick is offline
 
Join Date: Dec 2007
Location: Florida
Posts: 517
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not using it in a query; I'm using it in a plugin. I'm not sure if it makes a difference though...

--------------- Added 12 Apr 2009 at 21:26 ---------------

Okay, that isn't working either. Here's my plugin:

Code:
$blocklist = array_merge($blocklist, array(
    'licenses' => array(
        'class' => 'licenses',
        'title' => 'User Licenses',
        'hook_location' => 'profile_left_last'
    )
));

class vB_ProfileBlock_licenses extends vB_ProfileBlock
{
    var $template_name = 'memberinfo_block_licenses';

    function confirm_empty_wrap()
    {
        return false;
    }

    function confirm_display()
    {
        return ($this->block_data['licenses'] != '');
    }

    function prepare_output($id = '', $options = array())
    {
        $this->block_data['licenses'] = '<iframe src="http://www.mydomain.net/admincp/vbma_admin.php?do=viewuserslicenses&userid=userIDhere" width="100%"></iframe>';
    }
}
What I'm doing is adding a new tab to the user profiles. Basically, the content of the tab will be an iframe of a page in the AdminCP (code in blue). I need the code in red to become the user ID of the person's profile I'm viewing.

So now here is the list of things I've tried (in place of the red code):

$user['userid']
$prepared[userid]
$prepared['userid']
'".$prepared['userid']."'

... and none of them work.
Reply With Quote
  #6  
Old 04-13-2009, 12:33 AM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this.

Code:
$blocklist = array_merge($blocklist, array(
    'licenses' => array(
        'class' => 'licenses',
        'title' => 'User Licenses',
        'hook_location' => 'profile_left_last'
    )
));

class vB_ProfileBlock_licenses extends vB_ProfileBlock
{
    var $template_name = 'memberinfo_block_licenses';

    function confirm_empty_wrap()
    {
        return false;
    }

    function confirm_display()
    {
        return ($this->block_data['licenses'] != '');
    }

    function prepare_output($id = '', $options = array())
    {
 $outdata = "<iframe src=\"http://www.mydomain.net/admincp/vbma_admin.php?do=viewuserslicenses&userid=\".$prepared['userid']."\" width=\"100%\"></iframe>";
        $this->block_data['licenses'] = $outdata;
    }
}
Reply With Quote
  #7  
Old 04-13-2009, 12:37 AM
EagleNick's Avatar
EagleNick EagleNick is offline
 
Join Date: Dec 2007
Location: Florida
Posts: 517
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope, no dice. Have no clue what the problem is
The tab doesn't even appear with this code.
Reply With Quote
  #8  
Old 04-13-2009, 12:42 AM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EagleNick View Post
Nope, no dice. Have no clue what the problem is
The tab doesn't even appear with this code.
Does the iframe page exist or did you change the URL in my code? The tab won't display if theres no data assigned to the variable.
Reply With Quote
  #9  
Old 04-13-2009, 12:50 AM
EagleNick's Avatar
EagleNick EagleNick is offline
 
Join Date: Dec 2007
Location: Florida
Posts: 517
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EnIgMa1234 View Post
Does the iframe page exist or did you change the URL in my code? The tab won't display if theres no data assigned to the variable.
I changed the URL from mydomain to what my actual domain is. And yes, the iFrame page exists, provided the userID is parsed correctly.
In other words, if I place nothing after userid=, it works. If I put a number in there such as '1', it works. Apparently, we haven't found the right variable for the userId.
Reply With Quote
  #10  
Old 04-13-2009, 01:09 AM
EnIgMa1234 EnIgMa1234 is offline
 
Join Date: Mar 2006
Location: .:: Ireland ::.
Posts: 1,306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EagleNick View Post
I changed the URL from mydomain to what my actual domain is. And yes, the iFrame page exists, provided the userID is parsed correctly.
In other words, if I place nothing after userid=, it works. If I put a number in there such as '1', it works. Apparently, we haven't found the right variable for the userId.
Try assigning what you are using to a new variable like:

Code:
$usersid = $prepared['userid'];
in the prepare_output function and use $usersid variable instead.

Also try adding the following the the function as well:
Code:
global $vbulletin, $prepare;
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 05:52 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.04265 seconds
  • Memory Usage 2,261KB
  • Queries Executed 13 (?)
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
  • (5)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete