Er- help please?
I deleted Yahoo, IM, MSN fields in profile and I like to add them back. I searched in the forums the right coding but couldn't find any. I'm experienced with adding fields, I just need the right code.. π
You completely deleted them?
You would find it under ADMIN->PROFILE INFORMATION
If Yahoo and such are still listed then click Edit and check ENABLE FIELD
But if it's really gone you will have to Add Profile field
Name: Yahoo
Title: Yahoo IM
Type: Custom Code
Custom Form code: $output .= "<div><label for='AOL'>".$field['field_title'].":</label><INPUT type='text' class='textbox' name='af_".$field['field_name']."' maxlength='40' value='".(!empty($user['af_'.$field['field_id']]) ? $user['af_'.$field['field_id']] : "")."' size='20'></div>";
Custom Profile Code: $thisfield = "<a href="" http://edit.yahoo.com/config/send_webmesg?.target=".$field ['info'"]."&.src="pg"><img" border='0' src="" http://opi.yahoo.com/online?u=".$field ['info'"]."&m=g&t=1"> ".format_email($field['info'])."</a>";
For MSN
Name: MSN
Title: MSN IM
Type: Custom Code
Custom Form Code: $output .= "<div><label for='AOL'>".$field['field_title'].":</label><INPUT type='text' class='textbox' name='af_".$field['field_name']."' maxlength='40' value='".(!empty($user['af_'.$field['field_id']]) ? $user['af_'.$field['field_id']] : "")."' size='20'></div>";
Custom Profile Code: $thisfield = "<img src=""images/msntalk.gif"" alt=""._MSN.""> ".format_email($field['info']);
For AIM
Name: AOL
Title: AIM
Type: Custom Code
Custom Form Code: $output .= "<div><label for='AOL'>".$field['field_title'].":</label><INPUT type='text' class='textbox' name='af_".$field['field_name']."' maxlength='40' value='".(!empty($user['af_'.$field['field_id']]) ? $user['af_'.$field['field_id']] : "")."' size='20'></div>";
Cusotm Profile Code: $thisfield = "<img src="" http://big.oscar.aol.com/".$field ['info'"]."?on_url=$url/images/aim.gif&off_url=$url/images/aim.gif"> <a href=""aim:goim?{aol}ScreenName=".$field['info'"]."">".format_email($field['info'])."</a>";
******************************************
Mucking around in eFiction since circa 2001 (ver. 1.0)
Now running v.3
I stupidly completly deleted them, LOL, I thought I wouldn't use them, so yeah. Thank you sooooo much!
PS: There is some little problem in codes, the links should have been between single ' ........ ' not "........", I'm fixing them myself.
Just remember in the future when you don't want to use them just go into ADMIN and edit the profiles and uncheck Field Enabled and it will not show up.
******************************************
Mucking around in eFiction since circa 2001 (ver. 1.0)
Now running v.3
Since my question is kinda related to this info, I thought I'd post it here but if the mods/admins feel this should be a separate topic, please let me know.
I would like to have my messengers profile field always return something, whether an id is set or not. Like say someone did not input an id for MSN, the script would return the image for MSN with the text No MSN id is set... or something like that. Now, I've been tinkering with this thing for close to 1 hour and it's just not working for me.
Since the original profile code is
$thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
I thought I should use some if/else statement in there, but I don't seem to have it quite right because I made many attempts and either only the empty message comes up even though I have something set in there... or then my MSN id shows up, but when I remove it, the text for the empty id is not showing up.. which means I coded it wrong. I tried many variations:
Variation 1
if(!empty($field['info'])) $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set";
else $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
Variation 2
$thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
elseif($field['info'] == empty) $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set";
Variation 3
$thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
elseif(!empty($field['info'])) $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set";
Variation 4
if isset($field['info']) $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
else $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set";
As you can see, I am thoroughly lost and just don't know what I'm doing... but am sure trying a lot of things. And that's just for the MSN field! But I'm guessing once I get it working for one, the others will be easy to set up too. So anyone feel like correcting my coding so I can get this to work? π
Thank you.
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
Jacynthe, I just pasted your code so it might be a little wrong still but here's what I'd put:
if(!empty($field['info'])) { $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set"; } else { $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']); }
It's all about the brackets. π
archive:
site:
Available for skin/mod commission! π
You don't need the brackets on one line if/else statements. 2 and 3 won't work at all. You can't have an else without an if. When you can't get something to work try reading it out loud to yourself.
if(!empty($field['info'])) $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set";
else $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
If not empty $field['info'] $thisfield is equal to <img> No MSN id is set.
You need to remove the "not" (!).
if isset($field['info']) $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> ".format_email($field['info']);
else $thisfield = "<img src="'images/msntalk.gif'" alt='"._MSN."'> No MSN id is set";
On this one you're missing a set of parenthesis around the if.
if(isset($field['info'])) $thisfield....
Jenny's code won't work for the same reason as I stated above for Variation 1.
Ah, that makes sense. I've been working in if/elseif's all week. ;_;
archive:
site:
Available for skin/mod commission! π
Okay so I took into consideration Tammy's post about variations 1 and 4 who had potential for working if I corrected my coding mistakes (and the no need for brackets on one line if/else statements)... and the field only displays something if there is an id provided.
variation 1
if(empty($field['info'])) $thisfield = "<img src="'images/msntalk.gif'>" No id is provided"; else $thisfield = "<img src="'images/msntalk.gif'>" ".format_email($field['info']);
Variation 4
if(isset($field['info'])) $thisfield = "<img src="'images/msntalk.gif'>" ".format_email($field['info']); else $thisfield = "<img src="'images/msntalk.gif'>" No id is provided";
Anything else you can see me doing wrong? Maybe I'm just not thinking this through correctly and it's why it's not working?
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
You may need to edit profile.php. I can't remember if it even looks at the profile fields that are empty, but it may not.
in profile.php, this is the whole section pertaining to authorfields.... anything I need to change from it to make my codes work?
$dynamicfields = "";
while($field = dbassoc($result2)) {
if($field['info'] == "") continue;
$fieldinfo = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '".$field['field']."' LIMIT 1"));
if($fieldinfo) {
$thisfield = "";
if($fieldinfo['field_on'] == 0) continue;
if($fieldinfo['field_type'] == 1) { $thisfield = format_link($field['info']);
}
if($fieldinfo['field_type'] == 4) {
$thisfield = preg_replace("@{info}@", $field['info'], $fieldinfo['field_options']);
$thisfield = format_link($thisfield);
}
if($fieldinfo['field_type'] == 2 || $fieldinfo['field_type'] == 6) {
$thisfield = stripslashes($field['info']);
}
if($fieldinfo['field_type'] == 3) {
$thisfield = $field['info'];
}
else eval($fieldinfo['field_code_out']);
$tpl->assign($fieldinfo['field_name'], $thisfield);
$dynamicfields.= "<div class='authorfields'><spanclass='label'>".$fieldinfo['field_title'].":</span>".$thisfield."</div>";
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
Unfortunately, the whole thing. It's pulling the info for the author then grabbing the relevant field information. You'd have to completely reverse it by pulling the field information then pulling the author's info.
π huh? I'm afraid I understood that about as much as I get Chinese... Do you mean I would have to change it to this? That doesn't look right to me though...
$dynamicfields = "";
while($field = dbassoc($result2)) {
if($field['info'] == "") continue;
$fieldinfo = dbassoc(dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorfields WHERE field_id = '".$field['field']."' LIMIT 1"));
eval($fieldinfo['field_code_out']);
$tpl->assign($fieldinfo['field_name'], $thisfield);
$dynamicfields.= "<div class='authorfields'><spanclass='label'>".$fieldinfo['field_title'].":</span>".$thisfield."</div>";
else if($fieldinfo) {
$thisfield = "";
if($fieldinfo['field_on'] == 0) continue;
if($fieldinfo['field_type'] == 1) { $thisfield = format_link($field['info']);
}
if($fieldinfo['field_type'] == 4) {
$thisfield = preg_replace("@{info}@", $field['info'], $fieldinfo['field_options']);
$thisfield = format_link($thisfield);
}
if($fieldinfo['field_type'] == 2 || $fieldinfo['field_type'] == 6) {
$thisfield = stripslashes($field['info']);
}
if($fieldinfo['field_type'] == 3) {
$thisfield = $field['info'];
}
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
I mean you'd have to re-write it completely.