Lost Penname [MOD]
 
Notifications
Clear all

Lost Penname [MOD]

6 Posts
4 Users
0 Reactions
2,567 Views
 Pari
(@pari)
Posts: 18
Active Member
Topic starter
 

I saw that someone was asking about this in another thread and I had modded it for ver 2 which I run one of my archives on, then decided to tested on the latest ver which I use for another archive I have. It works on both. Basically if someone forgets their penname they can retreive it by putting in their email address, and the penname displays for them.

Not sure if this is what you're looking for but I modded a 'lost Penname' feature for ver 2 and ver 3.3.

Create a file in the 'user' folder, name it 'lostpenname.php' and paste the code below and 'save':

<?php
// ----------------------------------------------------------------------
// 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( );
if(!function_exists("random_char")) {

function random_char($string)
{
$length = strlen($string);
$position = mt_rand(0, $length - 1);
return ($string[$position]);
}

function random_string ($charset_string, $length)
{
$return_string = random_char($charset_string);
for ($x = 1; $x < $length; $x++)
$return_string .= random_char($charset_string);
return $return_string;
}

}
if($loggedin) accessDenied( );

$output .= "<div id="pagetitle">"._LOSTPENNAME."</div>";

  if(isset($_POST['submit'])) {
  $result = dbquery("SELECT "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE email = '$_POST[email]'");
  list($uid, $penname) = dbrow($result);
  if(dbnumrows($result) == 0) $output .= write_message(_WRONGPENNAME);

   
  else {
$data = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE email = '$_POST[email]'") or die(_FATALERROR."Query: SELECT "._UIDFIELD." as uid "._AUTHORTABLE." WHERE email = '$_POST[email]''<br />Error: (".mysql_errno( ).") ".mysql_error( ));
   
   
    while($info = dbassoc( $data ))
    {
   
    $output .= "<center>".$info['penname']."</center>";
   
   

}

}
}

else {
$output .= "<form method="POST" enctype="multipart/form-data" action="user.php?action=lostpenname">
<table align="center" width="300">
<tr><td>"._ENTEREMAIL."</td></tr>
<tr><td><INPUT  type="text" class="textbox=" name="email"><INPUT type="submit" class="button" name="submit" value=""._SUBMIT.""></form>
</td></tr></table>";
}
?>

Next open the 'login.php' file in the 'user' folder. Towards the bottom of the page look for the '$linkquery' and replace it with this:

$linkquery = dbquery("SELECT * from ".TABLEPREFIX."fanfiction_pagelinks WHERE link_name = 'login' OR link_name = 'lostpassword' OR link_name = 'lostpenname'");

Go a bit further down that page and look for '$output' which should be the last bit of coding there, and replace it with this:

$output .= "<div style='text-align: center;'>".$pagelinks['register']['link']." | ".$pagelinks['lostpassword']['link']." | ".$pagelinks['lostpenname']['link']."</div>";

Next you'll need to log into your site and create a 'panel' as well as a 'pagelink' for this new feature; just copy the 'lostpassword' panel info but change the names to 'lostpenname' and 'Lost Penname' . Regarding that pagelink make sure to link to 'lostpenname', everything else would be the same.

Finally go to the 'Languages/en.php' folder/file and add this:

// User - Lost Penname

// User - Lost Penname

define ("_LOSTPENNAME", "Lost penname");
define ("_WRONGPENNAME", "That address doesn't appear to be in our database. <a href=""user.php?action=lostpenname">Please" try again.</a>");

 
Posted : 25/07/2010 5:13 am
(@lyndsie)
Posts: 1263
Member Moderator
 

Have you tested it with the latest version? If I remember correctly, there were some quite large changes between 3.2 and 3.3 that affected a lot of mods.


 
Posted : 25/07/2010 3:14 pm
 Pari
(@pari)
Posts: 18
Active Member
Topic starter
 

Have you tested it with the latest version? If I remember correctly, there were some quite large changes between 3.2 and 3.3 that affected a lot of mods.

This is installed on my 'Huddy Realm' archive which is running ver 3.3. You can test it here:

http://thehuddyrealm.com/Fiction/user.php?action=lostpenname

You can use one of a Ghostwriter accounts;
Email: romolo4eva@yahoo.com

Penname that displays should be 'RoMo'


 
Posted : 26/07/2010 5:00 pm
(@tammy)
Posts: 2577
Member Moderator
 

I would encourage you to use the custom database functions dbassoc -> mysql_fetch_array, dbquery -> mysql_query, etc.  This will allow sites using the mysqli_* functions to connect to the database to use the mod.  Also at a glance, you don't need the 2 functions at the top of the form either.


 
Posted : 27/07/2010 4:19 pm
 Pari
(@pari)
Posts: 18
Active Member
Topic starter
 

I would encourage you to use the custom database functions dbassoc -> mysql_fetch_array, dbquery -> mysql_query, etc.   This will allow sites using the mysqli_* functions to connect to the database to use the mod.  Also at a glance, you don't need the 2 functions at the top of the form either.

Ok thank you, but please know that all the coding came from the user/lostpasword.php file found in ver. 3.3. I didn't write any of it, I just used what was already there to display the penname instead of sending an email about the password. Sorry to those it's not working for. Since there is an interest for this, hopefully one of the writers of the ver. 3.3+ will change this however they see fit, so it will work for everyone who chooses to use it. It works for me as is.

Tammy if you would, please make the changes you suggested for those running the mysqli, I know I have that on my server but I only use it for one of my forums. I won't even pretend to know how to code for it.


 
Posted : 27/07/2010 9:45 pm
(@YourFanfiction)
Posts: 0
 

Would this work if I've bridged with SMF?


 
Posted : 25/07/2012 6:25 pm
Share: