Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
— | — | @@ -87,11 +87,26 @@ |
88 | 88 | $out->returnToMain(); |
89 | 89 | } |
90 | 90 | else { |
91 | | - // TODO: we might want to have a title field here |
92 | | - $out->setPageTitle( $contest->getField( 'name' ) ); |
93 | | - $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) ); |
| 91 | + // Check if the user is already a contestant in this contest. |
| 92 | + // If he is, reirect to submission page, else show signup form. |
| 93 | + $contestant = ContestContestant::s()->selectRow( |
| 94 | + 'id', |
| 95 | + array( |
| 96 | + 'contest_id' => $contest->getId(), |
| 97 | + 'user_id' => $this->getUser()->getId() |
| 98 | + ) |
| 99 | + ); |
94 | 100 | |
95 | | - $this->showSignupForm( $contest ); |
| 101 | + if ( $contestant === false ) { |
| 102 | + // TODO: we might want to have a title field here |
| 103 | + $out->setPageTitle( $contest->getField( 'name' ) ); |
| 104 | + $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) ); |
| 105 | + |
| 106 | + $this->showSignupForm( $contest ); |
| 107 | + } |
| 108 | + else { |
| 109 | + $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contestName )->getLocalURL() ); |
| 110 | + } |
96 | 111 | } |
97 | 112 | } |
98 | 113 | |