MyBB Community Forums

Full Version: XEM Fast Reputation 1.6
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
There is a problem with installation. What I can do with it?

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1366 - Incorrect integer value: 'NOW' for column 'dateline' at row 1

Query:
INSERT INTO mybb_templates (`title`,`template`,`sid`,`version`,`dateline`) VALUES ('xem_fast_rep','<span id=\"xem_fast_rep\" class=\"reps_{$post[\'pid\']}\" style=\"float:right;\">{$post_reps}</span>','-1','1','NOW'), ('xem_fast_rep_post_positive','<span onclick=\"vote(\'{$uid}\', \'{$pid}\', \'{$to_rep}\')\" class=\"reps plus\" id=\"rep_plus_{$pid}\" title=\"{$lang->xem_fast_rep_like_it}\">+</span>','-1','1','NOW'), ('xem_fast_rep_post_negative','<span onclick=\"vote(\'{$uid}\', \'{$pid}\', \'{$to_rep}\')\" class=\"reps minus\" id=\"rep_minus_{$pid}\" title=\"{$lang->xem_fast_rep_unlike_it}\">-</span>','-1','1','NOW'), ('xem_fast_rep_post_reps_count','<span class=\"reps likes_{$pid}{$color}\" title=\"{$lang->xem_fast_rep_who_like_it}\">{$count}</span>','-1','1','NOW'), ('xem_fast_rep_post_who_like_it','<span class=\"liked_this\">{$liked_this}</span>','-1','1','NOW')
Yea and not working with MyBB 1.8.14 ....
I see the +/ - but no buttons to click to vote up or down. Running latest MyBB.
I know its 2020  but problem stil here - i see the + - in text form but no buttons..
So i fixed issue  you gota add css on Advanced view and at it right before "Modal end"

But now when I Dislike - i get messsage "MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance."

Here is what i get in logs
<error>
	<dateline>1605771287</dateline>
	<script>C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php</script>
	<line>587</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>count(): Parameter must be an array or an object that implements Countable</message>
	<back_trace>#0  errorHandler->error() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:587]
#1  xem_fast_rep::liked_this() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:324]
#2  xem_fast_rep::in_post() called at [C:\xampp\htdocs\mybb\inc\class_plugins.php:136]
#3  pluginSystem->run_hooks() called at [C:\xampp\htdocs\mybb\inc\functions_post.php:853]
#4  build_postbit() called at [C:\xampp\htdocs\mybb\showthread.php:1126]
</back_trace>
</error>

<error>
	<dateline>1605771293</dateline>
	<script>C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php</script>
	<line>587</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>count(): Parameter must be an array or an object that implements Countable</message>
	<back_trace>#0  errorHandler->error() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:587]
#1  xem_fast_rep::liked_this() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:393]
#2  xem_fast_rep::xmlhttp() called at [C:\xampp\htdocs\mybb\inc\class_plugins.php:136]
#3  pluginSystem->run_hooks() called at [C:\xampp\htdocs\mybb\xmlhttp.php:205]
</back_trace>
</error>

(2020-11-19, 07:10 AM)Serious Wrote: [ -> ]I know its 2020  but problem stil here - i see the + - in text form but no buttons..
So i fixed issue  you gota add css on Advanced view and at it right before "Modal end"

But now when I Dislike - i get messsage "MyBB Internal: One or more warnings occurred. Please contact your administrator for assistance."

Here is what i get in logs
<error>
	<dateline>1605771287</dateline>
	<script>C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php</script>
	<line>587</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>count(): Parameter must be an array or an object that implements Countable</message>
	<back_trace>#0  errorHandler->error() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:587]
#1  xem_fast_rep::liked_this() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:324]
#2  xem_fast_rep::in_post() called at [C:\xampp\htdocs\mybb\inc\class_plugins.php:136]
#3  pluginSystem->run_hooks() called at [C:\xampp\htdocs\mybb\inc\functions_post.php:853]
#4  build_postbit() called at [C:\xampp\htdocs\mybb\showthread.php:1126]
</back_trace>
</error>

