MyBB Community Forums

Full Version: Thumbs Post Rating 1.3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Got it working but it's on the left how to put it on the right?
(2019-08-12, 07:37 PM)natthakon Wrote: [ -> ]Got it working but it's on the left how to put it on the right?


Umm not sure if you noticed, that it does not install standard postbit and only installs postbit classic, so that would need to be fixed, also have you noticed the errors when you click the thumbs in at least php 7? Those would need to be fixed also... as also you will need to correct isdefault...., etc, etc, so for those saying just swap compat mode and it works, not necessarily.... 


The following appears at quick glance to work on 1821:

[Image: Screenshot-20190812-160954.png]

Mybbroot/inc/plugins/thumbspostrating.php
<?php
/*
 * MyBB: Thumbs Post Rating
 *
 * File: thumbpostrating.php
 *
 * Authors: TY Yew & Vintagedaddyo
 *
 * MyBB Version: 1.8
 *
 * Plugin Version: 1.4
 *
 *  This file is part of Thumbs Post Rating plugin for MyBB.
 *
 *  Thumbs Post Rating plugin for MyBB is free software; you can
 *  redistribute it and/or modify it under the terms of the GNU General
 *  Public License as published by the Free Software Foundation; either
 *  version 3 of the License, or (at your option) any later version.
 *
 *  Thumbs Post Rating plugin for MyBB is distributed in the hope that it
 *  will be useful, but WITHOUT ANY WARRANTY; without even the implied
 *  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *  the GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http:www.gnu.org/licenses/>.
 */

// Disallow direct access to this file for security reasons

if( !defined('IN_MYBB') )
{
	die('Direct initialization of this file is not allowed.');
}

// Add hooks

$plugins->add_hook('global_start','tpr_global');
$plugins->add_hook('postbit','tpr_box');
$plugins->add_hook('xmlhttp','tpr_action');
$plugins->add_hook('class_moderation_delete_post','tpr_deletepost');
$plugins->add_hook('class_moderation_delete_thread_start','tpr_deletethread');
$plugins->add_hook('class_moderation_delete_thread','tpr_deletethread2');

// Plugin information

function thumbspostrating_info()
{
	
	global $lang;
	
	$lang->load('thumbspostrating');

	return array(
		'name' => $lang->tpr_info_name,
		'description' => $lang->tpr_info_desc,
		'website' => 'http://community.mybb.com/thread-84250.html',
		'author' => 'TY Yew & Vintagedaddyo',
		'authorsite' => 'http://community.mybb.com/user-6029.html',
		'version' => '1.4',
		'guid' => '21de27b859c0095ec17f86f561fa3737',
		'compatibility' => '18*'
	);
}

// Install function

function thumbspostrating_install()
{
	global $db;

	@ignore_user_abort(true);

	@set_time_limit(600);

	$db->write_query('ALTER TABLE '.TABLE_PREFIX.'posts ADD `thumbsup` INT UNSIGNED NOT NULL DEFAULT 0, ADD `thumbsdown` INT UNSIGNED NOT NULL DEFAULT 0', true);

	$db->write_query('CREATE TABLE IF NOT EXISTS '.TABLE_PREFIX.'thumbspostrating (
		id INT UNSIGNED NOT NULL AUTO_INCREMENT ,
		pid INT NOT NULL,
		uid INT NOT NULL,
		thumbsup INT NOT NULL DEFAULT 0,
		thumbsdown INT NOT NULL DEFAULT 0,
		PRIMARY KEY ( id )
		) ENGINE = MYISAM ;'
	);
}

// Activate function

