Keep getting permission error in JComments Report function Topic is solved

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Keep getting permission error in JComments Report function

Post by CDXXonline » Fri May 24, 2019 11:33 pm

No idea why, the permissions are checked in the backend just keeps giving me you do not have permission to report comments message. By any chance does anyone see anything in this code that might not be compatible with the newest J! version? Pretty sure this is where it checks permission, the ERROR_YOU_HAVE_NO_RIGHTS_TO_REPORT is the error i keep getting.

Code: Select all

public static function reportComment()
{
	if (JCommentsSecurity::badRequest() == 1) {
		JCommentsSecurity::notAuth();
	}

	$acl = JCommentsFactory::getACL();
	$db = JFactory::getDbo();
	$config = JCommentsFactory::getConfig();
	$response = JCommentsFactory::getAjaxResponse();
	$values = self::prepareValues($_POST);

	$id = (int) $values['commentid'];
	$reason = trim(strip_tags($values['reason']));
	$name = trim(strip_tags($values['name']));
	$ip = $acl->getUserIP();

	if (empty($reason)) {
		if ($config->getInt('report_reason_required') == 1) {
			self::showErrorMessage(JText::_('ERROR_NO_REASON_FOR_REPORT'), '', 'comments-report-form');
			return $response;
		} else {
			$reason = JText::_('REPORT_REASON_UNKNOWN_REASON');
		}
	}

	$query = 'SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id;
	if ($acl->getUserId()) {
		$query .= ' AND userid = ' . $acl->getUserId();
	} else {
		$query .= ' AND userid = 0 AND ip = "' . $ip . '"';
	}
	$db->setQuery( $query );
	$reported = $db->loadResult();

	if (!$reported) {
		$maxReportsPerComment = $config->getInt('reports_per_comment', 1);
		$maxReportsBeforeUnpublish = $config->getInt('reports_before_unpublish', 0);
		$db->setQuery('SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id);
		$reported = $db->loadResult();
		if ($reported < $maxReportsPerComment || $maxReportsPerComment == 0) {
			$comment = JTable::getInstance('Comment', 'JCommentsTable');
			if ($comment->load($id)) {
				if ($acl->canReport($comment)) {
					if ($acl->getUserId()) {
						$user = JFactory::getUser();
						$name = $user->name;
					} else {
						if (empty($name)) {
							$name = 'Guest'; // JText::_('Guest');
						}
					}

					$report = JTable::getInstance('Report', 'JCommentsTable');
					$report->commentid = $comment->id;
					$report->date = JFactory::getDate()->toSql();
					$report->userid = $acl->getUserId();
					$report->ip = $ip;
					$report->name = $name;
					$report->reason = $reason;

					$html = '';
					$result = JCommentsEventHelper::trigger('onJCommentsCommentBeforeReport', array(&$comment, &$report));

					if (!in_array(false, $result, true)) {
						if ($report->store()) {
							JCommentsEventHelper::trigger('onJCommentsCommentAfterReport', array(&$comment, $report));

							if ($config->getInt('enable_notification') == 1) {
								if ($config->check('notification_type', 2)) {
									JComments::sendReport($comment, $name, $reason);
								}
							}

							// unpublish comment if reports count is enough
							if ($maxReportsBeforeUnpublish > 0 && $reported >= $maxReportsBeforeUnpublish) {
								$comment->published = 0;
								$comment->store();
							}

							$html = JText::_('REPORT_SUCCESSFULLY_SENT');
							$html = str_replace("\n", '\n', $html);
							$html = str_replace('\n', '<br />', $html);
							$html = JCommentsText::jsEscape($html);
						}
					}
					$response->addScript("jcomments.closeReport('$html');");
				} else {
					self::showErrorMessage(JText::_('ERROR_YOU_HAVE_NO_RIGHTS_TO_REPORT'), '', 'comments-report-form');
				}
			} else {
				$response->addAlert(JText::_('ERROR_NOT_FOUND'));
			}
		} else {
			self::showErrorMessage(JText::_('ERROR_COMMENT_ALREADY_REPORTED'), '', 'comments-report-form');
		}
	} else {
		self::showErrorMessage(JText::_('ERROR_YOU_CAN_NOT_REPORT_THE_SAME_COMMENT_MORE_THAN_ONCE'), '', 'comments-report-form');
	}
	return $response;
}
Last edited by toivo on Sat May 25, 2019 4:19 pm, edited 1 time in total.
Reason: mod note: moved from 3.x Coding

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37259
Joined: Sat Apr 05, 2008 9:58 pm

Re: Keep getting permission error in JComments Report function

Post by Webdongle » Sat May 25, 2019 3:46 pm

viewtopic.php?f=806&t=969442 please
Also it looks like you have language files missing.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sat May 25, 2019 4:49 pm

Forum Post Assistant (v1.4.8 (koine)) : 25th May 2019 wrote:
Basic Environment :: wrote:Joomla! Instance :: Joomla! 3.9.6-Stable (Amani) 7-May-2019
Joomla! Platform :: Joomla Platform 13.1.0-Stable (Curiosity) 24-Apr-2013
Joomla! Configured :: Yes | Read-Only (444) | Owner: --protected-- . (uid: /gid: ) | Group: --protected-- (gid: ) | Valid For: 3.9
Configuration Options :: Offline: false | SEF: true | SEF Suffix: false | SEF ReWrite: true | .htaccess/web.config: Yes | GZip: true | Cache: false | CacheTime: 15 | CacheHandler: file | CachePlatformPrefix: false | FTP Layer: false | Proxy: false | LiveSite: | Session lifetime: 60 | Session handler: none | Shared sessions: false | SSL: 2 | Error Reporting: default | Site Debug: false | Language Debug: false | Default Access: 1 | Unicode Slugs: false | dbConnection Type: mysqli | PHP Supports J! 3.9.6: Yes | Database Supports J! 3.9.6: Yes | Database Credentials Present: Yes |

Host Configuration :: OS: Linux | OS Version: 3.10.0-962.3.2.lve1.5.24.7.el6h.x86_64 | Technology: x86_64 | Web Server: Apache | Encoding: gzip, deflate, br | Doc Root: --protected-- | System TMP Writable: Yes | Free Disk Space : 471.11 GiB |

PHP Configuration :: Version: 7.1.27 | PHP API: cgi-fcgi | Session Path Writable: Yes | Display Errors: | Error Reporting: 22519 | Log Errors To: | Last Known Error: | Register Globals: | Magic Quotes: | Safe Mode: | Open Base: | Uploads: 1 | Max. Upload Size: 360M | Max. POST Size: 380M | Max. Input Time: 60 | Max. Execution Time: 660 | Memory Limit: 512M

Database Configuration :: Version: 5.7.24-cll-lve (Client:5.7.24) | Host: --protected-- (--protected--) | default Collation: utf8mb4_general_ci (default Character Set: utf8mb4) | Database Size: 120.49 MiB | #of Tables: 97
Detailed Environment :: wrote:PHP Extensions :: Core (7.1.27) | date (7.1.27) | libxml (7.1.27) | openssl (7.1.27) | pcre (7.1.27) | sqlite3 (7.1.27) | zlib (7.1.27) | bz2 (7.1.27) | calendar (7.1.27) | ctype (7.1.27) | curl (7.1.27) | hash (1.0) | filter (7.1.27) | ftp (7.1.27) | gettext (7.1.27) | gmp (7.1.27) | SPL (7.1.27) | iconv (7.1.27) | pcntl (7.1.27) | readline (7.1.27) | Reflection (7.1.27) | session (7.1.27) | standard (7.1.27) | shmop (7.1.27) | SimpleXML (7.1.27) | mbstring (7.1.27) | tokenizer (7.1.27) | xml (7.1.27) | cgi-fcgi () | apcu (5.1.14) | bcmath (7.1.27) | dba (7.1.27) | dom (20031129) | fileinfo (1.0.5) | gd (7.1.27) | geoip (1.1.1) | imagick (3.4.3) | imap (7.1.27) | intl (1.1.0) | json (1.5.0) | ldap (7.1.27) | exif (7.1.27) | mcrypt (7.1.27) | memcache (3.0.9-dev) | memcached (3.0.4) | mysqli (7.1.27) | OAuth (2.0.2) | odbc (7.1.27) | PDO (7.1.27) | pdo_mysql (7.1.27) | pdo_pgsql (7.1.27) | pdo_sqlite (7.1.27) | pgsql (7.1.27) | Phar (2.0.2) | snmp (0.1) | soap (7.1.27) | sockets (7.1.27) | tidy (7.1.27) | timezonedb (2018.9) | wddx (7.1.27) | xmlreader (7.1.27) | xmlrpc (7.1.27) | xmlwriter (7.1.27) | xsl (7.1.27) | zip (1.13.5) | PDO_ODBC (7.1.27) | pdo_sqlsrv (5.6.0) | sqlsrv (5.6.0) | ionCube Loader () | Zend OPcache (7.1.27) | Zend Engine (3.1.0) |
Potential Missing Extensions ::
Disabled Functions :: socket_create | socket_connect | show_source | enable_dl | dl | memory_limit | socket_accept | socket_bind | socket_close | socket_create_listen | socket_create_pair | socket_listen | socket_recv | socket_recvfrom | socket_select | socket_send | socket_sendto | socket_shutdown |

Switch User Environment (Experimental) :: PHP CGI: Yes | Server SU: Yes | PHP SU: Yes | Custom SU (LiteSpeed/Cloud/Grid): No
Potential Ownership Issues: Maybe
Folder Permissions :: wrote:Core Folders :: images/ (755) | components/ (755) | modules/ (755) | plugins/ (755) | language/ (755) | templates/ (755) | cache/ (755) | logs/ (---) | tmp/ (755) | administrator/components/ (755) | administrator/modules/ (755) | administrator/language/ (755) | administrator/templates/ (755) | administrator/logs/ (755) |

Elevated Permissions (First 10) ::
Database Information :: wrote:Database statistics :: Uptime: 4274143 | Threads: 34 | Questions: 1745427508 | Slow queries: 0 | Opens: 87087808 | Flush tables: 1 | Open tables: 2000 | Queries per second avg: 408.369 |
Extensions Discovered :: wrote:Components :: SITE ::
Core :: com_wrapper (3.0.0) 1 | com_mailto (3.0.0) 1 |
3rd Party::

Components :: ADMIN ::
Core :: com_postinstall (3.2.0) 1 | com_installer (3.0.0) 1 | com_newsfeeds (3.0.0) 1 | com_ajax (3.2.0) 1 | com_content (3.0.0) 1 | com_modules (3.0.0) 1 | com_fields (3.7.0) 1 | com_associations (3.7.0) 1 | com_config (3.0.0) 1 | com_plugins (3.0.0) 1 | com_redirect (3.0.0) 1 | com_cache (3.0.0) 1 | com_media (3.0.0) 1 | com_privacy (3.9.0) 1 | com_search (3.0.0) 1 | com_users (3.0.0) 1 | com_finder (3.0.0) 1 | com_menus (3.0.0) 1 | com_tags (3.1.0) 1 | com_checkin (3.0.0) 1 | com_login (3.0.0) 1 | com_cpanel (3.0.0) 1 | com_banners (3.0.0) 1 | com_actionlogs (3.9.0) 1 | com_admin (3.0.0) 1 | com_templates (3.0.0) 1 | com_messages (3.0.0) 1 | com_languages (3.0.0) 1 | com_joomlaupdate (3.6.2) 1 | com_categories (3.0.0) 1 | com_contenthistory (3.2.0) 1 |
3rd Party:: JComments (3.0.7) ? | uddeIM (4.0) 1 |

Modules :: SITE ::
Core :: mod_stats (3.0.0) 1 | mod_articles_archive (3.0.0) 1 | mod_users_latest (3.0.0) 1 | mod_articles_categories (3.0.0) 1 | mod_breadcrumbs (3.0.0) 1 | mod_search (3.0.0) 1 | mod_banners (3.0.0) 1 | mod_related_items (3.0.0) 1 | mod_random_image (3.0.0) 1 | mod_languages (3.5.0) 1 | mod_articles_popular (3.0.0) 1 | mod_finder (3.0.0) 1 | mod_footer (3.0.0) 1 | mod_login (3.0.0) 1 | mod_wrapper (3.0.0) 1 | mod_articles_news (3.0.0) 1 | mod_custom (3.0.0) 1 | mod_tags_popular (3.1.0) 1 | mod_menu (3.0.0) 1 | mod_articles_latest (3.0.0) 1 | mod_feed (3.0.0) 1 | mod_articles_category (3.0.0) 1 | mod_tags_similar (3.1.0) 1 | mod_whosonline (3.0.0) 1 | mod_syndicate (3.0.0) 1 |
3rd Party:: Profile (1.0.0) 1 | JComments Top Posters (2.3.2) 1 | Top ExtraVote (1.4) 1 | uddeIM Mailbox (4.0) 1 | General Boards Latest (3.0.4) 1 | Graveyard (1.0.0) 1 | JComments Latest (3.0.4) 1 | General Boards (1.0.0) 1 |

Modules :: ADMIN ::
Core :: mod_latest (3.0.0) 1 | mod_multilangstatus (3.0.0) 1 | mod_version (3.0.0) 1 | mod_sampledata (3.8.0) 1 | mod_stats_admin (3.0.0) 1 | mod_login (3.0.0) 1 | mod_quickicon (3.0.0) 1 | mod_title (3.0.0) 1 | mod_submenu (3.0.0) 1 | mod_popular (3.0.0) 1 | mod_status (3.0.0) 1 | mod_custom (3.0.0) 1 | mod_menu (3.0.0) 1 | mod_privacy_dashboard (3.9.0) 1 | mod_feed (3.0.0) 1 | mod_latestactions (3.9.0) 1 | mod_toolbar (3.0.0) 1 | mod_logged (3.0.0) 1 |
3rd Party:: CloudAccess.net (1.0) 1 |

Libraries :: SITE ::
Core ::
3rd Party:: Regular Labs Library (19.3.16030) 1 |

Plugins :: SITE ::
Core :: plg_extension_joomla (3.0.0) 1 | plg_user_joomla (3.0.0) 1 | plg_user_contactcreator (3.0.0) 0 | plg_user_profile (3.0.0) 1 | plg_user_terms (3.9.0) 0 | plg_quickicon_privacycheck (3.9.0) 1 | plg_quickicon_phpversioncheck (3.7.0) 1 | plg_quickicon_joomlaupdate (3.0.0) 1 | plg_quickicon_extensionupdate (3.0.0) 1 | plg_authentication_joomla (3.0.0) 1 | plg_authentication_cookie (3.0.0) 1 | plg_authentication_ldap (3.0.0) 0 | plg_authentication_gmail (3.0.0) 0 | plg_captcha_recaptcha_invisible (3.8) 0 | plg_captcha_recaptcha (3.4.0) 0 | plg_search_categories (3.0.0) 1 | plg_search_contacts (3.0.0) 1 | plg_search_tags (3.0.0) 1 | plg_search_content (3.0.0) 1 | plg_search_newsfeeds (3.0.0) 1 | plg_privacy_user (3.9.0) 1 | plg_privacy_actionlogs (3.9.0) 1 | plg_privacy_consents (3.9.0) 1 | plg_privacy_message (3.9.0) 1 | plg_privacy_content (3.9.0) 1 | PLG_ACTIONLOG_JOOMLA (3.9.0) 1 | plg_fields_imagelist (3.7.0) 1 | plg_fields_calendar (3.7.0) 1 | plg_fields_editor (3.7.0) 1 | plg_fields_user (3.7.0) 1 | plg_fields_text (3.7.0) 1 | plg_fields_url (3.7.0) 1 | plg_fields_integer (3.7.0) 1 | plg_fields_textarea (3.7.0) 1 | plg_fields_sql (3.7.0) 1 | plg_fields_usergrouplist (3.7.0) 1 | plg_fields_media (3.7.0) 1 | plg_fields_color (3.7.0) 1 | plg_fields_repeatable (3.9.0) 1 | plg_fields_checkboxes (3.7.0) 1 | plg_fields_list (3.7.0) 1 | plg_fields_radio (3.7.0) 1 | plg_finder_categories (3.0.0) 0 | plg_finder_contacts (3.0.0) 0 | plg_finder_tags (3.0.0) 0 | plg_finder_content (3.0.0) 1 | plg_finder_newsfeeds (3.0.0) 0 | plg_editors-xtd_module (3.5.0) 0 | plg_editors-xtd_pagebreak (3.0.0) 1 | plg_editors-xtd_fields (3.7.0) 1 | plg_editors-xtd_readmore (3.0.0) 1 | plg_editors-xtd_menu (3.7.0) 1 | plg_editors-xtd_image (3.0.0) 1 | plg_editors-xtd_article (3.0.0) 1 | plg_content_loadmodule (3.0.0) 1 | plg_content_joomla (3.0.0) 1 | plg_content_pagenavigation (3.0.0) 1 | plg_content_vote (3.0.0) 0 | plg_content_emailcloak (3.0.0) 1 | plg_content_pagebreak (3.0.0) 1 | plg_content_fields (3.7.0) 1 | plg_content_finder (3.0.0) 1 | plg_content_confirmconsent (3.9.0) 1 | plg_twofactorauth_totp (3.2.0) 0 | plg_twofactorauth_yubikey (3.2.0) 0 | plg_system_updatenotification (3.5.0) 1 | PLG_SYSTEM_ACTIONLOGS (3.9.0) 1 | plg_system_sessiongc (3.8.6) 1 | plg_system_highlight (3.0.0) 1 | plg_system_log (3.0.0) 1 | plg_system_logrotation (3.9.0) 1 | plg_system_p3p (3.0.0) 0 | plg_system_languagefilter (3.0.0) 0 | plg_system_sef (3.0.0) 1 | plg_system_stats (3.5.0) 1 | plg_system_cache (3.0.0) 0 | plg_system_fields (3.7.0) 1 | plg_system_debug (3.0.0) 1 | plg_system_languagecode (3.0.0) 0 | plg_system_remember (3.0.0) 1 | plg_system_logout (3.0.0) 1 | plg_system_redirect (3.0.0) 0 | plg_system_privacyconsent (3.9.0) 0 | PLG_INSTALLER_URLINSTALLER (3.6.0) 1 | PLG_INSTALLER_FOLDERINSTALLER (3.6.0) 1 | plg_installer_packageinstaller (3.6.0) 1 |
3rd Party:: plg_user_jcomments (1.0) 1 | plg_quickicon_jcomments (1.0) 1 | PLG_AJAX_EXTRAVOTE (1.0) 1 | uddeIM Searchbot (4.0) 1 | plg_search_jcomments (1.0) 1 | plg_editors-xtd_jcommentson (1.0) 1 | plg_editors-xtd_modulesanywhere (7.8.1) 1 | plg_editors-xtd_jcommentsoff (1.0) 1 | DirectPHP (3.01) 0 | uddeIM Content Link (4.0) 1 | PLG_CONTENT_EXTRAVOTE (2.5.8) 1 | plg_content_jcomments (1.0) 1 | plg_editors_codemirror (5.40.0) 1 | plg_editors_tinymce (4.5.9) 1 | JComments - Avatar (4.1.8) 1 | uddeIM Hooks (4.0) 1 | plg_system_modulesanywhere (7.8.1) 1 | CloudPanel (5.0) 1 | plg_system_f90logout (1.0.0) 1 | plg_system_jcomments (1.0) 1 | plg_system_regularlabs (19.3.16030) 1 |
Templates Discovered :: wrote:Templates :: SITE :: plg_user_profile (3.0.0) 1 | protostar (1.0) 1 | plg_user_profile (3.0.0) 1 | CDXX (1.0) 1 | beez3 (3.1.0) 1 |
Templates :: ADMIN :: hathor (3.0.0) 1 | isis (1.0) 1 |
Last edited by toivo on Sat May 25, 2019 5:18 pm, edited 1 time in total.
Reason: mod note: disabled smilies in post Options for readability

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37259
Joined: Sat Apr 05, 2008 9:58 pm

Re: Keep getting permission error in JComments Report function

Post by Webdongle » Sat May 25, 2019 8:00 pm

Double check the settings for unregistered users of Jcomments. It could be that if they are not allowed to comment (or need to have comments authorised) that they are unable to report posts?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sat May 25, 2019 8:50 pm

It didn't seem like anything was wrong with the system. I've tried many combinations with the permissions and everyone's settings, no luck. I'm thinking i'll probably write some code around the link so a report will still be sent, kind of sucks the onboard function won't work.

This isn't the first time i've had a problem with usergroups btw, i tried to change the color of the usernames using groups and they would never change colors, had to separately do them with userids, and couldn't get the user's group to list in the profile module.

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sat May 25, 2019 9:56 pm

This is why this was posted on the coding board, if the code looks fine maybe i can change the code to do what i want. The error is coming from this section, and all i really need it to say is if 'guest' then give the error, everyone else should be able to send a report, not too concerned about the backend settings in this instance. Seems like i should be able to do that.

Code: Select all

if ($acl->canReport($comment)) {
	if ($acl->getUserId()) {
		$user = JFactory::getUser();
		$name = $user->name;
	} else {
		if (empty($name)) {
			$name = 'Guest'; // JText::_('Guest');
		}
	}

	$report = JTable::getInstance('Report', 'JCommentsTable');
	$report->commentid = $comment->id;
	$report->date = JFactory::getDate()->toSql();
	$report->userid = $acl->getUserId();
	$report->ip = $ip;
	$report->name = $name;
	$report->reason = $reason;

	$html = '';
	$result = JCommentsEventHelper::trigger('onJCommentsCommentBeforeReport', array(&$comment, &$report));

	if (!in_array(false, $result, true)) {
		if ($report->store()) {
				JCommentsEventHelper::trigger('onJCommentsCommentAfterReport', array(&$comment, $report));

			if ($config->getInt('enable_notification') == 1) {
				if ($config->check('notification_type', 2)) {
					JComments::sendReport($comment, $name, $reason);
				}
			}

			// unpublish comment if reports count is enough
			if ($maxReportsBeforeUnpublish > 0 && $reported >= $maxReportsBeforeUnpublish) {
				$comment->published = 0;
				$comment->store();
			}

			$html = JText::_('REPORT_SUCCESSFULLY_SENT');
			$html = str_replace("\n", '\n', $html);
			$html = str_replace('\n', '<br />', $html);
			$html = JCommentsText::jsEscape($html);
		}
	}
	$response->addScript("jcomments.closeReport('$html');");
} else {
	self::showErrorMessage(JText::_('ERROR_YOU_HAVE_NO_RIGHTS_TO_REPORT'), '', 'comments-report-form');
}

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37259
Joined: Sat Apr 05, 2008 9:58 pm

Re: Keep getting permission error in JComments Report function

Post by Webdongle » Sat May 25, 2019 11:26 pm

ERROR_YOU_HAVE_NO_RIGHTS_TO_REPORT
Suggests that you are missing language files for jcomments. The error is not Joomla ACL but with Jcomments. Either it has not installed correctly or something is wrong with the extension. Check that the jcomments
en-GB.com_jcomments.ini language file exists?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sun May 26, 2019 12:05 am

Yes it's there. I see the confusion, i get the error the correct way from the language file, i was pointing out the part of the code that's throwing the error. I agree it's jcomments, all the other settings work fine in this area except this one (that i've noticed), this is why i thought maybe something in the code wasn't jiving with one of the recent updates for J!. I just blacklisted an ip a couple of days ago and all the bbcode settings are fine since i see them working, just this report function is broken.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37259
Joined: Sat Apr 05, 2008 9:58 pm

