Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

building registration page into front page

I have managed to build the registration page into my front page when users are not signed in:

$UserID = $this->Request->Get('userid', Gdn::Session()->UserID);

if ($UserID == 0 ) {
    include(CombinePaths(array(PATH_LIBRARY, 'vendors/recaptcha', 'functions.recaptchalib.php')));
 echo "<div id=\"Content\">\n";

 include($this->FetchViewLocation('/....snip../applications/dashboard/views/entry/registercaptcha.php'));
    echo "</div>\n";
}

It looks good :-)
But doesn't actually function :-(

I'm sure there is a much better way to achieve this that actually works.
Illumination will be much appreciated.

Best Answer

Answers

  • Options
    x00x00 MVP
    Answer ✓

    It won't work becuase it is cargo cult
    http://en.wikipedia.org/wiki/Cargo_cult_programming

    grep is your friend.

  • Options

    x00 said:
    It won't work becuase it is cargo cult
    http://en.wikipedia.org/wiki/Cargo_cult_programming

    Okay I accept I don't fully understand how this system works.

    And you have a solution?

  • Options
    x00x00 MVP
    edited May 2012

    basically you need to reproduce the controller method code (Register), you don't need to do the post back stuff, instead you will point through the form target to the entry controller and the. It would be an idea to modularise it.

    Another way is to load it through the api and javascript. This is probably the simplest for you.

    $('#SomeDiv').load(gdn.url('/entry/register?DeliveryType=VIEW&DeliveryMethod=XHTML'));

    grep is your friend.

  • Options

    reproduce the controller method code

    I assume by this you don't mean reproducing the relevant content of registercaptcha.php within default.master.php.

    So is this utilising the code from function RegisterCaptcha() in a new class to be called under the appropriate conditions?

    EG

    class FrontEndEntryController extends Gdn_Controller {
       private function FrontEndRegisterCaptcha() {
    
       etc
    
       }
    }
    
Sign In or Register to comment.