function thumbspostrating_activate()
{
	global $db, $lang;
	
	$lang->load('thumbspostrating');

	require MYBB_ROOT.'/inc/adminfunctions_templates.php';

	find_replace_templatesets('postbit','#'.preg_quote('{$post[\'message\']}').'#','<div class="float_right">{$post[\'tprdsp\']}</div>{$post[\'message\']}');

	find_replace_templatesets('postbit_classic','#'.preg_quote('{$post[\'message\']}').'#','<div class="float_right">{$post[\'tprdsp\']}</div>{$post[\'message\']}');

	$tpr_setting_group_1 = array(
		'name' => 'tpr_group',
		'title' => $db->escape_string($lang->tpr_set_group_1_title),
		'description' => $db->escape_string($lang->tpr_set_group_1_desc),
		'disporder' => '38',
		'isdefault' => '0'
	);
	
	$db->insert_query('settinggroups',$tpr_setting_group_1);
	
	$gid = $db->insert_id();

	$disporder = 0;

	foreach(array(
		'usergroups' => array('text', '2,3,4,6'),
		'forums' => array('text', '0'),
		'selfrate'  => array('yesno', 1),
		'undorate' => array('yesno', 1),
		'closerate' => array('yesno', 1),
	) as $name => $opts)
	{
		$lang_title = 'tpr_set_'.$name.'_title';
		$lang_desc = 'tpr_set_'.$name.'_desc';
		$db->insert_query('settings', array(
			'name' => 'tpr_'.$name,
			'title' => $db->escape_string($lang->$lang_title),
			'description' => $db->escape_string($lang->$lang_desc),
			'optionscode' => $opts[0],
			'value' => $db->escape_string($opts[1]),
			'disporder' => ++$disporder,
			'gid' => $gid,
		));
	}

	rebuild_settings();
}

// Deactivate function

function thumbspostrating_deactivate()
{
	global $db;

	$gid = $db->fetch_field($db->simple_select('settinggroups','gid','name="tpr_group"'),'gid');
	
	if($gid)
	{
		$db->delete_query('settings','gid='.$gid);

		$db->delete_query('settinggroups','gid='.$gid);
	}
	
	rebuild_settings();

	require MYBB_ROOT.'/inc/adminfunctions_templates.php';
	
	find_replace_templatesets('postbit','#'.preg_quote('<div class="float_right">{$post[\'tprdsp\']}</div>').'#','');

	find_replace_templatesets('postbit_classic','#'.preg_quote('<div class="float_right">{$post[\'tprdsp\']}</div>').'#','');
		
}

// Is Installed function

function thumbspostrating_is_installed()
{
	
	global $db;

	if($db->table_exists('thumbspostrating'))
	{
		return true;
	}
	return false;
}

// Uninstall function

function thumbspostrating_uninstall()
{
	
	global $db;

	@ignore_user_abort(true);

	@set_time_limit(600);

	$db->write_query('ALTER TABLE '.TABLE_PREFIX.'posts DROP thumbsup, DROP thumbsdown', true);

	$db->write_query('DROP TABLE IF EXISTS '.TABLE_PREFIX.'thumbspostrating');
}

// Function - Load TPR template and style only in showthread.php

function tpr_global()
{
	if($GLOBALS['current_page'] != 'showthread.php') return;

	$GLOBALS['templatelist'] .= ',postbit_tpr';
}

// Function - Forum exclusion

function tpr_forum($fidcheck)
{
	
	global $mybb;
	
	$fidset =& $mybb->settings['tpr_forums'];

	if($fidset != 0)
	{
		foreach(array_map('trim', explode(',',$fidset)) as $fid)
		{
			if( $fid == $fidcheck )
			{
				return false;
			}
		}
	}
	return true;
}


// Function - Usergroup checking
function grpchk($setting)
{
	
	global $mybb;
	
	$user = $mybb->user;

	$set = array_map('trim',explode(',',$mybb->settings['tpr_'.$setting]));

	if($set != 0)
	{
		foreach($set as $grp)
		{
			if($grp == $user['usergroup'])
			{
				$result = true;
			}
		}
	}

	if($user['additionalgroups'])
	{
		$addgrp = array_map('trim',explode(',',$user['additionalgroups']));

		$com = array_intersect($addgrp, $set);

		if (!empty($com))
		{
			$result = true;
		}
	}	

	if($result != true) return false;

	return true;
}

