Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 06-03-2003, 07:01 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 06-03-2003, 07:03 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If they're just URLs, just edit the appropriate templates to include <a> tags...
Reply With Quote
  #3  
Old 06-03-2003, 07:14 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 06-03-2003, 07:29 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 06-03-2003, 07:32 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look in functions.php for profile[fieldx].

Be sure to replace the x with the profile field number you are looking for.
Reply With Quote
  #6  
Old 06-03-2003, 07:35 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Even further investigation has found that this is the template that handles the parsing of the custom fields:

getinfo_customfields

Quote:
<tr>
<td bgcolor="$backcolor"><normalfont><b>$profilefield[title]</b></normalfont></td>
<td bgcolor="$backcolor"><normalfont>$profilefield[value]&nbsp;</normalfont></td>
</tr>
To test this, I changed that code to this:
Quote:

<tr>
<td bgcolor="$backcolor"><normalfont><b>$profilefield[title]</b></normalfont></td>
<td bgcolor="$backcolor"><normalfont><a target="_blank" href="$profilefield[value]">$profilefield[value]</a>&nbsp;</normalfont></td>

</tr>
Now, the problem is, that turns *ALL* of my custom fields into URLs. Obviously, that is a bad thing.

Is there any way to only have it change a couple specific ones into URLs?

I don't imagine if() statements work here.
Reply With Quote
  #7  
Old 06-03-2003, 07:40 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 04:32 PM Boofo said this in Post #5
Look in functions.php for profile[fieldx].

Be sure to replace the x with the profile field number you are looking for.

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]="";
Reply With Quote
  #8  
Old 06-03-2003, 08:09 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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")."\";");

  }
Maybe this line (1395):

$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];
    }
or

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];
    }

???
Reply With Quote
  #9  
Old 06-03-2003, 09:15 PM
Threshold Threshold is offline
 
Join Date: May 2003
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
if(strstr($profilefield[title], "Your Real Life Picture") or strstr($profilefield[title], "Your Character's Picture")) {
$profilefield[value]="<a target=\"_blank\" href=\"$userinfo[$profilefieldname]\">$userinfo[$profilefieldname]</a>";
} else {
$profilefield[value]=$userinfo[$profilefieldname];
}
Problem solved!

Does anyone see any problems or flaws in my hack?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:17 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05473 seconds
  • Memory Usage 2,244KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete