Login Issues & Fixes!

This is more of a "note to self" should I have this issue again.

When I first designeed the site I tested the user registration system and it worked just fine but this was before I added the K2 content manager and also before the latest version of reCaptcha. Up until now I really have had no need for user logins but now I have some special donor features available for downloading files upon donations I needed to implement a user management system for downloads and this is where I discovered the user registration system was busted. 

The issue was that I updated to the new "1 click - i'm not a robot" Captcha protection which is evident on contact forms and throughout the site but when I visited the registration page the old captcha element was displayed and I had no idea why this was. The issue was that when I entered in the result it would always fail with either "empty result" or "wrong text" 

After hours or testing and googling I finally tracked down the issue to be the fact K2 was enabled to allow user registrations and within K2 there is a separate captcha setup. All that was needed was to simply disable the use of the K2 captcha which then allowed the global captcha to be used. 

The joys of managing a friggin website!

Audio Players Flash/HTML5 for Joomla

The Freelance Soundlabs website is designed to be HTML5 compatible which means it does not rely purely on Flash for media playback. 

Mobile devices such as iPads and android tablets, smart phones and the likes require different methods for playing media files such as mp3 and video than desktop PCs. 

The biggest challenge I had was to find an audio player that would work with MP3 files on all platforms and browsers. I spent months testing and contacting developers and even lost some money on useless solutions. 

In the end there were 2 clear winners for players which I will use throughout the site:

Joomla K2 Comment Notification Hack

The website content (articles, categories, comments etc) are all part of the "K2" system installed on the site. This is an "advanced" article management system that adds a heap of extra features over the standard way Joomla manages articles on the site. All the lists and layout for the articles you read (including this one) are managed by this Joomla component. 

As with most things when designing a website, there is not a "1 solution fits all" and there have been some problems to overcome which is why it takes sooooo long to get everything going. 

The Issue

One issue I discovered about this K2 system is the comment feature at the end of articles which allow visitors to leave their comments does not notify the web administrator (me) of new comments. This seems strange to me since most other comment systems I have tested have this as a basic feature.

Jcomments for instance has not only this feature but also the ability to delete comments or edit them directly from the email sent which means if someone posts a spam or offensive comment it can be removed in minutes just using my phone.

I wanted the integrated feature of the K2 comment system and simply wanted to know if a user has posted comments to an article and know the contents of what they posted. It appeared the only "plugin" solution would cost $20 and considering the K2 framework component was free it seemed a bit of a ripoff for a single simple feature.

The Hack Fix

I spent some time researching solutions and came over a posted hack that allowed a notification to be sent if you had comments NOT set to auto-publish. I wanted user comments to publish automatically so after some messing around I managed to create a simple solution that will send the following email:

 


 

 From Freelance Soundlabs

To This email address is being protected from spambots. You need JavaScript enabled to view it.
Date Today 10:54
Priority Normal


New User Comment Posted:
Name: test
Email: This email address is being protected from spambots. You need JavaScript enabled to view it.
Website: www.testwebsite.com
comment: This is a test comment with some words that say things to make up the volume of the message body so there is something in the damn message!!!

 


 

This will be sent whenever someone publishes a comment and has all the info to decide if it is a genuine comment or spam to be actioned. The email it is sent too is the email set in the K2 parameters for the Comment Reporting email where users can report comments to the admin. 

This hack requires editing a file and will require this edit to be redone if the component is updated so it is not a perfect solution but a workable one. To apply it to your site follow these steps:

1. Open the file: components/com_k2/models/item.php
2. Search in the file for the line that contains: K2_COMMENT_ADDED_REFRESHING_PAGE
3. Directly above that line paste the following chunk of code:

$mainframe = &JFactory::getApplication();
$mail = &JFactory::getMailer();
$senderEmail = $mainframe->getCfg('mailfrom');
$senderName = $mainframe->getCfg('fromname');
$mail->setSender(array($senderEmail, $senderName));
$mail->setSubject(JText::_('K2_NEW_COMMENT'));
$mail->IsHTML(true);
$body = "
".JText::_('New User Comment Posted').":

".JText::_('K2_NAME').": ".$userName."

".JText::_('K2_EMAIL').": ".$commentEmail."

".JText::_('K2_WEBSITE').": ".$commentURL."

".JText::_('K2_COMMENT').": ".nl2br($row->commentText)."
";
$mail->setBody($body);
$mail->ClearAddresses();
$mail->AddAddress($params->get('commentsReportRecipient', $mainframe->getCfg('mailfrom')));
$mail->Send();


Make sure you have an email set in the K2 parameters/comments section for comment reports.

Test by posting a new comment and you should receive an email. 

If you want to set an email for comments to be "approved" then do exactly the same as above but search for the code: K2_COMMENT_ADDED_AND_WAITING_FOR_APPROVAL

The only extra information I would love to include in the message would be the article the comment was posted too. I am not an expert in this stuff so I am not sure but maybe a Joomla expert will help me out one day. For now, this works just fine.

 

 

 

Go to top