Thanks Tammy! Almost there now though for some weird reason, it's not putting the form where I said to put it... I put the {contactform} variable in the Contact tab, but it shows up between the tabs for the stories/series, etc and the listings from those and then stays open for every single tab... Could it be because the profile.php doesn't know we're supposed to wait for {contactform} to "induce" the appearance of the form?
Or maybe I just screwed something up as usual.
Here's my profile.php
<?php
// Mod: Last Visit 3.0 --------------------------------------------------
// ----------------------------------------------------------------------
// eFiction 3.2
// Copyright (c) 2007 by Tammy Keefer
// Valid HTML 4.01 Transitional
// Based on eFiction 1.1
// Copyright (C) 2003 by Rebecca Smallwood.
// http://efiction.sourceforge.net/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
if(!defined("_CHARSET")) exit( );
include("user/contact.php");
// Build the user's profile information
$tpl->newBlock("profile");
$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date, UNIX_TIMESTAMP(lastlog) as lastlog FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
$userinfo = dbassoc($result2);
$nameinfo = "";
if($userinfo['email'])
$contactinfo .= " <a href=""viewuser.php?action=contact&uid=".$userinfo['uid'"]."">"._CONTACT."</a>";
if(!empty($favorites) && isMEMBER && $userinfo['uid'] != USERUID) {
$fav = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '".USERUID."' AND type = 'AU' AND item = '".$userinfo['uid']."'");
if(dbnumrows($fav) == 0) $favinfo .= "[<a href=""user.php?uid=USERUID&action=favau&author=".$userinfo['uid'"]."">"._ADDAUTHOR2FAVES."</a>]";
}
$tpl->assign("add2fav", $favinfo);
$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);
if (date("$dateformat", $userinfo['lastlog']) == date("$dateformat", mktime(0, 0, 0, 0, 0, 0000)))
$tpl->assign("lastlog", "._UNAVAILABLE.");
else $tpl->assign("lastlog", date("$dateformat", $userinfo['lastlog']));
$tpl->assign("membersince", date("$dateformat", $userinfo['date']));
if($userinfo['realname'])
$tpl->assign("realname", $userinfo['realname']);
if($userinfo['bio']) {
$bio = nl2br($userinfo['bio']);
$tpl->assign("bio", stripslashes($bio));
}
if($userinfo['image'])
$tpl->assign("image", "<img src=""".$userinfo['image'"]."" border=1 width=100 height=100>");
else $tpl->assign("image", "<img src=""images/unlined_noimg.gif"" border=1>");
$tpl->assign("userlevel", isset($userinfo['level']) && $userinfo['level'] > 0 && $userinfo['level'] < 4 ? _ADMINISTRATOR.(isADMIN ? " - ".$userinfo['level'] : "") : _MEMBER);
/* Dynamic authorinfo fields */
$result2 = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '$uid'");
$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'><span
class='label'>".$fieldinfo['field_title'].":</span>
".$thisfield."</div>";
}
}
$codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'userprofile'");
while($code = dbassoc($codequery)) {
eval($code['code_text']);
}
if(!empty($dynamicfields)) $tpl->assign("authorfields", $dynamicfields);
/* End dynamic fields */
$tpl->assign("reportthis", "[<a
href="""._BASEDIR."contact.php?action=report&url=viewuser.php?uid=".$uid."">"._REPORTTHIS."</a>"]");
$adminopts = "";
if(isADMIN && uLEVEL < 3) {
$adminopts .= "<div class="adminoptions"><span
class='label'>"._ADMINOPTIONS.":</span>
".(isset($userinfo['validated']) && $userinfo['validated'] ?
"[<a href=""admin.php?action=members&revoke=$uid""
class="vuadmin">"._REVOKEVAL."</a>] " : "[<a
href=""admin.php?action=members&validate=$uid""
class="vuadmin">"._VALIDATE."</a>] ")."[<a
href=""user.php?action=editbio&uid=$uid""
class="vuadmin">"._EDIT."</a>] [<a
href=""admin.php?action=members&delete=$uid""
class="vuadmin">"._DELETE."</a>]";
$adminopts .= " [<a
href=""admin.php?action=members&".($userinfo['level'"] < 0 ?
"unlock=".$userinfo['uid']."" class="vuadmin">"._UNLOCKMEM :
"lock=".$userinfo['uid'].""
class="vuadmin">"._LOCKMEM)."</a>]";
$adminopts .= " [<a
href=""admin.php?action=admins&".(isset($userinfo['level'"])
&& $userinfo['level'] > 0 ? "revoke=$uid"
class="vuadmin">"._REVOKEADMIN."</a>] [<a
href=""admin.php?action=admins&do=edit&uid=$uid""
class="vuadmin">"._EDITADMIN : "do=new&uid=$uid"
class="vuadmin">"._MAKEADMIN)."</a>]</div>";
$tpl->assign("adminoptions", $adminopts);
}
$tpl->gotoBlock("_ROOT");
?>
and here's my profile.tpl
<!-- START BLOCK : profile -->
<div class="tabber">
<div class="tabbertab">
<h2>User Profile</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center" width="110" rowspan="4">
<div id="profile"><div id="bio"><div id="biocontent">{image}
<div align=left>{gender}{betareader}</div></div></div></div>
</td>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biotitle"><b>Alias:</b> {userpenname}</div></div></div>
</td>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biotitle"><b>Real Name:</b> {realname}</div></div></div>
</td>
</tr>
<tr>
<td class="sectionlinked" colspan="2">
<div id="profile"><div id="bio"><div id="biocontent"><b>User Level:</b> {userlevel}</div></div></div>
</td>
</tr>
<tr>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biocontent"><b>Member since:</b> {membersince}</div></div></div>
</td>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biotitle"><b>Last logged in:</b> {lastlog}</div></div></div>
</td>
</tr>
<tr>
<td colspan="2">
<div id="profile"><div id="bio"><div id="biocontent"><b>Skin:</b> {userskin}</div></div></div>
</td>
</tr>
</table>
</div>
<div class="tabbertab">
<h2>Author Biography</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center" width="110">
<div id="profile"><div id="bio"><div id="biocontent">{image}
<div align=left>{gender}{betareader}</div></div></div></div>
</td>
<td colspan="2" class="sectioncontent" valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><br />{bio}</div></div></div>
</td>
</tr>
</table>
</div>
<div class="tabbertab">
<h2>Contact Author</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center">{contactform}</td>
</tr>
</table>
</div>
<div class="tabbertab">
<h2>Miscellaneous</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center" width="110" rowspan="5">
<div id="profile"><div id="bio"><div id="biocontent">{image}
<div align=left>{gender}{betareader}</div></div></div></div>
</td>
<td valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><b>Website:</b> {website}</div></div></div>
</td>
</tr>
<tr>
<td valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><b>Messengers:</b> {aol} {icq} {msn} {yahoo}</div></div></div>
</td>
</tr>
<tr>
<td valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><b>Favorite TV Shows:</b> {tvshow}</div></div></div>
</td>
</tr>
</table>
</div>
</div>
<br />
<div id="profile">
{adminoptions} {reportthis} {add2fav}
</div>
<!-- END BLOCK : profile -->
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
You need to take out the "output" line from the contact.php, I guess. You could probably do an if/else statement out of it, but I'm too tired to figure out what to check on...probably $action.
if($action == "contact") <output line here>;
else <contactform line here;
So you mean the output line with the form code because there are many output in contact.php
If so, I'd have to have this in contact.php?
if(!defined("_CHARSET")) exit( );
if(!$uid) $output .= write_error(_ERROR);
else {
$author = dbquery("SELECT "._PENNAMEFIELD.", "._EMAILFIELD." FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
list($penname, $email) = dbrow($author);
$output .= "<div class='sectionheader'>"._CONTACTAUTHOR."</div>";
if(isset($_POST['submit'])) {
if($captcha && !isMEMBER && !captcha_confirm()) $output .= write_error(_CAPTCHAFAIL);
else {
include_once(_BASEDIR."includes/emailer.php");
if(!$email) $output .= write_error(_ERROR);
else $result = sendemail($penname, $email, $_POST['email'], $_POST['email'], descript(strip_tags($_POST['subject'])), descript($_POST['comments'])."<br /><br />".(isMEMBER ? sprintf(_SITESIG2, "<a href="'".$url."/viewuser.php?uid=".USERUID."'>".USERPENNAME."</a>")" : _SITESIG), "html");
if($result) $output .= write_message(_ACTIONSUCCESSFUL);
else $output .= write_error(_ERROR);
}
}
else {
if($action == "contact")
$output .= "<form method="POST" enctype="multipart/form-data" style="width: 400px; margin: 0 auto;" action="viewuser.php?action=contact&uid=$uid">
<table width="400" border="0" cellspacing="2" cellpadding="1">
<tr>
<td width="22%"><label for="email">"._YOUREMAIL.":</label></td><td><INPUT type="text" class="textbox" name="email"></td></tr>
<tr>
<td width="22%"><label for="subject">"._SUBJECT.":</label></td><td><INPUT type="text" class="textbox" name="subject"></td></tr>
<tr>
<td colspan="2"><label for="comments">"._COMMENTS.":</label> <TEXTAREA class="textbox" name="comments" cols="50" rows="6"></TEXTAREA><br /></td></tr>";
if(!USERUID && !empty($captcha)) $output .= "<tr><td colspan="2"><div><span class="label">"._CAPTCHANOTE."</span><input MAXLENGTH=5 SIZE=5 name="userdigit" type="text" value=""><br /><img width=120 height=30 src="""._BASEDIR."includes/button.php"" style="border: 1px solid #111;"></div></td></tr>";
$output .= "<tr><td colspan="2"><div style="text-align: center;"><INPUT name="submit" class="button" type="submit" value=""._SUBMIT.""></div></td></tr></table></form>";
$output .= write_message(_REQUIREDFIELDS._RESPECTNOTE);
}
}
else
$tpl->assign("contactform", $output);
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
I mean the $tpl->assign line.
I must be a complete idiot because nothing is working.
If I put the include in profile.php, it adds the contact form by default and doesn't even care about the if statement I put in contact.php - and it's like the .tpl doesn't recognize what {contactform} is supposed to mean because it just doesn't include it anywhere.
I'm stomped because LOGICALLY it should be working, but it just isn't.
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
In user/contact.php replace all occurances of $output with $output2 and see if that clears it up.
Tammy,
It stopped the contact form from showing by default in the profile.php but it's still not showing up when I input {contactform}... and it doesn't add the contact form either if I append ?action=contact to the URL.
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
The contact form should look like this.
if(!defined("_CHARSET")) exit( );
if(!$uid) $output2 .= write_error(_ERROR);
else {
$author = dbquery("SELECT "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
list($penname, $email) = dbrow($author);
$output2 .= "<div class='sectionheader'>"._CONTACTAUTHOR."</div>";
if(isset($_POST['submit'])) {
if($captcha && !isMEMBER && !captcha_confirm()) $output2 .= write_error(_CAPTCHAFAIL);
else {
include_once(_BASEDIR."includes/emailer.php");
if(!$email) $output2 .= write_error(_ERROR);
else $result = sendemail($penname, $email, $_POST['email'], $_POST['email'], descript(strip_tags($_POST['subject'])), descript($_POST['comments'])."<br /><br />".(isMEMBER ? sprintf(_SITESIG2, "<a href="'".$url."/viewuser.php?uid=".USERUID."'>".USERPENNAME."</a>")" : _SITESIG), "html");
if($result) $output2 .= write_message(_ACTIONSUCCESSFUL);
else $output2 .= write_error(_ERROR);
}
}
else {
$output2 .= "<form method="POST" enctype="multipart/form-data" style="width: 400px; margin: 0 auto;" action="viewuser.php?action=contact&uid=$uid">
<label for="email">"._YOUREMAIL.":</label> <INPUT type="text" class="textbox" name="email"><br />
<label for="subject">"._SUBJECT.":</label> <INPUT type="text" class="textbox" name="subject"><br />
<label for="comments">"._COMMENTS.":</label> <TEXTAREA class="textbox" name="comments" cols="50" rows="6"></TEXTAREA><br />";
if(!USERUID && !empty($captcha)) $output2 .= "<div><span class="label">"._CAPTCHANOTE."</span><input MAXLENGTH=5 SIZE=5 name="userdigit" type="text" value=""><br /><img width=120 height=30 src="""._BASEDIR."includes/button.php"" style="border: 1px solid #111;"></div>";
$output2 .= "<div style="text-align: center;"><INPUT name="submit" class="button" type="submit" value=""._SUBMIT.""></div></form>";
$output2 .= write_message(_REQUIREDFIELDS._RESPECTNOTE);
}
}
if($action == "contact") $tpl->assign( "output", $output2 );
else $tpl->assign( "contactform", $output2 );
Yup, that's what I have there. 🙂
P.S.: You're such an angel to put up with all the requests and I really appreciate your help with this!
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
So it's working?
No it isn't sadly enough but I still really appreciate the help. 🙂
http://fanfics.suethomasfbeye.net/viewuser.php?uid=1&skin=supernatural... the contact tab remains bare even with the alteration of the output to output2 and the assignation of the {contactform} variable to that output2....
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
So I found out that where the contactform appears is ruled by the {output} variable in user.tpl which I thought would be a big help. I thought if I removed that from there and used the {output} variable in profile.tpl that would work... but it didn't. So I tried including the profile block in user.tpl instead of just using the include... thinking maybe the {output} would work then... but it didn't.
Basically, the good news is that I no longer get it where I don't want it. The bad news is that I still don't get it where I want it! Any other ideas on what I could try to fix this?
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
It should show up where you put {contactform}
http://fanfics.suethomasfbeye.net/viewuser.php in contact tab ... as you can see , nothing shows up even though I have all the proper stuff in my profile.tpl
<!-- START BLOCK : profile -->
<div class="tabber">
<div class="tabbertab">
<h2>User Profile</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center" width="110" rowspan="4">
<div id="profile"><div id="bio"><div id="biocontent">{image}<br />
<div align=left>{gender}{betareader}</div></div></div></div>
</td>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biotitle"><b>Alias:</b> {userpenname}</div></div></div>
</td>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biotitle"><b>Real Name:</b> {realname}</div></div></div>
</td>
</tr>
<tr>
<td class="sectionlinked" colspan="2">
<div id="profile"><div id="bio"><div id="biocontent"><b>User Level:</b> {userlevel}</div></div></div>
</td>
</tr>
<tr>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biocontent"><b>Member since:</b> {membersince}</div></div></div>
</td>
<td class="sectionlinked">
<div id="profile"><div id="bio"><div id="biotitle"><b>Last logged in:</b> {lastlog}</div></div></div>
</td>
</tr>
<tr>
<td colspan="2">
<div id="profile"><div id="bio"><div id="biocontent"><b>Skin:</b> {userskin}</div></div></div>
</td>
</tr>
</table>
</div>
<div class="tabbertab">
<h2>Author Biography</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center" width="110">
<div id="profile"><div id="bio"><div id="biocontent">{image}<br />
<div align=left>{gender}{betareader}</div></div></div></div>
</td>
<td colspan="2" class="sectioncontent" valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><br />{bio}</div></div></div>
</td>
</tr>
</table>
</div>
<div class="tabbertab">
<h2>Contact Author</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center">{contactform}</td>
</tr>
</table>
</div>
<div class="tabbertab">
<h2>Miscellaneous</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="sectioncontent" valign="top" align="center" width="110" rowspan="5">
<div id="profile"><div id="bio"><div id="biocontent">{image}<br />
<div align=left>{gender}{betareader}</div></div></div></div>
</td>
<td valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><b>Website:</b> {website}</div></div></div>
</td>
</tr>
<tr>
<td valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><b>Messengers:</b> {aol} {icq} {msn} {yahoo}</div></div></div>
</td>
</tr>
<tr>
<td valign="top">
<div id="profile"><div id="bio"><div id="biocontent"><b>Favorite TV Shows:</b> {tvshow}</div></div></div>
</td>
</tr>
</table>
</div>
</div>
<br />
<div id="profile">
{adminoptions} {reportthis} {add2fav}
</div>
<!-- END BLOCK : profile -->
Did the same thing when I included the profile block in the user.tpl file instead of using profile.tpl
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community
Addendum on the matter:
I found out that as soon as you put the code OUTSIDE of the profile block... it starts showing. So this means something in the profile.php coding is preventing it from showing up there? is that it?
Jacynthe
Archives: http://fanfics.e-authors.net
Version: 3.5.3
Modified? Somewhat...
PHP: 5.3.3
MySQL: 5.0.91-community