OS Property support center
Expired Properties UnApproved, need UnPublished
- cmtrig
-
Topic Author
- Offline
- Senior Member
-
Less
More
11 years 10 months ago - 11 years 10 months ago #32265
by cmtrig
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Expired Properties UnApproved, need UnPublished was created by cmtrig
Hi Dam,
I have OSProperty set to Auto Approve properties added by Agents. Works great.
When the property expires, it unapproves the property. Unfortunately, Agents cannot re-approve the property if they want to. I want to change the Function in listing.php to unpublish a property instead ot unapproving it. I believe I have the SQL query to do this:
$db->setQuery("Update #__osrs_properties set published = '0' where id = '$id'");
Not sure where to put it. Thanks in advance!
Either that, or just give Agents the ability to Approve and / or Publish a property in the Agent Listings...
I have OSProperty set to Auto Approve properties added by Agents. Works great.
When the property expires, it unapproves the property. Unfortunately, Agents cannot re-approve the property if they want to. I want to change the Function in listing.php to unpublish a property instead ot unapproving it. I believe I have the SQL query to do this:
$db->setQuery("Update #__osrs_properties set published = '0' where id = '$id'");
Not sure where to put it. Thanks in advance!
Either that, or just give Agents the ability to Approve and / or Publish a property in the Agent Listings...
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Last edit: 11 years 10 months ago by cmtrig.
Please Log in or Create an account to join the conversation.
- Mr. Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13023
- Thank you received: 1688
11 years 10 months ago #32284
by Mr. Dam
Replied by Mr. Dam on topic Re: Expired Properties UnApproved, need UnPublished
Hi,
if you are using expiration feature of OS Property. You can check the file cron.php
in that file, we have php function checklist, it will unapprove and unpublish all the expired properties.
Good luck
Dam
if you are using expiration feature of OS Property. You can check the file cron.php
in that file, we have php function checklist, it will unapprove and unpublish all the expired properties.
Good luck
Dam
Please Log in or Create an account to join the conversation.
- cmtrig
-
Topic Author
- Offline
- Senior Member
-
11 years 10 months ago #32310
by cmtrig
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Replied by cmtrig on topic Re: Expired Properties UnApproved, need UnPublished
Thanks, I'll try it and let you know.
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Please Log in or Create an account to join the conversation.
- cmtrig
-
Topic Author
- Offline
- Senior Member
-
11 years 10 months ago - 11 years 10 months ago #32397
by cmtrig
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Replied by cmtrig on topic Re: Expired Properties UnApproved, need UnPublished
I added this line to he //unapproved section of the Cron.php file:
That should do it.
Code:
$db->setQuery("Update #__osrs_properties set published = '0' where id = '$row->pid'");
$db->query();
That should do it.
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Last edit: 11 years 10 months ago by cmtrig.
Please Log in or Create an account to join the conversation.
- cmtrig
-
Topic Author
- Offline
- Senior Member
-
11 years 10 months ago - 11 years 10 months ago #32398
by cmtrig
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Replied by cmtrig on topic Re: Expired Properties UnApproved, need UnPublished
Dam, I still have one little issue - when the Cron.php removes the property from the Database, how can I get it to also add a +1 to the nproperties of the Agent? The problem I see is selecting the Agent of the property, not the current user. Then I can update the osrs_agent_account table of the Agent. Any suggestions?
see this thread: www.joomdonation.com/84-os-property/3216...r-of-properties.html
see this thread: www.joomdonation.com/84-os-property/3216...r-of-properties.html
Charlie Trig, Trig Web Design
www.trigwebdesign.com
Last edit: 11 years 10 months ago by cmtrig.
Please Log in or Create an account to join the conversation.
- Mr. Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13023
- Thank you received: 1688
11 years 10 months ago #32411
by Mr. Dam
Replied by Mr. Dam on topic Re: Expired Properties UnApproved, need UnPublished
In the cron.php
this code is used to remove properties out of database
$query = "Select a.* from #__osrs_expired as a"
." inner join #__osrs_properties as b on b.id = a.pid"
." where a.remove_from_database < '$current_date'"
." and a.pid not in (Select pid from #__osrs_queue where `emailtype` = 3)";
$db->setQuery($query);
$rows = $db->loadObjectList();
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){
$row = $rows[$i];
$db->setQuery("Delete from #__osrs_properties where id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_expired where pid ='$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_queue where pid = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_field_value where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_amenities where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Select * from #__osrs_photos where pro_id = '$row->pid'");
$photos = $db->loadObjectList();
if(count($photos) > 0){
for($j=0;$j<count($photos);$j++){
$photo = $photos[$j];
$image_path = JPATH_ROOT.DS."components".DS."com_osproperty".DS."images".DS."properties";
@unlink($image_path.DS.$photo->image);
@unlink($image_path.DS."medium".DS.$photo->image);
@unlink($image_path.DS."thumb".DS.$photo->image);
}
}
$db->setQuery("Delete from #__osrs_photos where pro_id = '$row->pid'");
$db->query();
}
}
You can intervene into above code to get the agent_id and +1 again his(her) account
$query = "Select a.* from #__osrs_expired as a"
." inner join #__osrs_properties as b on b.id = a.pid"
." where a.remove_from_database < '$current_date'"
." and a.pid not in (Select pid from #__osrs_queue where `emailtype` = 3)";
$db->setQuery($query);
$rows = $db->loadObjectList();
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){
$row = $rows[$i];
$db->setQuery("Select agent_id from #__osrs_properties where id = '$row->id'");
$agent_id = $db->loadResult();
//process to add 1 property again ...
$db->setQuery("Delete from #__osrs_properties where id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_expired where pid ='$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_queue where pid = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_field_value where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_amenities where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Select * from #__osrs_photos where pro_id = '$row->pid'");
$photos = $db->loadObjectList();
if(count($photos) > 0){
for($j=0;$j<count($photos);$j++){
$photo = $photos[$j];
$image_path = JPATH_ROOT.DS."components".DS."com_osproperty".DS."images".DS."properties";
@unlink($image_path.DS.$photo->image);
@unlink($image_path.DS."medium".DS.$photo->image);
@unlink($image_path.DS."thumb".DS.$photo->image);
}
}
$db->setQuery("Delete from #__osrs_photos where pro_id = '$row->pid'");
$db->query();
}
}
Good luck
Dam
this code is used to remove properties out of database
$query = "Select a.* from #__osrs_expired as a"
." inner join #__osrs_properties as b on b.id = a.pid"
." where a.remove_from_database < '$current_date'"
." and a.pid not in (Select pid from #__osrs_queue where `emailtype` = 3)";
$db->setQuery($query);
$rows = $db->loadObjectList();
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){
$row = $rows[$i];
$db->setQuery("Delete from #__osrs_properties where id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_expired where pid ='$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_queue where pid = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_field_value where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_amenities where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Select * from #__osrs_photos where pro_id = '$row->pid'");
$photos = $db->loadObjectList();
if(count($photos) > 0){
for($j=0;$j<count($photos);$j++){
$photo = $photos[$j];
$image_path = JPATH_ROOT.DS."components".DS."com_osproperty".DS."images".DS."properties";
@unlink($image_path.DS.$photo->image);
@unlink($image_path.DS."medium".DS.$photo->image);
@unlink($image_path.DS."thumb".DS.$photo->image);
}
}
$db->setQuery("Delete from #__osrs_photos where pro_id = '$row->pid'");
$db->query();
}
}
You can intervene into above code to get the agent_id and +1 again his(her) account
$query = "Select a.* from #__osrs_expired as a"
." inner join #__osrs_properties as b on b.id = a.pid"
." where a.remove_from_database < '$current_date'"
." and a.pid not in (Select pid from #__osrs_queue where `emailtype` = 3)";
$db->setQuery($query);
$rows = $db->loadObjectList();
if(count($rows) > 0){
for($i=0;$i<count($rows);$i++){
$row = $rows[$i];
$db->setQuery("Select agent_id from #__osrs_properties where id = '$row->id'");
$agent_id = $db->loadResult();
//process to add 1 property again ...
$db->setQuery("Delete from #__osrs_properties where id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_expired where pid ='$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_queue where pid = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_field_value where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Delete from #__osrs_property_amenities where pro_id = '$row->pid'");
$db->query();
$db->setQuery("Select * from #__osrs_photos where pro_id = '$row->pid'");
$photos = $db->loadObjectList();
if(count($photos) > 0){
for($j=0;$j<count($photos);$j++){
$photo = $photos[$j];
$image_path = JPATH_ROOT.DS."components".DS."com_osproperty".DS."images".DS."properties";
@unlink($image_path.DS.$photo->image);
@unlink($image_path.DS."medium".DS.$photo->image);
@unlink($image_path.DS."thumb".DS.$photo->image);
}
}
$db->setQuery("Delete from #__osrs_photos where pro_id = '$row->pid'");
$db->query();
}
}
Good luck
Dam
Please Log in or Create an account to join the conversation.
Moderators: Mr. Dam, Nguyen Phu Quan
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.