// Function - Check whether user can rate (Usergroup, Self rating, Closed thread)

function tpr_canrate($postuid)
{
	
	global $mybb;

	$user =& $mybb->user;

	
	// Guests

	if(!$user['uid']) return false;

	// Usergroup permission
	
	if(!grpchk('usergroups')) return false;

	// Self-rating
	
	if($postuid == $user['uid'] && $mybb->settings['tpr_selfrate'] == 1) return false;

	// Rate close thread
	
	if($GLOBALS['thread']['closed'] && $mybb->settings['tpr_closerate'] != 1) return false;

	return true;
}

// Function - Display ratebox

function tpr_box(&$post)
{
	
	global $db, $mybb, $templates, $lang, $current_page, $box_view, $tprdsp;

	$pid = (int) $post['pid'];

	$postuid = (int) $post['uid'];

	$uid = $mybb->user['uid'];

	$user = $mybb->user;

	$fid = $post['fid'];
	
	if(!$pid) return;

	// Remove hook if forum is excluded from TPR
	
	if(!tpr_forum($post['fid']))
	{
		global $plugins;

		$plugins->remove_hook('postbit', 'tpr_box');

		return;
	}

	// Stick in JS and CSS
	
	$GLOBALS['headerinclude'] .= '<script type="text/javascript" src="'.$mybb->settings['bburl'].'/jscripts/thumbspostrating.js?ver=1800"></script><link type="text/css" rel="stylesheet" href="'.$mybb->settings['bburl'].'/css/thumbspostrating.css" />';

	// Build user rating cache
	
	static $done_init = false;

	static $user_ru = null;

	static $user_rd = null;
	
	if(!$done_init)
	{
		
		$done_init = true;
		
		$user_ru = array();
		
		$user_rd = array();
		
		if($current_page == 'showthread.php')
		{
			
			$lang->load('thumbspostrating');
			
			// If user is not guest, check for user ratings
			
			if($mybb->user['uid'])
			{
				
				if($mybb->input['mode'] == 'threaded')
				{
					$query = $db->simple_select('thumbspostrating', 'pid,thumbsup,thumbsdown', 'uid='.$mybb->user['uid'].' AND pid='.(int)$mybb->input['pid']);
				}
				else
				{
					$query = $db->simple_select('thumbspostrating', 'pid,thumbsup,thumbsdown', 'uid='.$mybb->user['uid'].' AND '.$GLOBALS['pids']);
				}
			
				while($ttrate = $db->fetch_array($query))
				{
					$user_ru[$ttrate['pid']] = $ttrate['thumbsup'];

					$user_rd[$ttrate['pid']] = $ttrate['thumbsdown'];
				}

				$db->free_result($query);
			}
		}
	}

	// If user already rated...
	
	if ($user_ru[$pid] == 1 xor $user_rd[$pid] == 1)
	{
		$userrated[$pid] = true;
		
		// Make thumbs for user who rated up
		
		if ($user_ru[$pid] == 1)
		{
			$tu_img = '<div class="tpr_thumb tu1"></div>';

			$td_img = '<div class="tpr_thumb td0"></div>';
		}
		
		// Make thumbs for user who rated down
		
		else
		{
			$tu_img = '<div class="tpr_thumb tu0"></div>';

			$td_img = '<div class="tpr_thumb td1"></div>';
		}
	}
	else
	{
		$userrated[$pid] = false;
	}

	// Check whether the user can rate
	
	if (!tpr_canrate($postuid))
	{
		$cantrate = true;
	}

	$tu_url = $mybb->settings['bburl'].'/xmlhttp.php?action=tpr&amp;my_post_key='.$mybb->post_code.'&amp;pid='.$pid.'&amp;tu=1&amp;td=0';

	$td_url = $mybb->settings['bburl'].'/xmlhttp.php?action=tpr&amp;my_post_key='.$mybb->post_code.'&amp;pid='.$pid.'&amp;tu=0&amp;td=1';

	$un_url = $mybb->settings['bburl'].'/xmlhttp.php?action=tpr&amp;my_post_key='.$mybb->post_code.'&amp;pid='.$pid.'&amp;tu=0&amp;td=0';

	// If user have not yet rated (correctly)...
	
	if ($userrated[$pid] != true)
	{
		// Fail-safe (force user who incorectly rated to be unable to rate)
		
		if (isset($user_ru[$pid]) || isset($user_rd[$pid]))
		{
			if ($user_ru[$pid] != 1 xor $user_rd[$pid] != 1)
			{
				return;
			}
			else
			{
				$cantrate = true;
			}
		}

		// Make thumbs for user who cannot rate
		
		if ($cantrate == true)
		{
			$tu_img = '<div class="tpr_thumb tu0"></div>';

			$td_img = '<div class="tpr_thumb td0"></div>';
		}

		// Make thumbs for user who can rate

		else
		{
			$tu_img = '<a href='.$tu_url.' class="tpr_thumb tu2" title="'.$lang->tpr_rate_up.'" onclick="return thumbRate(1,0,'.$pid.')" ></a>';

			$td_img = '<a href='.$td_url.' class="tpr_thumb td2" title="'.$lang->tpr_rate_down.'" onclick="return thumbRate(0,1,'.$pid.')" ></a>';
			
			// Respect MyBB's wish to disable xmlhttp
			
			if($mybb->settings['use_xmlhttprequest'] == 0)
			{
				$tu_img = str_replace('onclick="return thumbRate', 'rel="', $tu_img);

				$td_img = str_replace('onclick="return thumbRate', 'rel="', $td_img);
			}
		}
	}

	// Display number of thumbs
	
	$tu_no = $post['thumbsup'];

	$td_no = $post['thumbsdown'];

	// Display undo rating?
	
	if($mybb->settings['tpr_undorate'] == 1 && $userrated[$pid] == true && !$cantrate)
	{
		$box_remove = '<a href='.$un_url.' onclick="return thumbRate(0,0,'.$pid.')" >'.$lang->tpr_undo_rate.'</a><br />';

		// Respect MyBB's wish to disable xmlhttp
		
		if($mybb->settings['use_xmlhttprequest'] == 0)
		{
			$box_remove = str_replace('onclick="return thumbRate', 'rel="', $box_remove);
		}
	}

	// Make the box
	
	$box = <<<BOX
<table class="tpr_box" id="tpr_stat_$pid">
	<tr>
		<td class="tu_stat" id="tu_stat_$pid">$tu_no</td>
		<td>$tu_img</td>
		<td>$td_img</td>
		<td class="td_stat" id="td_stat_$pid">$td_no</td>
	</tr>
	<tr>
		<td class="small" colspan="4" >
			<span id="tpr_remove_$pid">$box_remove</span>
			$box_view
		</td>
	</tr>
</table>
BOX;

$post['tprdsp'] = $box;
}