Re: Keep getting permission error in JComments Report function

Post by Webdongle » Sun May 26, 2019 12:11 am

Have you reported it as a bug to Jcomments?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sun May 26, 2019 12:26 am

No, the forum was closed. I tried to go to where the developer posts on a russian joomla site for another issue i've since figured out, but the translation was so bad i don't think they understood the post. Would be nice i also need to figure out how to add a search function for pagination, just goes to page 1 and stops, i can't get into javascript for some reason.

From joomlatune:
Support

Dear visitors, due to too much spam our forum was closed. I apologize for the inconvenience. If you've any questions you can ask them on Joomla's forum.

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sun May 26, 2019 1:32 am

If possible maybe someone running newest version of both (Joomla! 3.9.6 & JComments 3.0.7) can test this to see if it is indeed a bug. Since i'm the only one i've seen post about it i'm thinking it must be something i did even though i've not changed anything related to reporting, but maybe it just hasn't been noticed yet. If everyone else's works fine then it's likely only a bug from something else i changed.

I'm testing with 3 different accounts, one from a phone, so i'm for some reason unsure if it's related to me reporting myself as i may have at some point used all 3 accounts on same ips. Hopefully that makes sense. ;)

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37259
Joined: Sat Apr 05, 2008 9:58 pm

Re: Keep getting permission error in JComments Report function

