×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Voting logic

Voting logic 15 years 11 months ago #1778

  • Guillermo
  • Guillermo's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi, I don't know if I messed up things, or if it was actually a designed feature, but in my installation (joomla 1.5.8) the comments voting was available only to the author, just the opposite of what I wanted (to have people entitled to comment, be able to vote on others' comments).

So I made some minor hacks and everything works now. Here are them

On the template, I had to create a new BLOCK-voting block, and insert within it the {voting} tag:
{post}
<table class='postcontainer' id='post{id}' width='100%' cellpadding='0' cellspacing='0' style='margin-left:{wrapnum};'><!-- style='padding-left:{wrapnum};'> -->
	<tr>
		<td><a name='josc{id}'></a>
<table width='100%' cellpadding='4' cellspacing='1' style="border-bottom: 1px solid #cccccc;">
  <tbody class='{postclass}'>
  <tr>
  <td width="80" align="center" valign="top">
  {BLOCK-avatar_picture}<div>{avatar_picture}</div>{/BLOCK-avatar_picture}
  <div class='small'>{username}</div>
  </td>
  <td>
  {BLOCK-title}<div class='posttitle'>{title}</div>{/BLOCK-title}
  <div style="text-align:right;" class='small'>{date}</div>
  <!-- @willy: formateamos comentarios -->
  <div class="comment_content">{content}</div><br/>
  {BLOCK-voting}<div align="right">{voting}</div>{/BLOCK-voting}
  {BLOCK-footer}
  <table class='postfooter' width='100%' cellpadding='0' cellspacing='0'>
	  <tr><td align='center'>{editbuttons}</td></tr>
  </table>
  </td>
  </tr>
  {/BLOCK-footer}
  </tbody>
</table>
		</td>
	</tr>
</table>
{/post}

Then on components/com_comment/joscomment/comment.class.php, I changed from

$display 	= ((!$my->username && $this->_only_registered) || !$this->_ajax || ($edit == '')) ? false : true;
$html 		= JOSC_utils::checkBlock('BLOCK-footer', $display, $html);
        if ($display) {
			/* {editbuttons} */
        	$html 		= str_replace('{editbuttons}', $edit, $html);
	        /* {voting} */
    	    $html 		= str_replace('{voting}', $voting, $html);
        }

to
	    /* {voting} */
		$display 	= ((!$my->username && $this->_only_registered) || !$this->_ajax ) ? false : true;
        $html 		= JOSC_utils::checkBlock('BLOCK-voting', $display, $html);
        if ($display) {
    	    $html 		= str_replace('{voting}', $voting, $html);
        }
 
 
		$display 	= ((!$my->username && $this->_only_registered) || !$this->_ajax || ($edit == '')) ? false : true;
        $html 		= JOSC_utils::checkBlock('BLOCK-footer', $display, $html);
        if ($display) {
			/* {editbuttons} */
        	$html 		= str_replace('{editbuttons}', $edit, $html);
        }

So this way I separate the decision to show/allow voting from the decision to Edit comments and changed the test to test only for being under the rules that allow me for posting a comment: If I can post a comment, then I can vote.

I can still vote my own comments but as I can only to it once per comment, I don't see it a big issue (and besides surely it won't be so hard to fix... but today's been a loooong day).

Am I on the right track? Or did I broke anything??? (I mean, towards future usage of the site)

Best regards Willie.
  • Page:
  • 1
Time to create page: 0.133 seconds