// Function - Thumbs Action

function tpr_action()
{
	global $mybb, $db, $tid, $lang;

	// Return if action is not TPR
	
	if ($mybb->input['action'] != 'tpr' ) return;

	$uid = $mybb->user['uid'];

	$pid = (int)$mybb->input['pid'];

	$tu = (int)$mybb->input['tu'];

	$td = (int)$mybb->input['td'];

	$lang->load('thumbspostrating');

	// Check whether the rating is valid
	
	if (($tu == 1 && $td == 0) || ($tu == 0 && $td == 1) || ($tu == 0 && $td == 0))
	{
		// Check whether the post key is valid

		if (!verify_post_check($mybb->input['my_post_key'], true)) xmlhttp_error($lang->invalid_post_code);
	}
	else
	{
		xmlhttp_error($lang->tpr_error_invalid_rating);
	}

	$post = get_post($pid);

	$thread = get_thread($post['tid']);

	$forumpermissions = forum_permissions($post['fid']);

	// Check whether the post exist and is visible
	
	if(!$post['pid']) xmlhttp_error($lang->post_doesnt_exist);

	if(($thread['visible'] != 1 || $post['visible'] != 1) && !$ismod) xmlhttp_error($lang->post_doesnt_exist);

	// Check whether the user can rate
	
	$postuid = (int) $post['uid'];

	if (!tpr_canrate($postuid)) xmlhttp_error($lang->tpr_error_cannot_rate);
	
	// Check whether the user can view the post
	
	if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1) xmlhttp_error($lang->post_doesnt_exist);

	if($forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) xmlhttp_error($lang->post_doesnt_exist);

	// Check whether the user has rated
	
	$rated = $db->fetch_array($db->simple_select('thumbspostrating','thumbsup,thumbsdown','uid='.$uid.' and pid='.$pid));

	if(($rated['thumbsup'] == 1 || $rated['thumbsdown'] == 1) && ($tu == 1 || $td == 1)) xmlhttp_error($lang->tpr_error_already_rated);

	// Action for user who rated thumbs up
	
	if($tu == 1 && $td == 0)
	{
		$insert_thumbs = array(
			'thumbsup' => 1,
			'uid' => $uid,
			'pid' => $pid
	);

		// Insert the data into database
		
		$db->insert_query('thumbspostrating',$insert_thumbs);

		$db->write_query('UPDATE '.TABLE_PREFIX.'posts SET thumbsup = thumbsup +1 WHERE pid='.$pid);

		++$post['thumbsup'];
	}
	
	// Action for user who rated thumbs down
	
	elseif($tu == 0 && $td == 1)
	{
		$insert_thumbs = array(
			'thumbsdown' => 1,
			'uid' => $uid,
			'pid' => $pid
		);

		// Insert the data into database
		
		$db->insert_query('thumbspostrating',$insert_thumbs);

		$db->write_query('UPDATE '.TABLE_PREFIX.'posts SET thumbsdown = thumbsdown +1 WHERE pid='.$pid);
		
		++$post['thumbsdown'];
	}
	
	// Action for user who undo rating
	
	elseif($tu == 0 && $td == 0)
	{
		if ($rated['thumbsup'] == 1)
		{
			$db->write_query('UPDATE '.TABLE_PREFIX.'posts SET thumbsup = thumbsup -1 WHERE pid='.$pid);
			--$post['thumbsup'];
		}
		elseif ($rated['thumbsdown'] == 1)
		{
			$db->write_query('UPDATE '.TABLE_PREFIX.'posts SET thumbsdown = thumbsdown -1 WHERE pid='.$pid);
			--$post['thumbsdown'];
		}
		else
		{
			return;
		}

		$db->delete_query('thumbspostrating', 'uid='.$uid.' and pid='.$pid);
	}

	// Error if none of the above
	
	else
	{
		xmlhttp_error($lang->tpr_error_invalid_rating);
	}

	// Feedback to the user
	
	if(!$mybb->input['ajax'])
	{
		header('Location: '.htmlspecialchars_decode(get_post_link($pid, $post['tid'])).'#pid'.$pid);
	}
	else
	{
		// Push new values to client	
		
		echo 'success||', $post['pid'], '||', (int)$post['thumbsup'], '||', (int)$post['thumbsdown'];
		
		// What user has just rated?
		
		if ($tu == 1 && $td == 0)
		{
			echo '||1';
		}

		elseif ($tu == 0 && $td == 1)
		{
			echo '||-1';
		}

		elseif ($tu == 0 && $td == 0)
		{
			echo '||0';
		}

		// Show undo rating if enabled
		
		if($mybb->settings['tpr_undorate'] == 1 && ($tu || $td) == 1)
		{
			echo '||show_undo';
		}

		// Remove undo rating if undone
		
		elseif($mybb->settings['tpr_undorate'] == 1 && ($tu && $td) == 0)
		{
			echo '||hide_undo';
		}
	}
}

