Results 1 to 6 of 6

Thread: Passing username within a module as $bbuserinfo[username]

  1. #1

    Default Passing username within a module as $bbuserinfo[username]

    Hi All

    I want to pass the members username to an external php app running inside of a vBA PHP Module in the /modules directory and so far I have been trying this:

    $bbuserinfo[username]

    ... and the code I am using to test the output is:

    PHP Code:
     echo "bbuserinfo = "."$bbuserinfo[username]"
    which doesn't work
    PHP Code:
     echo "bbuserinfo = ".$bbuserinfo[username]; 
    which also doesn't work

    ... but when I echo the output of this to see if it returns the username of the member who has clicked on the link, I see blank.

    Is this the correct syntax pls...?

    In a little more detail, what I want to be able to do is to pass the vB Username value to a PHP script from a link somewhere on my site. This link would normally be in the header or navbar, but could effectively be in a post too.

    I want the Username value to be available within this script.

    I have done this from the root of my site on a link in the navbar by using a <form> statement thus:

    Code:
        <form name="tmpFinalsform" action="http://www.themouthpiece.com/predict/index.php" method="post" target="_blank">
            <input type="hidden" name="username" value="$bbuserinfo[username]"/>
        </form>
    then using the following in a <td>

    Code:
    <td class="vbmenu_control"><a href="#" onclick="if (document.forms['tmpFinalsform'].username.value=='Unregistered') {alert('Only Registered Members may participate in the Predictions contest. Feel free to sign up and try again.');} else {document.forms['tmpFinalsform'].submit();}">tMP Predictions</a></td>
    This passes my members username through to the application called via the link - and works.

    However, I have moved this code into a the modules subdirectory within vB and it no longer works and I can't fathom out why.

    Any ideas?
    John
    www.theMouthPiece.com - Brass music discussion
    www.reflectingme.com - gallery

  2. #2
    Administrator Brian's Avatar
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,465

    Default Re: Passing username within a module as $bbuserinfo[username]

    $vbulletin->userinfo['username'] would be the variable for the username outside of the vB template system.

  3. #3

    Default Re: Passing username within a module as $bbuserinfo[username]

    Hey Brian

    Long time no see/hear/speak/talk how are you buddy?

    I am desperately trying to get this to work as a module inside a vBA PHP page but just can't fathom it out. I have it working as a link in the header on tMP, that then calls the .php page when it is held in a separate directory outside of vB, but when I move the code in its entirety (which is SMARTY template driven but PHP code) to the vBA Modules directory, it just stops working and passing the vB username across.
    Last edited by theMusicMan; 07-01-2007 at 01:45 PM.
    John
    www.theMouthPiece.com - Brass music discussion
    www.reflectingme.com - gallery

  4. #4
    Administrator Brian's Avatar
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,465

    Default Re: Passing username within a module as $bbuserinfo[username]

    I can't complain. Been staying busy, but I guess that's better than being bored... I think anyways. It's been a while since I was bored, so I'm starting to forget what that feels like.
    How about yourself?

    For your PHP file... Are you using one of your CMPS pages to include it? Or are you just linking straight to the file without the CMPS really being involved with it? Also, did you try using $vbulletin->userinfo[] instead of $bbuserinfo[]? Unfortunately I don't have time for any type of custom work these days, but I can at least try to get you pointed in the right direction.

  5. #5

    Default Re: Passing username within a module as $bbuserinfo[username]

    Hey Brian

    I am doing fine thanks, fully self employed now at last. I run a Project Management and consulting business and am presently fully booked with clients until the end of 2007... with provision for several more months too. Deploying CRM systems to large corporates on a global basis. Just come back from the US, South Africa and Dubai... heck of a trip... more to come and all good stuff.

    Anyways... yes, I am trying to create a new CMPS PHP page to accomplish this. The code works as I posted from the link in the header, and passes the username through to the HP application, but when I move all the files to the /modules directory (and under), it doesn't work.

    What I mean by this is; in the root I have a directory structure (outside vB) where the PHP files and SMARTY templates are stored. When I use the link on the header, the code works and I manage to pass the vb Username to the PHP application. I also use a MySQL db for this by the way... not the vB one.

    However, when I move the directory structure to /modules, and then create the new CMPS module PHP page, it doesn't work at all. I ensure the file called is actually in the /modules directory, but alas no joy!

    I haven't tried your alternate code as I wanted to ascertain if you were interested in some custom work - but I will do so now and let you know.

    I appreciate there will be more to do with the code, but at the moment I can't even get past the first post and get the app to pass the vB username through!!

    Inexperience I guess, hence calling on your wisdom.
    John
    www.theMouthPiece.com - Brass music discussion
    www.reflectingme.com - gallery

  6. #6
    Junior Member
    Join Date
    Mar 2013
    Posts
    1

    Default

    This is the closest thread I've found to what I'm trying to do, but the solution is not posted.

    What I'm attempting to do is pass the current username to a PHP script using the GET method. (i.e. - doStuff.php?user=<insert username here>) This is actually being used in an [iframe] tag. Is there a simple way to do this?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Top Referrers module on home page by username?
    By maxwolfie in forum Module & Modification Discussion & Requests
    Replies: 1
    Last Post: 05-23-2007, 02:08 PM
  2. Username in a module and title
    By yuriy in forum "How Do I..." Questions
    Replies: 2
    Last Post: 11-11-2006, 05:22 PM
  3. remove the username and time/date stamp from news module
    By teezdesigns in forum "How Do I..." Questions
    Replies: 2
    Last Post: 09-04-2006, 07:00 PM
  4. Show a members username on a module?
    By ERuiz in forum Troubleshooting / "How do I..." Questions
    Replies: 1
    Last Post: 02-26-2005, 02:38 PM
  5. How do I dropdown username?
    By khaleel in forum Add-On Modules & Modifications
    Replies: 3
    Last Post: 10-14-2004, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •