[pmwiki-users] trying to modify UserAuth-newuser

Florian Fischer Flori-Fischer at gmx.net
Thu Oct 12 03:16:31 CDT 2006


Hello, 

since userauth is lacking some features which offers userauth-register, these features are:
check username whether it already exists and check whether the email is an email adresses. 

Focussing on the first issue. I tried to modify the code:

<?php if (!defined('PmWiki')) exit();
SDV($SiteAdmin, 'flori-fischer at gmx.net');
SDV($NewUserMessage, "Um sich als User zu registrieren, füllen Sie einfach das folgende Formular aus. 
Eine Bestätigungsmail wird Ihnen umgehend zugesendet. 
Diese müssen Sie beantworten, damit der Administrator Ihren Account freischaltet.");

Markup("userauth-newuser", "_end","/\\(:newuser:\\)/", UserauthNewUser());

function UserauthNewUser() {
  global $ScriptUrl,$HTMLStartFmt,$HTMLEndFmt;
  #PrintFmt($pagename,$HTMLStartFmt);
  $arg['uname']   = @$_POST['uname'];
  $arg['email']   = @$_POST['email'];
  $arg['uname']   = preg_replace('/\s/', '', $arg['uname']);
  $arg['rname']   = $arg['uname'];
  $arg['errors']  = '';

  return ($arg['uname'] && $arg['email'])
    ? UserauthNewUserReport($arg)
    : UserauthNewUserForm($arg);
}
function UserauthNewUserReport($arg) {
    global $EmailTitle, $SiteAdmin, $UserInfoObj;
    if($UserInfoObj->DoesUserExist($arg['uname'])){
    return "<p> Der User existiert bereits. Gehen Sie zurück und wählen einen neuen Namen...</p>";
    }else{
    UserauthNewUserEmail($arg);
    $EmailTitle = 'eLRex';
    $rname = $arg['rname'];
    $email = $arg['email'];
    $thanks = <<<THANKS

<h2>Headline</h2>

<p>text.</p>
<br />
<p>Webmaster, $EmailTitle</p>

THANKS;
    $uname = $arg['uname'];
    $crypt_msg = <<<CRYPT
    <hr />
    <h2>Encryption Results</h2>
    <table border='0' width='550'>
    <tr><td>
    Please email the information below the line to the
    site administrator exactly as printed:
    </td></tr>
    <tr><td>
    <hr width="74%" />
    </td></tr>
    <tr><td>
    <p class='vspace'>$uname = $crypt</p>
CRYPT;
    return (false) ? $crypt_msg : $thanks;
}
}
...
 as you'll note i tried to modify function UserauthNewUserReport($arg).
Since my php knowledge is limited, it don#t get it to work. I get the message:

Fatal error: Call to a member function on a non-object in /home/u0027084302/public_html/elrex/cookbook/userauth-newuser-0.1.php on line 24

This is the line with if($UserInfoObj...)

where is the mistake?

Regards,

Florian


-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer




More information about the pmwiki-users mailing list