// Function - Delete post

function tpr_deletepost($pid)
{
	
	global $db;
	
	$db->delete_query('thumbspostrating', 'pid='.$pid);
}

// Function - Delete thread

function tpr_deletethread($tid)
{
	global $db, $tpr_pids;
	
	// grab pids, but only delete later
	
	$tpr_pids = '';

	$query = $db->simple_select('posts', 'pid', 'tid='.$tid);

	while($pid = $db->fetch_field($query, 'pid'))
		$tpr_pids .= ($tpr_pids ? ',':'') . $pid;

	$db->free_result($query);
}

// Function - Delete thread 2

function tpr_deletethread2($tid)
{
	global $tpr_pids, $db;
	
	if(!$tpr_pids) return;
	
	$db->delete_query('thumbspostrating', 'pid IN ('.$tpr_pids.')');

	$tpr_pids = '';
}

?>


Thumbs Post Rating 1.4 for 1.8.x  -> Download:  https://community.mybb.com/mods.php?acti...w&pid=1297
Or: https://github.com/vintagedaddyo/MyBB_Pl...PostRating *current localization, english, englishgb, espanol, french, italiano
Thanks for the update.
My thumbs are still on the left  Huh Any ideas?
[attachment=42118]
(2019-08-13, 07:15 PM)natthakon Wrote: [ -> ]Thanks for the update.
My thumbs are still on the left  Huh Any ideas?