Post by Webdongle » Sun May 26, 2019 9:46 am

Tested it various php versions
No Avail cant even post a comment.

Suggest you find another comment system.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11161
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: Keep getting permission error in JComments Report function

Post by toivo » Sun May 26, 2019 11:19 am

Agree with @Webdongle. Managed to get JComments to work in PHP 7.1 but producing Deprecated messages. Does not work at all in PHP 7.3.
Toivo Talikka, Global Moderator

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sun May 26, 2019 12:25 pm

That's too bad, this was the best one for my needs since it had a tree view, and was fairly easy to customize. I'm running php 7.1.26 so probably why it works ok for me. How long until i won't be able to use that version anymore? I've put a bit of time into it.

That also isn't the first time i've heard that someone didn't care for the coding practices under the hood. Would be nice to have up someplace to fix as a project, i've made a pretty decent template for it so it has more of a forum look. I did go to the other jcomments version that was made for php 7.2 and tried that part of their code, same deal.

I'll likely play with that section and find the right case to go with, probably something similar but a little different to bypass the check for all but guests, a reorder maybe. Other than that i will just create a popup form or something maybe. Will post back if i get it working. Thanks.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 37259
Joined: Sat Apr 05, 2008 9:58 pm

Re: Keep getting permission error in JComments Report function