<error>
	<dateline>1605771293</dateline>
	<script>C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php</script>
	<line>587</line>
	<type>2</type>
	<friendly_type>Warning</friendly_type>
	<message>count(): Parameter must be an array or an object that implements Countable</message>
	<back_trace>#0  errorHandler->error() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:587]
#1  xem_fast_rep::liked_this() called at [C:\xampp\htdocs\mybb\inc\plugins\xem_fast_rep.php:393]
#2  xem_fast_rep::xmlhttp() called at [C:\xampp\htdocs\mybb\inc\class_plugins.php:136]
#3  pluginSystem->run_hooks() called at [C:\xampp\htdocs\mybb\xmlhttp.php:205]
</back_trace>
</error>



Hopefully this can help... I am using this plugin (Version 1.6 Build #9 Stable) successfully within multiple themes (Flatty/MyTrade).

MyBB Version 1.8.25
PHP Version 7.4.15
SQL Engine MySQLi 5.6.41

If the buttons are showing as plain text, you simply need to add the missing CSS to your global.css file for the theme you are using.  Here is that CSS:

/* xem fast rep */

.reps {
	display: inline;
	padding: 0.6em 1em .6em;
	font-size: 75%;
	font-weight: 700;
	line-height: 1;
	color: #fff;
	text-align: center;
	white-space: nowrap;
	vertical-align: baseline;
	border-radius: .25em;
	background-color: #777;
	margin: 1px;
}

.plus {
	background-color: #28a745;
	cursor: pointer;
}

.minus {
	background-color: #f0ad4e;
	cursor: pointer;
}

.liked_this {
	background: #efefef;
	padding: 6px;
	margin: 2px;
	vertical-align: middle;
	border-radius: 2px;
	font-size: 11px;
}

.positives {
	background: #148c00;
}

.negatives {
	background: #8c0000;
}		
Unfortunately build #9 does not work at all anymore with myBB 1.8.33 and PHP 8.1. Both constants NOW and TIME_NOW produce an error message during installation. If you replace them with time(), the installation works, but then the error

PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, non-static method xem_fast_rep::xmlhttp() cannot be called statically in inc/class_plugins.php:136

is thrown when calling any page. :-( Maybe someone has an idea about this?

Edit: I have now solved the problem and got the plugin to work with PHP 8.1. Besides replacing NOW and TIME_NOW with time(), you also have to declare many functions as static and add an if (empty($likeThis)) query to the function count(), because count() doesn't accept a NULL argument anymore. Then it works properly.
(2023-02-24, 04:28 PM)volkeru Wrote: [ -> ]Unfortunately build #9 does not work at all anymore with myBB 1.8.33 and PHP 8.1. Both constants NOW and TIME_NOW produce an error message during installation. If you replace them with time(), the installation works, but then the error

PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, non-static method xem_fast_rep::xmlhttp() cannot be called statically in inc/class_plugins.php:136

is thrown when calling any page. :-( Maybe someone has an idea about this?

Edit: I have now solved the problem and got the plugin to work with PHP 8.1. Besides replacing NOW and TIME_NOW with time(), you also have to declare many functions as static and add an if (empty($likeThis)) query to the function count(), because count() doesn't accept a NULL argument anymore. Then it works properly.

Would you like to share the fixed version that you have mentioned, we will be grateful to you.
In the meantime I also found and fixed some other errors. The number of "other users" who had rated a post positively was often wrong. There are quite a few places that I have changed in the meantime. I append my xem_fast_rep.php to compare.

Of course, it would be nice to get a list of all users who have rated the post positively (or negatively) when clicking on the total number of users who like a post. Maybe someone feels like implementing this? Smile
Pages: 1 2 3 4 5