Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Private Messages plugin: making a small change
I want to change the plugin slightly so I can pass the 'send PM to' field via the URL.
I would be OK doing this except that the box has a lot of auto-complete code and I'm not sure how to alter it so I don't break it.
So for example, I pass the name like this:
How would I then alter the code for the field? Is it best to use an 'if (isset)' kinda statement to do one or the other?
This is what it looks like:
I would be OK doing this except that the box has a lot of auto-complete code and I'm not sure how to alter it so I don't break it.
So for example, I pass the name like this:
$SendTo = $_GET['SendTo'];
How would I then alter the code for the field? Is it best to use an 'if (isset)' kinda statement to do one or the other?
This is what it looks like:
<input id="WhisperUsername" name="WhisperUsername" type="text" value="'.FormatStringForDisplay($Discussion->WhisperUsername, 0).'" class="Whisper AutoCompleteInput" />
<script type="text/javascript">
var WhisperAutoComplete = new AutoComplete("WhisperUsername", false);
WhisperAutoComplete.TableID = "WhisperAutoCompleteResults";
WhisperAutoComplete.KeywordSourceUrl = "'.$this->Context->Configuration['WEB_ROOT'].'ajax/getusers.php?Search=";
</script>
0
This discussion has been closed.
Comments
$Discussion->WhisperUsername = $SendTo; // or use urldecode(ForceIncomingString('SendTo', ''));
i added it at the top but i get an error if i don't supply the &SendTo part of the URL. can i pass a 'null' to it or something?
<?php $SendTo = $_GET['SendTo']; $Discussion->WhisperUsername = $SendTo; // or use urldecode(ForceIncomingString('SendTo', ''));
error:
Notice: Undefined index: SendTo in /home/circuit/public_html/candr/messageboard/extensions/PrivateMessages/message_form_new.php on line 2
And you might need to put
if ( isset($_GET['SendTo']) )
at the beginning of the added line to check if a value was passed.example:
if ( isset($_GET['SendTo']) ) $Discussion->WhisperUsername = $_GET['SendTo']; <input id="WhisperUsername" name="WhisperUsername" type="text" value="'.FormatStringForDisplay($Discussion->WhisperUsername, 0).'" class="Whisper AutoCompleteInput" /> <script type="text/javascript"> var WhisperAutoComplete = new AutoComplete("WhisperUsername", false); WhisperAutoComplete.TableID = "WhisperAutoCompleteResults"; WhisperAutoComplete.KeywordSourceUrl = "'.$this->Context->Configuration['WEB_ROOT'].'ajax/getusers.php?Search="; </script>
if ( isset($_GET['SendTo']) ) $Discussion->WhisperUsername = $_GET['SendTo'];
thank you!