Post by Webdongle » Sun May 26, 2019 12:48 pm

php 7.1 is security fix only and then for no more than about 6 months

Try https://extensions.joomla.org/category/ ... -comments/
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Wed May 29, 2019 6:49 am

Webdongle wrote:
Sun May 26, 2019 12:48 pm
php 7.1 is security fix only and then for no more than about 6 months

Try https://extensions.joomla.org/category/ ... -comments/
What's interesting about that link is the thing you're telling me to replace is in the 2nd row, the 2nd free extension on the page, and has more ratings than anything else on the page with a 4.5/5. If you think about it that's a time bomb we apparently know will go off eventually leaving a lot of people wasting their time.

I tried updating to php 7.2 which was the highest version offered by host at the time and got a white screen that just said - Error, i don't think that was from JComments.

Is there a place where i can see these deprecated messages? I assume it's possible to just edit the code that's 'bad' to conform with higher versions of php.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11161
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: Keep getting permission error in JComments Report function

Post by toivo » Wed May 29, 2019 7:01 am

Set the level of error reporting in Global Configuration to 'Maximum'. The enable the plugin System - Debug and configure it, selecting to log 'almost everything'. Do your testing and download the log file administrator/logs/everything.log.
Toivo Talikka, Global Moderator

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Fri May 31, 2019 6:43 am