Sounds like perhaps you have existing  styling conflict with your float_right class as that would be the first place I would look in your theme global.css

As default should be like so:

.float_left {
	float: left;
}

.float_right {
	float: right;
}

* when I modify that to be opposite say for ltr purposes, then I see it on the left as your picture describes?? Just a thought

Or perhaps rather you do not have float_right class in template include for plugin, or you have old template edits still rather due to say only deactivating the plugin rather than uninstalling and reinstalling with the new version? Who knows, it is merely speculation seeing as I am not looking at your css or template edits and have only been provided with rather vague information.

After installing ver 1.4 your postbit should look like:
{$ignore_bit}{$deleted_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<div class="post {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<div class="post_author">
	{$post['useravatar']}
	<div class="author_information">
			<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
			<span class="smalltext">
				{$post['usertitle']}<br />
				{$post['userstars']}
				{$post['groupimage']}
			</span>
	</div>
	<div class="author_statistics">
		{$post['user_details']}
	</div>
</div>
<div class="post_content">
	<div class="post_head">
		{$post['posturl']}
		{$post['icon']}
		<span class="post_date">{$post['postdate']} <span class="post_edit" id="edited_by_{$post['pid']}">{$post['editedmsg']}</span></span>
		{$post['subject_extra']}
	</div>
	<div class="post_body scaleimages" id="pid_{$post['pid']}">
		<div class="float_right">{$post['tprdsp']}</div>{$post['message']}
	</div>
	{$post['attachments']}
	{$post['signature']}
	<div class="post_meta" id="post_meta_{$post['pid']}">
		{$post['iplogged']}
		<div class="float_right">
			{$post['poststatus']}
		</div>
	</div>
	{$post['input_editreason']}
</div>
<div class="post_controls">
	<div class="postbit_buttons author_buttons float_left">
		{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}
	</div>
	<div class="postbit_buttons post_management_buttons float_right">
		{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quickrestore']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_purgespammer']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
	</div>
</div>
</div>

After installing ver 1.4 your postbit_classic should look like:

{$ignore_bit}{$deleted_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<div class="post classic {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<div class="post_author scaleimages">
	{$post['useravatar']}
	<div class="author_information">
			<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
			<span class="smalltext">
				{$post['usertitle']}<br />
				{$post['userstars']}
				{$post['groupimage']}
			</span>
	</div>
	<div class="author_statistics">
		{$post['user_details']}
	</div>
</div>
<div class="post_content">
	<div class="post_head">
		{$post['posturl']}
		{$post['icon']}
		<span class="post_date">{$post['postdate']} <span class="post_edit" id="edited_by_{$post['pid']}">{$post['editedmsg']}</span></span>
	{$post['subject_extra']}
	</div>
	<div class="post_body scaleimages" id="pid_{$post['pid']}">
		<div class="float_right">{$post['tprdsp']}</div>{$post['message']}
	</div>
	{$post['attachments']}
	{$post['signature']}
	<div class="post_meta" id="post_meta_{$post['pid']}">
		{$post['iplogged']}
		<div class="float_right">
			{$post['poststatus']}
		</div>
	</div>
	{$post['input_editreason']}
</div>
<div class="post_controls">
	<div class="postbit_buttons author_buttons float_left">
		{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}
	</div>
	<div class="postbit_buttons post_management_buttons float_right">
		{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quickrestore']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_purgespammer']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
	</div>
</div>
</div>
my postbit_classic is the same as the after one you show. I've deactivated and installed again and now I have thumbs on the left and the right Dodgy
[attachment=42119]
(2019-08-13, 08:20 PM)natthakon Wrote: [ -> ]my postbit_classic is the same as the after one you show. I've deactivated and installed again and now I have thumbs on the left and the right Dodgy

Lol, that is what happens when a plugin is not uninstalled fully on the template side..., of course adding items to the old plugin via template edits would cause the old plugin to not uninstall correctly..., and such would be needed to be unistalled before applying new version that has correct template inserts. This also why you may have noticed that even uninstalling the new plugin marks your postbit and postbit_classic templates as green, meaning not default and edited because your past edits are not uninstalled and has to do with your past edits and not the version 1.4 plugin that will install and uninstall correctly. Simple fix though, unistall the plugin, but since it wont unistall your old edits ie: why you see two, simply revert postbit and postbit_classic templates before installing ver 1.4 that way it will wipe your old edits and allow the plugin 1.4 that has correct 1.8 template inserts to install without your old edits. Simple enough.
Ok that's great. It's working fine now thanks
(2019-08-13, 09:12 PM)natthakon Wrote: [ -> ]Ok that's great. It's working fine now thanks

Cool beans. Cool  Glad you got it sorted. Big Grin
Thanks for the information.
It works for me on 1.8 with the changes as attached.
BTW: I am using MYSQL.
I got this plugin working fine on myBB 1.8.30. But it is only working with chrome. Failing with edge and with any smartphone browser (chrome, opera). Does anyone know why? And would it be possible to fix that?

Addition: I have located the problem myself. It persisted in all browsers, including Chrome. However, the thumb icons were still in the cache in Chrome. After deleting the cache, it did not work there either.

The reason was a wrong path to the file thumbspostrating.css. If created with the ACP it is not located in the css directory, but in the themes directory. So the code with the path to the css directory in thumbspostrating.php must be changed. The old code

// Stick in JS and CSS
 
$GLOBALS['headerinclude'] .= '<script type="text/javascript" src="'.$mybb->settings['bburl'].'/jscripts/thumbspostrating.js?ver=1800"></script><link type="text/css" rel="stylesheet" href="'.$mybb->settings['bburl'].'/css/thumbspostrating.css" />';

// Build user rating cache

must be replaced by the new one that points to the path of the default theme (where the file thumbspostrating.css should be located):

// Stick in JS and CSS

$query = $db->simple_select("themes", "tid", "def=1");
$tid = $db->fetch_field($query, "tid");
$GLOBALS['headerinclude'] .= '<script type="text/javascript" src="'.$mybb->settings['bburl'].'/jscripts/thumbspostrating.js?ver=1800"></script><link type="text/css" rel="stylesheet" href="'.$mybb->settings['bburl'].'/cache/themes/theme'.$tid.'/thumbspostrating.css" />';

// Build user rating cache
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15