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.
Add a Form with Custom Page PHP Plugin

Well I'm trying to add a form to a Custom Page with PHP but I fail to understand how to add the form, I read this post: https://vanillaforums.org/discussion/comment/164208/#Comment_164208
This is my code:
<?php if (!defined('APPLICATION')) exit(); $Session = Gdn::Session(); $tsid = Gdn::UserMetaModel()->GetUserMeta($Session->UserID, 'Profile.tsid'); // Redirect guests to another custom page if (!$Session->IsValid()) { echo 'User not registred.'; }else { // Output of decho is only visible for admins echo $ts3id['Profile.tsid']; echo $this->Form->Open()); echo $this->Form->TextBox('MyField'); echo $this->Form->Button('Submit'); echo $this->Form->Close(); } ?>
I get error 500.
0
Comments
a) You've got
echo $this->Form->Open());
with one closing bracket too much.b) When you've got a 500 error you should always check your servers error log file.
c) You should omit the closing php tag
?>
in Vanilla.d) Put
echo $this->Form->Errors();
below Form->Open, so that you are able to ouput any error results.e) Not sure about this, but you've used
Gdn::UserMetaModel()->GetUserMeta()
as a static call although I think it should (must?) be called like that:Errors Corrected,
But now only have a blank page
and post back
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.