tag:blogger.com,1999:blog-43158697768925140532024-03-12T19:28:13.915-07:00Joomla HaxGXIhttp://www.blogger.com/profile/06086803555651602200noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4315869776892514053.post-85798925097453399992010-02-02T12:54:00.001-08:002010-02-02T12:59:08.562-08:00HOW TO: Allow users to delete their own forum posts! [kunena & Joomla]Enjoy!<br />
<br />
1: post.php (/components/com_kunena/template/default/)<br />
<br />
1.1) Find:<br />
<br />
[code]<br />
else if ($do == "deletepostnow")<br />
{<br />
<br />
if (!$is_Moderator)<br />
[/code]<br />
<br />
1.2) Change to:<br />
<br />
[code]<br />
else if ($do == "deletepostnow")<br />
{<br />
$modified_reason = addslashes(mosGetParam($_POST, "modified_reason", null));<br />
$modified_by = $my->id;<br />
$modified_time = CKunenaTools::fbGetInternalTime();<br />
$id = (int) $id;<br />
<br />
$database->setQuery("SELECT * FROM #__fb_messages LEFT JOIN #__fb_messages_text ON #__fb_messages.id=#__fb_messages_text.mesid WHERE #__fb_messages.id=$id");<br />
$message1 = $database->loadObjectList();<br />
check_dberror("Unable to load messages.");<br />
$mes = $message1[0];<br />
$userid = $mes->userid;<br />
<br />
//Check for a moderator or superadmin<br />
if ($is_Moderator) {<br />
$allowEdit = 1;<br />
}<br />
<br />
if ($fbConfig->useredit == 1 && $my->id != "")<br />
{<br />
//Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit<br />
if ($my->id == $userid) {<br />
if(((int)$fbConfig->useredittime)==0) {<br />
$allowEdit = 1;<br />
}<br />
else {<br />
$modtime = $mes->modified_time;<br />
if(!$modtime) {<br />
$modtime = $mes->time;<br />
}<br />
if(($modtime + ((int)$fbConfig->useredittime) + ((int)$fbConfig->useredittimegrace)) >= CKunenaTools::fbGetInternalTime()) {<br />
$allowEdit = 1;<br />
}<br />
}<br />
}<br />
}<br />
<br />
if (!$allowEdit == 1)<br />
[/code]<br />
<br />
1.1.1) Find:<br />
<br />
[code]<br />
else if ($do == "delete")<br />
{<br />
<br />
if (!$is_Moderator)<br />
[/code]<br />
<br />
1.1.2) Change to:<br />
<br />
[code]<br />
else if ($do == "delete")<br />
{<br />
$modified_reason = addslashes(mosGetParam($_POST, "modified_reason", null));<br />
$modified_by = $my->id;<br />
$modified_time = CKunenaTools::fbGetInternalTime();<br />
$id = (int) $id;<br />
<br />
$database->setQuery("SELECT * FROM #__fb_messages LEFT JOIN #__fb_messages_text ON #__fb_messages.id=#__fb_messages_text.mesid WHERE #__fb_messages.id=$id");<br />
$message1 = $database->loadObjectList();<br />
check_dberror("Unable to load messages.");<br />
$mes = $message1[0];<br />
$userid = $mes->userid;<br />
<br />
//Check for a moderator or superadmin<br />
if ($is_Moderator) {<br />
$allowEdit = 1;<br />
}<br />
<br />
if ($fbConfig->useredit == 1 && $my->id != "")<br />
{<br />
//Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit<br />
if ($my->id == $userid) {<br />
if(((int)$fbConfig->useredittime)==0) {<br />
$allowEdit = 1;<br />
}<br />
else {<br />
$modtime = $mes->modified_time;<br />
if(!$modtime) {<br />
$modtime = $mes->time;<br />
}<br />
if(($modtime + ((int)$fbConfig->useredittime) + ((int)$fbConfig->useredittimegrace)) >= CKunenaTools::fbGetInternalTime()) {<br />
$allowEdit = 1;<br />
}<br />
}<br />
}<br />
}<br />
<br />
if (!$allowEdit == 1)<br />
[/code]<br />
<br />
2: message.php (/components/com_kunena/template/default_ex/) * NB: default_ex must be the template you are using)<br />
<br />
2.1) Find:<br />
<br />
[code]<br />
if ($msg_edit) {<br />
echo " | " . $msg_edit;<br />
[/code]<br />
<br />
2.2) Change to:<br />
<br />
[code]<br />
if ($msg_edit) {<br />
echo " | " . $msg_edit;<br />
echo " | " . $msg_delete;<br />
[/code]<br />
<br />
3: view.php (/components/com_kunena/template/default_ex/) * NB: default_ex must be the template you are using)<br />
<br />
3.1) Find:<br />
<br />
[code]<br />
if($allowEdit)<br />
{<br />
$msg_edit = CKunenaLink::GetTopicPostLink('edit', $catid, $fmessage->id , $fbIcons['edit']?'<img src="' . KUNENA_URLICONSPATH . $fbIcons['edit'] . '" alt="Edit" border="0" title="' . _VIEW_EDIT . '" />':_GEN_EDIT);<br />
<br />
[/code]<br />
<br />
3.2) Change to:<br />
<br />
[code]<br />
if($allowEdit)<br />
{<br />
$msg_delete = CKunenaLink::GetTopicPostLink('delete', $catid, $fmessage->id , $fbIcons['delete']?'<img src="' . KUNENA_URLICONSPATH . $fbIcons['delete'] . '" alt="Delete" border="0" title="' . _VIEW_DELETE . '" />':_GEN_DELETE);<br />
$msg_edit = CKunenaLink::GetTopicPostLink('edit', $catid, $fmessage->id , $fbIcons['edit']?'<img src="' . KUNENA_URLICONSPATH . $fbIcons['edit'] . '" alt="Edit" border="0" title="' . _VIEW_EDIT . '" />':_GEN_EDIT);<br />
<br />
[/code]GXIhttp://www.blogger.com/profile/06086803555651602200noreply@blogger.com0tag:blogger.com,1999:blog-4315869776892514053.post-20232704642253796502009-12-20T04:07:00.000-08:002009-12-20T04:07:47.314-08:00Link Building TipHere is a simple TIP I am using for my link building.<br />
<br />
Common practise in link building is the exchanging of links A.K.A Reciprocal links, however too many reciprocal links can damage your own Page Rank. I have created a links page on one of my websites and am using a meta tag to stop that page from being indexed by search engines:<br />
<br />
To prevent all robots from indexing a page on your site, place the following meta tag into the section of your page:<br />
<br />
< meta content="noindex" name="robots">< /meta><br />
<br />
To allow other robots to index the page on your site, preventing only Google's robots from indexing the page:<br />
<br />
< meta content="noindex" name="googlebot">< /meta><br />
<br />
<a href="http://www.google.com/support/webmasters/bin/answer.py?answer=93710">http://www.google.com/support/webmasters/bin/answer.py?answer=93710</a>GXIhttp://www.blogger.com/profile/06086803555651602200noreply@blogger.com0tag:blogger.com,1999:blog-4315869776892514053.post-77937672739357955002009-12-17T23:58:00.000-08:002009-12-18T00:00:57.984-08:00Joomla 1.5 Community Builder and Virtuemart auto user sync######## Solution 1: (Just cron job) ########<br /><br />Example:<br /><br />DB Username: username<br />DB Password: password<br />Database name: database<br />Host: cmysql5-1.host.com<br />Port: 3306<br />NB: change jos_ if you are using an alternative prefix e.g. joom_<br />Note: The info below goes into your “Command” line, you need to configure how often you want to run the cron job in the cron job settings while scheduling/setting up the cron job. For more info on setting up your cron job please contact your website host or go to our support forum: http://gxi.co.za/webmaster-forum.html<br /><br />// SIMPLE:<br /><br />Use this if your sql host is “localhost” (default in most cases)<br /><br />mysql -uusername -ppassword database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";<br /><br />e.g (will run every hour):<br /><br />* */1 * * * mysql -uusername -ppassword database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";<br /><br />// ADVANCED:<br /><br />Use this if your sql host is not “localhost” and you need to enter a host address and port (cmysql5-1.host.com: 3306 etc)<br /><br />mysql -uusername -ppassword -hcmysql5-1.host.com -P3306 database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";<br /><br />e.g (will run every hour):<br /><br />* */1 * * * mysql -uusername -ppassword -hcmysql5-1.host.com -P3306 database -e "INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users";<br /><br />--------------------------------------------------------------------------<br /><br />######## Solution 2: (Cron job + File) ########<br /><br />Create a PHP file somewhere with the following information (be sure to correct to your database settings), when you setup you crone job ensure you include the full path i.e.<br /><br />* */1 * * * php /full/path/to/script.php<br /><br />The PHP file must contain:<br /><br />< ?php<br /><br />$server = 'localhost';<br />$username = 'mysql_username';<br />$password = 'mysql_password';<br />$database = 'mysql_database_name';<br /><br />### connects to the database, or dies with error<br />$connection = mysql_connect($server,$username,$password);<br />if (!$connection)<br />{<br />die( mysql_error() );<br />}<br /><br />### selects the db of choice, or dies with error<br />$db_selection = mysql_select_db($database, $connection);<br />if (!$db_selection)<br />{<br />die( mysql_error() );<br />}<br /><br />### selects all tables in the db of choice, or dies with error<br />$alltables = mysql_query("SHOW TABLES") or die ( mysql_error() );<br /><br />### loops through all of the tables and optimizes each, or dies with error<br />while ( $table = mysql_fetch_array($alltables) )<br />{<br />mysql_query("INSERT IGNORE INTO jos_comprofiler(id,user_id) SELECT id,id FROM jos_users") or die( mysql_error() );<br />}<br /><br />### closes the mysql connection<br />mysql_close($connection);<br /><br />?>GXIhttp://www.blogger.com/profile/06086803555651602200noreply@blogger.com0tag:blogger.com,1999:blog-4315869776892514053.post-8867052529421781382009-12-17T17:31:00.000-08:002009-12-17T23:51:45.203-08:00Joomla 1.5 & 1.0 - Specific modules/script based on URL (PHP Hack)The "%" in <%script src='XXXXX' type='text/javascript'><%/script> is simply there to show this code but would be removed<br /><br /><blockquote>< ?php<br /> $currentpage = $_SERVER['REQUEST_URI'];<br /> if($currentpage=="/" || $currentpage=="/index.php" || $currentpage=="" ) {<br /> echo "<%script src='XXXXX' type='text/javascript'><%/script>";<br /> } else {<br /> echo "";<br /> };<br />?></blockquote><br /><br />This will show your script on http://yourdomain.com/ , http://yourdomain.com/index.php and http://yourdomain.com . And will not show this on any other page.<br /><br />The first echo ""; will be what is shown on these pages (Your script/module) and the second echo ""; will be what is shown on all the other pages (In this case nothing)<br /><br />You can change ($currentpage=="/" || $currentpage=="/index.php" || $currentpage=="" ) to represent your pages.<br /><br />You can change <%script src='XXXXX' type='text/javascript'><%/script> to <jdoc:include type="modules" name="special"/> to load module position special (Joomla 1.5)GXIhttp://www.blogger.com/profile/06086803555651602200noreply@blogger.com0tag:blogger.com,1999:blog-4315869776892514053.post-55042974424438378332009-12-17T16:05:00.000-08:002009-12-17T16:15:57.801-08:00Joomla 1.5 eWeather - Show the Forecast City in TitleJoomla 1.5 eWeather<br /><br />How to show the forecast city in title of the of the page instead of the component / link name.<br /><br />For example on the distribution websites demo: http://www.robertjlavey.com/index.php?option=com_eweather&Itemid=9<br /><br />You will see the page title is eWeather with no reference to the weather conditions in "Siloam Springs, AR"<br /><br />To correct this you will need to edit the components/com_eweather/eweather.html.php<br /><br />Find the following 2 lines:<br /><br /><blockquote> function displayWeather(&$weather, $weatherIconStyle){<br /> $url = JUri::base(true);</blockquote><br /><br />Directly under these 2 lines you need to add:<br /><br /><blockquote> $document =& JFactory::getDocument();<br /> $document->setTitle($weather->loc_city);</blockquote><br /><br />It will now look like:<br /><br /><blockquote> function displayWeather(&$weather, $weatherIconStyle){<br /> $url = JUri::base(true);<br /> $document =& JFactory::getDocument();<br /> $document->setTitle($weather->loc_city);<br /></blockquote>GXIhttp://www.blogger.com/profile/06086803555651602200noreply@blogger.com0