[pmwiki-users] Fwd: trying to modify UserAuth-newuser

The Editor editor at fast.st
Thu Oct 12 04:38:04 CDT 2006


On 10/12/06, Florian Fischer <Flori-Fischer at gmx.net> wrote:
> 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


Not sure if you are set on using Userauth, but ZAP (formerly FAST
Data) offers a different way to register new users, and authenticate
them that works with PmWiki's default AuthUser.  You can store any
user information you want, send password reminders, and custom your
site dynamically based on their member preferences.  Members can also
update any of their account information at any time.  In many ways it
is an ideal system for a cms. And yes, it checks to make sure a user
name exists before creating an account and does expression matching
for email addresses.

Cheers,
Caveman




More information about the pmwiki-users mailing list