The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Make other Profile fields parse as URLs?
The homepage profile field automatically parses as a URL.
On my site, I have two profile fields that would be dramatically improved if they were automatically treated as URLs (they are entries where a player can put a link to a RL picture and a character picture). Is there a way to do this? Thanks! |
#2
|
|||
|
|||
If they're just URLs, just edit the appropriate templates to include <a> tags...
|
#3
|
|||
|
|||
I don't want *ALL* of the profile fields to be parsed as URLs.
For example, user profiles on my vBulletin have 6 required fields and 9 optional fields. 1 required field is email address, the other 5 are plain text. Of the optional fields, 1 is a URL (homepage), 1 is signature, 1 is birthday, 1 is custom user text, and the other 5 are plain text. I want 2 of those last 5 to be parsed as URLs, rather than plain text. Unless I am missing something, the template just parses through a loop and treats them all the same, thus I cannot edit each individual one. Or am I missing something and not remembering or understanding correctly how the profile template works? The two fields I want treated as URLs are called "Your Real Life Picture" and "Your Character's Picture." I just used the Template Search function to look for those, and the search turned up nothing. Am I just not understanding the way the template functions for parsing the user profile fields? |
#4
|
|||
|
|||
Ok, from further reading through the various files, everywhere the custom fields are handled (either for changing them or for viewing them), the code always says this:
$customfields However, I cannot find where it is that I can edit that. I have done numerous searches to no avail. |
#5
|
||||
|
||||
Look in functions.php for profile[fieldx].
Be sure to replace the x with the profile field number you are looking for. |
#6
|
|||
|
|||
Even further investigation has found that this is the template that handles the parsing of the custom fields:
getinfo_customfields Quote:
Quote:
Is there any way to only have it change a couple specific ones into URLs? I don't imagine if() statements work here. |
#7
|
|||
|
|||
Quote:
Ok, I am looking through that file (admin/functions.php) and when I search for profile the only place it comes up is here: Line 260: eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";"); Line 283: $post[profile]=""; |
#8
|
|||
|
|||
Ugh. I hate reading code I do not fully understand. It makes me feeling like a programming n00b all over again.
As I read further, could it be THIS that I need to modify? member.php lines 1379-1399: Code:
// get extra profile fields $customfields = ''; $profilefields=$DB_site->query("SELECT profilefieldid,required,title FROM profilefield WHERE hidden=0 ORDER BY displayorder"); while ($profilefield=$DB_site->fetch_array($profilefields)) { if ($backcolor=="{firstaltcolor}") { $backcolor="{secondaltcolor}"; $bgclass = "alt2"; } else { $backcolor="{firstaltcolor}"; $bgclass = "alt1"; } $profilefieldname="field$profilefield[profilefieldid]"; $profilefield[value]=$userinfo[$profilefieldname]; eval("\$customfields .= \"".gettemplate("getinfo_customfields")."\";"); } $profilefield[value]=$userinfo[$profilefieldname]; Should be changed to something like this? ==> Code:
if($profilefieldname == "Your Real Life Picture" || $profilefieldname == "Your Character's Picture") { $profilefield[value]= <a target="_blank" href="$userinfo[$profilefieldname]">$userinfo[$profilefieldname]</a> ; } else { $profilefield[value]=$userinfo[$profilefieldname]; } Code:
if($profilefieldname == "Your Real Life Picture" || $profilefieldname == "Your Character's Picture") { $profilefield[value]= "<a target="_blank" href="$userinfo[$profilefieldname]">$userinfo[$profilefieldname]</a>" ; } else { $profilefield[value]=$userinfo[$profilefieldname]; } ??? |
#9
|
|||
|
|||
Problem solved due to something I read in another hack.
Zzed's hack found here had code for making an image show up in a profile field. It turns out I was looking in exactly the right place, but I just needed to know the proper php syntax to do this properly. I must say that I am shocked to learn that PHP uses "and" and "or" instead of "&&" and "||". What kind of language doesn't use && and || ??????????? Anyway, this is how I accomplished the hack: I changed this line (1395): $profilefield[value]=$userinfo[$profilefieldname]; to: Quote:
Does anyone see any problems or flaws in my hack? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|