PHP question (line of code)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • indie
    Senior Member
    • Aug 2004
    • 872

    PHP question (line of code)

    Hi:

    I am calling a profile pic to a custom page and it sometimes caches to an older pic because the dateline is not appended.

    How can I add the code to call the profile pic WITH the dateline to this line of code?

    "<img src=\"$vboptions[bburl]/image.php?u=".$row[userid]."&type=profile"."\" valign=\"top\" alt=\"".$row[username]."\" border=\"0\" width=\"$picturewidth\" />

    Thanks!

    Here is the MEMBERINFO template where they call it. How can I add that dateline code to the above code. All I want is the above edited to include the dateline.

    <img src="image.php?u=$userinfo[userid]&amp;type=profile&amp;dateline=$userinfo[profilepicdateline]" alt="<phrase 1="$userinfo[username]">$vbphrase[xs_picture]</phrase>" border="0" style="border:1px solid $stylevar[tborder_bgcolor]" />
  • merk
    Senior Member
    • Jul 2001
    • 4149

    #2
    The easiest way to add a date to it so it isnt cached is add the current timestamp.

    if you set $timenow to time(); and add &dateline=$timenow to the url, it should stop it from being cached.

    Comment

    • indie
      Senior Member
      • Aug 2004
      • 872

      #3
      Thanks, it's working!

      However, would it not be better to assign the dateline that is already assigned to the profile pic, instead of creating a current time dateline?

      The profile pic has an assigned dateline, but the one called on the custom page is now calling the current time as a dateline, will that cause problems every time it's viewed it's stored in the temp folders of the browser, instead of storing one?

      I don't mind that it's cached with the dateline, since that would be the most recent one anyway. The problem was it had no dateline at all attached, so it was caching to older ones.

      I'll use this solution now, if you don't think it's a problem I'll keep it.

      Thanks again.
      Last edited by indie; Mon 24 Jan '05, 10:55pm.

      Comment

      • Freddie Bingham
        Former vBulletin Developer
        • May 2000
        • 14057
        • 1.1.x

        #4
        &dateline=$timenow will result in the image never being pulled from the cache. If you want the dateline, you'll need to modify the query that is setting your $row varibale to JOIN the profile picture table on userid and pull the dateline.

        Comment

        • indie
          Senior Member
          • Aug 2004
          • 872

          #5
          Originally posted by Freddie Bingham
          &dateline=$timenow will result in the image never being pulled from the cache. If you want the dateline, you'll need to modify the query that is setting your $row varibale to JOIN the profile picture table on userid and pull the dateline.
          Can you post exactly what you mean in code please? Thank you very much!

          Comment

          • merk
            Senior Member
            • Jul 2001
            • 4149

            #6
            Your SQL query will need to pull the dateline of the profile picture image.

            This means you need to LEFT JOIN the table that contains profile picture information. Im not sure which table contains that information, but it would be something like

            SELECT user.*, profilepicture.dateline FROM user
            LEFT JOIN profilepicture USING ( user.userid )
            WHERE user.userid = userid.

            Comment

            • indie
              Senior Member
              • Aug 2004
              • 872

              #7
              Originally posted by merk

              SELECT user.*, profilepicture.dateline FROM user
              LEFT JOIN profilepicture USING ( user.userid )
              WHERE user.userid = userid.
              Thanks, can you tell me how to put it in this table please, that would be much appreciated!


              $result = $DB_site->query("SELECT userfield.userid, user.userid, user.username, user.membergroupids, user.usergroupid, userfield.$biofield
              FROM " . TABLE_PREFIX ."userfield AS userfield
              INNER JOIN " . TABLE_PREFIX ."user AS user ON (userfield.userid=user.userid)
              WHERE FIND_IN_SET(5,user.membergroupids) OR FIND_IN_SET(6,user.membergroupids) OR FIND_IN_SET(7,user.membergroupids)
              OR (user.usergroupid = 5) OR (user.usergroupid = 6) OR (user.usergroupid = 7)
              ORDER BY userfield.userid ASC
              ");

              Comment

              • merk
                Senior Member
                • Jul 2001
                • 4149

                #8
                Unfortunatly I do not know where vBulletin stores the profile picture. It could be in the avatar table, or the attachments table.

                If you can find out where image.php retrieves the image from, that will be where the data is stored.

                Comment

                • Steve Machol
                  Former Customer Support Manager
                  • Jul 2000
                  • 154488

                  #9
                  Originally posted by merk
                  Unfortunatly I do not know where vBulletin stores the profile picture. It could be in the avatar table, or the attachments table.
                  It's stored in the customprofilepic table.
                  Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                  Change CKEditor Colors to Match Style (for 4.1.4 and above)

                  Steve Machol Photography


                  Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                  Comment

                  • merk
                    Senior Member
                    • Jul 2001
                    • 4149

                    #10
                    Thanks.

                    That would mean the query would look like:

                    PHP Code:
                    $DB_site->query("SELECT user.userid, user.username, user.usergroupid, user.membergroupids, userfield.$biofield, customprofilepic.dateline
                    FROM " 
                    TABLE_PREFIX "user
                    LEFT JOIN " 
                    TABLE_PREFIX "userfield USING (userid)
                    LEFT JOIN " 
                    TABLE_PREFIX "customprofilepic USING (userid)
                    WHERE FIND_IN_SET(5,user.membergroupids) OR FIND_IN_SET(6,user.membergroupids) OR FIND_IN_SET(7,user.membergroupids)
                    OR (user.usergroupid = 5) OR (user.usergroupid = 6) OR (user.usergroupid = 7)
                    ORDER BY user.userid ASC"
                    ); 

                    Comment

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