Simple Forum 1.01 Released!

By gregThomas - April 6, 2016 - edited: December 12, 2016

Hi Everyone, 

We've just released a new version of Simple Forum:

http://www.interactivetools.com/add-ons/simple-forum/

NOTE: This version requires CMSB 3.00 (Released January 2016)

Here's what's new in 1.01:

  • Stopped signature being double HTML encoded.
  • Fixed unescaped table names being used.
  • Fixed missing closing div tag on forum home page. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Toledoh - April 9, 2016 - edited: April 10, 2016

Hey all.

Not sure if anyone's interested or not, but I’ve played with the Forum Polls - I wanted to chart the data in an animated bar chart. You can see it here: http://server.toledoh.com/~cmsbtest/forum/forum-posts.php?Another-Test-Poll-3

I added CSS.

.chart {

  display: table;

  table-layout: fixed;

  width: 60%;

  max-width: 700px;

  height: 200px;

  margin: 0 auto;

  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.1) 2%, rgba(0, 0, 0, 0) 2%);

  background-size: 100% 50px;

  background-position: left top;

}

.chart li {

  position: relative;

  display: table-cell;

  vertical-align: bottom;

  height: 200px;

}

.chart span {

  margin: 0 1em;

  display: block;

  background: rgba(209, 236, 250, 0.75);

  animation: draw 1s ease-in-out;

}

.chart span:before {

  position: absolute;

  left: 0;

  right: 0;

  top: 100%;

  padding: 5px 1em 0;

  display: block;

  text-align: center;

  content: attr(title);

  word-wrap: break-word;

}

@keyframes draw {

  0% {

    height: 0;

  }

}

I changed this in simpleForum-html.php

  // get answers and results

  $answers    = '';

  $totalVotes = (int) $poll['pollVotes1'] + $poll['pollVotes2'] + $poll['pollVotes3'] + $poll['pollVotes4'] + $poll['pollVotes5']

              + $poll['pollVotes6'] + $poll['pollVotes7'] + $poll['pollVotes8'] + $poll['pollVotes9'] + $poll['pollVotes10'];

  foreach (range(1,10) as $num) {

    $answer   = $poll["pollAnswer$num"];

    if ($answer == '') { continue; }

    $votes    = $poll["pollVotes$num"];

    $percent  = $totalVotes ? (($votes / $totalVotes) * 100) : 0;

    $percent  = sprintf("%.0f", $percent);

    $voteLink = $GLOBALS['SFORUM_POSTS_URL'] . "?postNum=$postNum&vote=$num";

    if ($userVoted) { $answers .= "<li><span style='height:$percent%' title='$answer'></span></li>\n"; }

    else            { $answers .= "<li><a href='$voteLink' class='btn btn-sm btn-default'>" . t('Vote') . " - $answer</a></li>\n"; }

  }

  if ($userVoted) { $answers .= "</ul><p>" . t('Votes') . ": $totalVotes</p>\n"; }

  // create output list

  $html  = "<div class='sforum-poll'>";

  $html .= "  <b>" . t('Poll') . ":</b><br/>\n";

  $html .= "<ul class='chart'>\n";

  $html .= $answers;

  $html .= "</div>";

  //

  return $html;

}

Cheers,

Tim (toledoh.com.au)

By gregThomas - April 11, 2016

Hey Tim, that looks great! I like the way it animates after you've voted.

Greg Thomas







PHP Programmer - interactivetools.com

By Djulia - April 15, 2016

Hi, Greg,

Is there a version for CMSB 2.65?
We have a very large site which cannot be updated now.

Thanks!
Djulia