Wondering to add Javascript snippet in Joomla article. Here is the easiest way to add.
Goto Joomla Administrator -> site -> Global Configuration.
Select Editor - TinyMCE 2.0 as Default WYSIWYG Editor & save it.
that's it you are now free to write javascript code in articles.
Don't try to change above setting otherwise you will lose Javascript code from joomla article. It worked for me with Joomla 1.5 version.
Somewhere i read following lines but it won't help me at all cause it adds extra tags like mce_href & it changed the code according to it's structure which is nonsense(but it just make sure that your JS code wont lose if you change above settings).
Go to plugin manager & click on tiny TinyMCE 2.0
Go to plugin parameters
select "never" to Code cleanup on save option & save it.
I suggest use this method only when there is no preference to use editor other than TinyMCE. Otherwise you need to find a plugin from joomla extensions.
Friday, November 4, 2011
Wednesday, October 19, 2011
How to override Jomsocial Controller
If you already override jomsocial template files then don't think that in same way you can override controller as well.
Before talking about how to override Jomsocial Controller, lets see why we need to override controller. If you hack the core files directly & made changes as you want. After some day when you upgrade jomsocial then those changes from the hacked files will be removed & then again you have to hack the core files. So this is very tedious task to check which file & what code you have hacked. Solution on hacking is obviously you have to override controller.
To override jomsocial controller you need a plugin which will override controller. In this plugin we just replace default controller object with our own custom class.
Before the system controller is created. Plugin may override the controller class name.
Plugin should contain following code.
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
require_once( JPATH_SITE .'/components/com_community/libraries/core.php');
require_once( JPATH_SITE .'/components/com_community/controllers/mybulletin.php');
class plgCommunityMybulletin extends CApplications
{
function plgCommunityMybulletin(& $subject, $config){
parent::__construct($subject, $config);
}
function onBeforeControllerCreate( &$controllerClassName )
{
$view = JRequest::getVar('view');
if($view == 'groups') {
$controllerClassName = 'MybulletinController'; // MybulletinController is class name which extends in your controller
return true;
}
return false;
}
}
Lets see the how to create controller.
If you wanna override groups controller then copy that file & paste it in the same folder(com_community/controller). Rename that file with what you have mentioned in plugin($controllerClassName value). In this case i rename that file with mybulletin.php & do changes as you want. Just make sure that you have added following line at the top of the file.
jimport ('joomla.application.component.controller');
require_once (COMMUNITY_COM_PATH.DS.'controllers'.DS.'controller.php');
To off email on bulletin creation i did override jomsocial group controller. You can find plugin & controller files here & make changes as you want.
Before talking about how to override Jomsocial Controller, lets see why we need to override controller. If you hack the core files directly & made changes as you want. After some day when you upgrade jomsocial then those changes from the hacked files will be removed & then again you have to hack the core files. So this is very tedious task to check which file & what code you have hacked. Solution on hacking is obviously you have to override controller.
To override jomsocial controller you need a plugin which will override controller. In this plugin we just replace default controller object with our own custom class.
Before the system controller is created. Plugin may override the controller class name.
Plugin should contain following code.
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
require_once( JPATH_SITE .'/components/com_community/libraries/core.php');
require_once( JPATH_SITE .'/components/com_community/controllers/mybulletin.php');
class plgCommunityMybulletin extends CApplications
{
function plgCommunityMybulletin(& $subject, $config){
parent::__construct($subject, $config);
}
function onBeforeControllerCreate( &$controllerClassName )
{
$view = JRequest::getVar('view');
if($view == 'groups') {
$controllerClassName = 'MybulletinController'; // MybulletinController is class name which extends in your controller
return true;
}
return false;
}
}
Lets see the how to create controller.
If you wanna override groups controller then copy that file & paste it in the same folder(com_community/controller). Rename that file with what you have mentioned in plugin($controllerClassName value). In this case i rename that file with mybulletin.php & do changes as you want. Just make sure that you have added following line at the top of the file.
jimport ('joomla.application.component.controller');
require_once (COMMUNITY_COM_PATH.DS.'controllers'.DS.'controller.php');
To off email on bulletin creation i did override jomsocial group controller. You can find plugin & controller files here & make changes as you want.
Monday, October 3, 2011
Jomsocial Group Bulletin email off
Working on one of the sport site developed in Joomla, as usual Jomsocial is installed. Client requirement was that he didn't want to get email when users of the site created jomsocial group bulletin. Its jomsocial's default behavior that it sends mail to all member of the group when group bulletin created. I made the correct change in a correct file after spending couple of hours.
If you want to off the mail of group bulletin creation then you need to override Jomsocial group controller. Well you can't override the jomsocial controller file so easily as you override template file.
To know more about how to override jomsocial controller you need to wait for my new post.
Go to the components->com_community->controller->groups.php file & comment the lines from line no. 3014 to 3024. Make sure these line contains the following code.
/*
$model =& $this->getModel( 'groups' );
$memberCount = $model->getMembersCount($groupId);
$members = $model->getMembers($groupId, $memberCount , true , false , SHOW_GROUP_ADMIN );
$membersArray = array();
foreach($members as $row)
{
$membersArray[] = $row->id;
}
unset($members);
*/
After that Jomsocial won't send email to members of the group when member creates bulletin for the group. However this worked for me for Jomsocial 2.2.4 version. I am not sure whether it works for other versions for that you need to just make sure where the above code is & i guess it won't be a big deal.
Note :- Don't waste your time to search back-end option to make jomsocial group bulletin off.
If you want to off the mail of group bulletin creation then you need to override Jomsocial group controller. Well you can't override the jomsocial controller file so easily as you override template file.
To know more about how to override jomsocial controller you need to wait for my new post.
Go to the components->com_community->controller->groups.php file & comment the lines from line no. 3014 to 3024. Make sure these line contains the following code.
/*
$model =& $this->getModel( 'groups' );
$memberCount = $model->getMembersCount($groupId);
$members = $model->getMembers($groupId, $memberCount , true , false , SHOW_GROUP_ADMIN );
$membersArray = array();
foreach($members as $row)
{
$membersArray[] = $row->id;
}
unset($members);
*/
After that Jomsocial won't send email to members of the group when member creates bulletin for the group. However this worked for me for Jomsocial 2.2.4 version. I am not sure whether it works for other versions for that you need to just make sure where the above code is & i guess it won't be a big deal.
Note :- Don't waste your time to search back-end option to make jomsocial group bulletin off.
Saturday, September 17, 2011
Please wait while loading image - JavaScript

