I believe it would be better if the shoutbox form would appear at the top of the shout box when the "Post newest shouts on top" option is enabled. I have seen at least on site that does this "http://www.thejapanesepage.com/".

Here's the changes I made to the 5.x.1.1 code to achieve this:

File shoutbox.module
Function: _shoutbox_get_view()

/**
 * Returns the html to be displayed
 * in the block.
 */
function _shoutbox_get_view() {
    global $user;

...
        .'", defaultUrl : "' . $default_url
        .'", basePath : "' . $basePath
        .'"} ','inline');

++    // ----------------------------------------------
++    // output the existing shoutbox posts before form
++    // ----------------------------------------------
++    if ($shoutbox_ascending == false) {
++        $shoutbox_posts .= $shoutbox_posts_data['output'];
++        $output .= $shoutbox_posts;
++    }

    // ------------------------
    // output the shoutbox form
    // ------------------------
    if (user_access('post shouts') || user_access('post shouts without approval')) {
        $output .= drupal_get_form('shoutbox_add_form');
    }
    else {
        $output .= theme('shoutbox_post_forbidden');
    }

--    // ------------------------------------
--    // output the existing shoutbox posts
--    // ------------------------------------
++    // ---------------------------------------------
++    // output the existing shoutbox posts after form
++    // ---------------------------------------------
++    if ($shoutbox_ascending == true) {
        $shoutbox_posts .= $shoutbox_posts_data['output'];
        $output .= $shoutbox_posts;
++    }

    // -----------------------
    // print the shoutbox page
    // -----------------------
    return theme('shoutbox_page', $output, $title);
}

Of course I guess you could have a separate option to do this, but the location of the form depending on the sort direction of the posts seems to make sense to me.

Comments

disterics’s picture

I am not convinced this is a feature that others will find useful. If more people chime in, I will implement it.

stella’s picture

Marked #259566: Move text box to the top of Shoutbox as a duplicate of this issue.

tonnyl’s picture

Anyone that can convert the code to version 6? i could really use this.

nuerpel’s picture

Users of my website have suggested putting the form on top, too, if the newest shout appears on top. Their argument is that otherwise you're constantly scrolling around between form field an shouts.

disterics’s picture

Version: 5.x-1.x-dev » master
Assigned: Unassigned » disterics

Its too late to put it in the upcoming release. I will put it into the next one.

marius.s’s picture

I find the feature useful. If the designer will not be willing to implement the feature, here's a quick hack

Putting shoutbox entry form on top of shouts in 5.x-1.2 version

1. Backup the shoutbox.module

2. Open the original shoutbox module, and find this text, (second instance of it, around line 859):
$output = $shoutbox_posts_data['output'];

3. Delete it

4. Now, around line 864, find this text:
$output .= drupal_get_form('shoutbox_add_form');

5. After this text, make a new line and paste the following text there:

$shoutbox_posts .= $shoutbox_posts_data['output'];
$output .= $shoutbox_posts;

6. Save changes and reload your site in browser

lordmorgul’s picture

Getting this feature in the 6.x version is also very simple, see the code below which uses the configuration variable (shoutbox_ascending true/false) to choose whether the form box is above or below the list of shouts.
The lines starting with + were changed to be what is shown. Do not copy/paste this without removing those +'s at the line start, they are only telling you what to change.

function _shoutbox_block_view() {

  // Output the existing shoutbox posts.
  $show_amount = variable_get('shoutbox_showamount', '20');
  $shoutbox_ascending = variable_get('shoutbox_ascending', FALSE);
  $shoutbox_posts_data = _shoutbox_display_posts($show_amount);
  $output = $shoutbox_posts_data['output'];

  // Output the shoutbox form.
  if (_shoutbox_user_access('post shouts') || _shoutbox_user_access('post shouts without approval')) {
+    $form .= drupal_get_form('shoutbox_add_form');
  }
  else {
+    $form .= theme('shoutbox_post_forbidden');
  }

+  if ($shoutbox_ascending) {
+    $output = $form . $output;
+  } else {
+    $output = $output . $form;
+  }

The above is from the version = "6.x-1.0" core = "6.x", with my changes added.

xjm’s picture

Tracking.

alexgreyhead’s picture

Thankyou!! :o)

izus’s picture

I found this very useful too.
thanks a lot !

hope this will be implemented in the next release