Thanks toivo, i got the deprecated errors i saw cleared up.

I arranged the code so that it works properly for users, as in guests get the error and has a sent report message for everyone else, it just doesn't notify me or mark anything on the comment in the backend. The only reason i know it's working is the reports are being added to the database, and no id column so will have to retrieve it from the code. Will probably just create a module only admin can see and display them there and send an email if i can't track down why it isn't doing what it's supposed to after the report is sent.

The more i think about it, i'm wondering if the developer didn't take this feature out himself and eliminate it on an update, another site i use this on with nothing done just out of the box isn't displaying a report link for some reason. I may have inadvertently activated the link without knowing it when i was building the template. Not sure.

Anyway, these are the changes up to this point from just the section from the 6th comment down above in case anyone is wondering, just rearranged and changed to a simpler case:

Code: Select all

$user = JFactory::getUser();

if ($user->guest) {
			self::showErrorMessage(JText::_('ERROR_YOU_HAVE_NO_RIGHTS_TO_REPORT'), '', 'comments-report-form'); 
} else {
		
	$name = $user->name;
						
	$report = JTable::getInstance('Report', 'JCommentsTable');
	$report->commentid = $comment->id;
	$report->date = JFactory::getDate()->toSql();
	$report->userid = $acl->getUserId();
	$report->ip = $ip;
	$report->name = $name;
	$report->reason = $reason;
	$html = '';
	$result = JCommentsEventHelper::trigger('onJCommentsCommentBeforeReport', array(&$comment, &$report));
	if (!in_array(false, $result, true)) {
		if ($report->store()) {
				JCommentsEventHelper::trigger('onJCommentsCommentAfterReport', array(&$comment, $report));
			if ($config->getInt('enable_notification') == 1) {
				if ($config->check('notification_type', 2)) {
					JComments::sendReport($comment, $name, $reason);
				}
			}
			// unpublish comment if reports count is enough
			if ($maxReportsBeforeUnpublish > 0 && $reported >= $maxReportsBeforeUnpublish) {
				$comment->published = 0;
				$comment->store();
			}
			$html = JText::_('REPORT_SUCCESSFULLY_SENT');
			$html = str_replace("\n", '\n', $html);
			$html = str_replace('\n', '<br />', $html);
			$html = JCommentsText::jsEscape($html);
		}
	}
	$response->addScript("jcomments.closeReport('$html');");
}

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 7498
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Keep getting permission error in JComments Report function