Today wanted add loading please wait kind of image when user click on likedin button from one of the page of site. Actually when user click on linkedin image it takes time to redirect from site to linkedin log-in. Between this time wanted to show an loading image so that user will get something is happening need to wait for a moment. So initially i thought to use many images & use them with time function it will work as i wanted. First googled to get some ready made script but i didn't get exactly. Later got this link which solved my problem so frequently that i never thought. Just went to that site, chosen the type of image i wanted & called that image in div tag & made that div style block on onClick event. That's it so simple & looks great.
Check the code which is pretty simple.
<scrip>
function showimage()
{
document.geElementById('showloadingimg').style.display = "block";
}
</script>
<a href='link to redirect' onClick="showimage()"><img src="image path" /> </a>
<div id="showloadingimg" style="display: none"><img src="here is path of that downloaded image" />
</div>
Thursday, September 8, 2011
How & when to use DBkiss.php
Working on Joomla site & don't have Cpanel details to access phpmyadmin. Don't want to waste time to get C-panel details. Don't worry here is the solution & that is DBKiss. Its just a php file which allows you to access database. Interface is not to good as compared to phpmyadmin but it works faster than phpmyadmin.
If you google you will get dbkiss.php easily, you can find it here as well. Just paste this php file into the root folder & open it in browser. Now submit the database details from configuration.php file. If you submit details correctly, you will get database access. Its not necessary to have Joomla based site for DBKiss.
I personally think if you have phpmyadmin access then its nonsense to use DBKiss. This is from developers point of view.
Now if you want to give database access someone without sharing C-panel details then you can suggest that person to use DBKiss.
Saturday, September 3, 2011
JUser::_load: Unable to load user with id jomsocial shSEF404 joomla
Installed jomosocial & ShSEF404 components on Joomla site & getting "JUser::_load: Unable to load user(userid)" error, when you view some jomsocial profiles on site.
To solve this issue i did following things hope it will work in your case too.
Go to sh404SEF -> Control panel -> Url Manager.
Search the Jomsocial username's for which you are getting this problem. You can search one username at a time it will be more diffcult if you encounter this problem with large number of profiles.
You will get the list of url related to that profile, look at 'Duplicates' column. Remove those rows where you can see the duplicate values.
Go to the frontend do hard refresh & error will be disabled.
Writtng this post specifically cause if you googled this errror you get most of the nonsense things & waste time while doing that things as i did.
To solve this issue i did following things hope it will work in your case too.
Go to sh404SEF -> Control panel -> Url Manager.
Search the Jomsocial username's for which you are getting this problem. You can search one username at a time it will be more diffcult if you encounter this problem with large number of profiles.
You will get the list of url related to that profile, look at 'Duplicates' column. Remove those rows where you can see the duplicate values.
Go to the frontend do hard refresh & error will be disabled.
Writtng this post specifically cause if you googled this errror you get most of the nonsense things & waste time while doing that things as i did.
Friday, August 12, 2011
Jomsocial checkbox, radio buttons tooltip & validation bugs & solution
Have Joomla site?
Installed Jomsocial Component?
Created checkboxes or radio buttons using custom fields?
Suffering from checkboxes & radio buttions tooptip & Validatation of these fields wokring after submitting form(basically functionality should be to have alertbx with error message like other inputs). Then you must read this post & follow all the steps.
These are the Jomsocial bugs. You can find these bugs in latest verison(2.2.4) also don't know why these guys haven't sorted out yet. We were suffering from this problem for 2Lush cru site. We told client its Jomsocial bug but as usual, he was not ready to accept & told to do whatever to solve these issues. I know, this issue was in PMS from last 1-2 months no one was able to solve it.
If you want to sort out these bugs the you need to hack the jomsocial files cause you can't override these files which you need modified. Dont worry it won't affect your jomsocial at all.
To remove empty tooltips from check box fields.
go to file components/com_community/libraries/fields/checkbox.php
line no. 36
$cclass = ($field->required == 1) ? ' required validate-custom-checkbox' : '';
line no. 60
Change only class name
$html .= 'input type="checkbox" name="field' . $field->id . '[]" value="' .
$option . '"' . $selected . ' class="checkbox '.$class.'" style="margin: 0 5px
5px 0;" />';
change to
$html .= 'input type="checkbox" name="field' . $field->id . '[]" value="' .
$option . '"' . $selected . ' class="checkbox '.$cclass.'" style="margin: 0 5px
5px 0;" />';
Validation of checkbox
line no. 44
$class = !empty( $field->tips ) ? 'jomTips tipRight' : '';
change to
$class .= !empty( $field->tips ) ? ' jomTips tipRight' : '';
public_html/components/com_community/libraries/fields/radio.php
Same for radio button validation
go to the file components/com_community/libraries/fields/radio.php
Just update file as above.
Installed Jomsocial Component?
Created checkboxes or radio buttons using custom fields?
Suffering from checkboxes & radio buttions tooptip & Validatation of these fields wokring after submitting form(basically functionality should be to have alertbx with error message like other inputs). Then you must read this post & follow all the steps.
These are the Jomsocial bugs. You can find these bugs in latest verison(2.2.4) also don't know why these guys haven't sorted out yet. We were suffering from this problem for 2Lush cru site. We told client its Jomsocial bug but as usual, he was not ready to accept & told to do whatever to solve these issues. I know, this issue was in PMS from last 1-2 months no one was able to solve it.
If you want to sort out these bugs the you need to hack the jomsocial files cause you can't override these files which you need modified. Dont worry it won't affect your jomsocial at all.
To remove empty tooltips from check box fields.
go to file components/com_community/libraries/fields/checkbox.php
line no. 36
$cclass = ($field->required == 1) ? ' required validate-custom-checkbox' : '';
line no. 60
Change only class name
$html .= 'input type="checkbox" name="field' . $field->id . '[]" value="' .
$option . '"' . $selected . ' class="checkbox '.$class.'" style="margin: 0 5px
5px 0;" />';
change to
$html .= 'input type="checkbox" name="field' . $field->id . '[]" value="' .
$option . '"' . $selected . ' class="checkbox '.$cclass.'" style="margin: 0 5px
5px 0;" />';
Validation of checkbox
line no. 44
$class = !empty( $field->tips ) ? 'jomTips tipRight' : '';
change to
$class .= !empty( $field->tips ) ? ' jomTips tipRight' : '';
public_html/components/com_community/libraries/fields/radio.php
Same for radio button validation
go to the file components/com_community/libraries/fields/radio.php
Just update file as above.
Subscribe to:
Posts (Atom)
