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.
Options

Private Messages plugin: making a small change

edited December 2006 in Vanilla 1.0 Help
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:

$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>

Comments

  • Options
    Just before the first line you listed, you can set $Discussion->WhisperUsername to the passed value: $Discussion->WhisperUsername = $SendTo; // or use urldecode(ForceIncomingString('SendTo', ''));
  • Options
    edited December 2006
    wallphone: do you mean the first line in the second block of code?

    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
  • Options
    edited December 2006
    It would be above the second block of code.

    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>
  • Options
    now i just have the line you suggested at the very top of the file, and it works fine:

    if ( isset($_GET['SendTo']) ) $Discussion->WhisperUsername = $_GET['SendTo'];

    thank you!
This discussion has been closed.