Post by sozzled » Fri May 31, 2019 6:55 am

CDXXonline wrote:
Sun May 26, 2019 12:25 pm
I did go to the other jcomments version that was made for php 7.2 ...
I've been using "the other version" of the JComments component—the forked version for PHP 7 (the version that actually works, v 3.0.7, with Google reCAPTCHA)—for about a year and have had no problems with it.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Fri May 31, 2019 7:04 am

I'll have to see if i can use it and transfer over the template. I just tried to update to php 7.3.3 and site wouldn't load, same with 7.2, had to go back to 7.1.27 (not 7.1.26 like i said before). I'm just unsure whether it's JComments or Joomla! that won't let me update.

Do you have report feature and is it working ok sozzled?

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 7498
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Keep getting permission error in JComments Report function

Post by sozzled » Fri May 31, 2019 7:19 am

"Report feature"? How do you get the "report feature"?

I can say, from travelling around the internet and interviewing dozens of happy J! campers, that J! runs fine on PHP 7.3. I can't say this from first-hand experience but everyone else tells me it's all good. If you're unsure about why the site doesn't load when you use PHP 7.3, please enable J! debug mode, set error reporting to maximum, check the last few entries in the file error_log in the site root folder, etc.

As far as PHP 7.1 is concerned, it's a dead duck.
Image

Yeah, PHP 7.1 may be "supported" for the next few months or so but, really, that doesn't mean has a future, does it? As I wrote before, I've been using PHP 7.2 for at least 12 months. I would love to use PHP 7.3 but my webhosting provider hasn't [yet] caught up with it. :D
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 7498
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Keep getting permission error in JComments Report function

Post by sozzled » Fri May 31, 2019 7:57 am

I don't know if I have it. I don't use it, that's for sure. Sorry. I don't know where this thing is.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Fri May 31, 2019 9:37 am

In a surprise twist, i updated the other site i have to php 7.3.3 and everything works fine. Jcomments posts no problem. This is what i get from the host error log from the one that won't update, these same 2 errors over and over. Couldn't figure anything out from the everything log.
[Fri May 31 05:26:38 2019] [warn] [client [ipredacted]] mod_fcgid: stderr: PHP Warning: mysqli_errno() expects parameter 1 to be mysqli, bool given in host/libraries/joomla/database/driver/mysqli.php on line 992
[Fri May 31 05:26:38 2019] [warn] [client [ipredacted]] mod_fcgid: stderr: PHP Warning: mysqli_error() expects parameter 1 to be mysqli, bool given in host/libraries/joomla/database/driver/mysqli.php on line 1004

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sat Jun 22, 2019 9:29 pm

