vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to grab Username from inside a Plugin (https://vborg.vbsupport.ru/showthread.php?t=288216)

CoffeeLovesYou 09-23-2012 08:21 PM

How to grab Username from inside a Plugin
 
I am using a template with $includedphp in it.
My plugin is as follows (a form which inserts info into the database).. I need it to include their Username but it isn't grabbing anything

PHP Code:

ob_start();
?>
<body>
<table border="1">
  <tr>
    <td align="center">Submit Data</td>
  </tr>
  <tr>
    <td>
      <table>
        <form method="post" action="submitintodatabasesql.php">
        <tr>
          <td>Username:</td>
          <td><text type="varchar" name="req_username" value="$vbulletin->userinfo['username']" size="50">
          </td>
        </tr>
        <tr>
          <td></td>
          <td align="right"><input type="submit" 
          name="submit" value="Submit"></td>
        </tr>
        </table>
      </td>
    </tr>
</table>
</body>
</html></center>

<?php
   $requestasong 
ob_get_contents();
ob_end_clean();

However, the $vbulletin->userinfo['username'] is showing up blank, like this.

https://vborg.vbsupport.ru/external/2012/09/16.png

How do I call the username?

kh99 09-23-2012 08:41 PM

I don't think there's any html <text> tag. I think you either want <textarea> or <input type="text"...

Edit: Also I don't know if you can put a php variable in there when you're in html mode (outside the <?php ... ?> tags), so you might have to do something like

Code:

<?php echo($vbulletin->userinfo['username']); ?>

CoffeeLovesYou 09-23-2012 09:38 PM

Woohoo, it worked, thank you!! :D
Also, it was <text> because I didn't want them to be able to edit their username. Changed it to input type="text" and added readonly property. You're awesome!


All times are GMT. The time now is 03:49 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.00965 seconds
  • Memory Usage 1,718KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete