Announcement

Collapse
No announcement yet.

Buncha Questions....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Buncha Questions....

    OK, here goes.

    How do I:

    upload avatars? whenever I do it, the image doesn't show up, what do I have to do? and what should the directory be that the avatars are uploaded to?

    put Welcome, username, on my homepage? I know this is simple PHP, but I can't get it to work (my entire site is written in PHP)

    post the "Users online" on the homepage?

  • #2
    Uploading avatars is simple. You can do it one of two ways; either upload all of your avatars via FTP and then use the mass-upload option in your Admin CP, or upload them one by one using the avatar upload option in your Admin CP. The target directory in the latter case must have a path relative to your forums directory and must be CHMODed 0777.

    It would require that the user has a cookie from your BB, or that you compensate for those that don't with "Welcome, Guest". You can see how vB does it in index.php and global.php, I believe.

    See my sig. I wrote a hack to do just that.

    Comment


    • #3
      I don't understand how to read from the cookie...

      here's the code I found in index.php, that seems like it would work:

      // if user is know, then welcome
      if ($bbuserinfo['userid']!=0) {
      $username=$bbuserinfo['username'];
      eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
      eval("\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
      eval("\$newposts = \"".gettemplate('forumhome_newposts')."\";");

      } else {
      eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
      eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";");
      }

      I think that I could slim that down (since I don't need template stuff) to this:

      // if user is know, then welcome
      if ($bbuserinfo['userid']!=0) {
      $username=$bbuserinfo['username'];
      } else {
      $username="Guest"
      }

      then the echo

      echo "Welcome, $username"

      Does that look right?

      The only problem I see it that, bbuserinfo would be undefined. Again, how do I read it from the cookie?

      Heh, I have another question,
      how do I signal the root directory of the site?
      so I can include things, like this:

      include_once('/includes/online.php')
      and that will work on everypage. Othewise, I have to use alot of ../ links, and it leaves alot of room for error.

      English:
      http://www.juniorsailing.com/classes/420/tips/index.php
      I want to beable to include online.php from
      http://www.juniorsailing.com/includes/online.php
      . How can I do that efficently?

      I used to beable to do this with images:

      src="/images/asf.gif"

      but when I try the leading slash in php I get an error, HELP!

      P.S. The online hack is great.

      Comment


      • #4
        please help

        Comment


        • #5
          With your problem about $bbuserinfo, check that the cookie is accessible on the new domain/path. Go to BB CP -> Options -> Cookie Path and set it to "/"

          Comment


          • #6
            I know that it is fully accessible, because I set a test one, but I don't know how to read from it! Is there something special that I have to do to read the cookie? or will php just figure that out, and look on the user's harddrive?

            Comment


            • #7
              here's what I have:
              This is in my header file:

              <?php
              if ($bbuserinfo['userid']!=0) {
              $username=$bbuserinfo['username'];
              } else {
              $username="Guest";
              }
              ?>

              then on other pages:

              inlude_once('header.php')

              do I need to switch to require or what? does it matter since the variable username will be displayed within the header file, which in turn is displayed on the page includeing it?

              My goal is:

              I want to dispay the messageboard username on the top of all of my pages, even those that are not vBulletin generated. I just want it to say Welcome, Andrew or something like that and if it can't find the name to have it say: Welcome Guest. I think I would achieve this through reading the cookies, but I have no idea.

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...
              X