Wanted to check back and let people know that just the change above took care of the problem. I had notifications turned off in the backend is why i wasn't being notified, turned on and worked great, plus you can filter by reported comments in the backend also i've noticed. They weren't being added to the database until i rearranged the code.

I've also figured out you can use

Code: Select all

$response->addScript("window.location.reload();");
to have it just refresh the screen after displaying certain messages, like adding comment, editing comment, deleting comment. Then the screen reloads instead of leaving the remnants of the comment process.

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 7498
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Keep getting permission error in JComments Report function

Post by sozzled » Sat Jun 22, 2019 9:40 pm

sozzled wrote:
Fri May 31, 2019 7:57 am
I don't know if I have it. I don't use it, that's for sure. Sorry. I don't know where this thing is.
CDXXonline wrote:
Sat Jun 22, 2019 9:29 pm
I had notifications turned off in the backend is why i wasn't being notified, turned on and worked great...
Ahh ... so you were talking about this feature:
jComents_report.png
No wonder I didn't understand the problem.
You do not have the required permissions to view the files attached to this post.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

CDXXonline
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 164
Joined: Fri Oct 13, 2017 8:00 pm

Re: Keep getting permission error in JComments Report function

Post by CDXXonline » Sat Jun 22, 2019 9:50 pm

Yes, but i had ability to report turned on, just notifications off, and it wasn't submitting the reports.


Post Reply

Return to “Extensions for Joomla! 3.x”