PMR Modules / Templates Home | Module Alerts | Search | Find Developer | Developer Account     
Navigation

- Home

Information

"Hide / Unhide Listings" Mod


1.0.7.x

Price: USD 0
Module Type: Other Modules
Version: 1.0.7.x
Supported?: Yes (free)


Module Description:


This mod allow you to hide and unhide listings using agent panel or admin panel. It does not remove listings, it just hides them.. Actually it makes them unapproved. It is not suitable for directories with admin manual approval of listings enabled.

1) Add this to your /includes/functions.php

function hide ( $id )

{

global $db;

$sql = 'SELECT approved, id, type FROM ' . PROPERTIES_TABLE . ' where id = ' . $id;
$r = $db->query($sql) or error ('Critical Error' , 'Can't SELECT FROM listings DATABASE');

while ($f = $db->fetcharray($r))

{

if ($f['approved'] == 1) update_categories($f['type'], '');

}

$sql = 'UPDATE ' . PROPERTIES_TABLE . ' SET approved = 0 WHERE id = ' . $id;
$db->query($sql) or error ('Critical Error' , 'Can't remove listings record');

}

function unhide ( $id )

{

global $db;

$sql = 'SELECT approved, id, type FROM ' . PROPERTIES_TABLE . ' where id = ' . $id;
$r = $db->query($sql) or error ('Critical Error' , 'Can't SELECT FROM listings DATABASE');

while ($f = $db->fetcharray($r))

{

if ($f['approved'] == 0) update_categories('', $f['type']);

}

$sql = 'UPDATE ' . PROPERTIES_TABLE . ' SET approved = 1 WHERE id = ' . $id;
$db->query($sql) or error ('Critical Error' , 'Can't remove listings record');

}

2) edit edituserlistings.php

add

echo userform ('', '
<input type="Submit" name="hide" value="Unpublish Listing">
<input type="Submit" name="hide" value="Publish Listing">
');

after

echo userform ('', '<input type="Submit" name="submit_listing" value="' . $lang['Listing_Submit'] . '"><input type="Submit" name="remove_listing" value="' . $lang['Listing_Remove'] . '" onClick="return confirmDelete()" style="background: #E6BA9E; color: #000000;">');

and add

if (isset($_POST['hide'])
&& $_POST['hide'] == 'Unpublish Listing')
{

hide ( $f['id'] );
$listing_hidden = TRUE;

}

if (isset($_POST['hide'])
&& $_POST['hide'] == 'Publish Listing')
{

unhide ( $f['id'] );
$listing_hidden = FALSE;

}

after

if (isset($_POST['remove_listing'])
&& $_POST['remove_listing'] == $lang['Listing_Remove'])
{

removeuserlisting ( $f['id'] );

$listing_removed = TRUE;

}

then add

if (isset($listing_hidden) && $listing_hidden)
echo '<b>Listing is unpublished</b><br><br>';

if (isset($listing_hidden) && !$listing_hidden)
echo '<b>Listing is published</b><br><br>';

after

// If user removed the banner we run the following
if (isset($_POST['submit_banner_remove'])
&& $_POST['submit_banner_remove'] == $lang['Listing_Submit_Banner_Remove'])
banner_remove ( 'banners' , $f['id']);

this will add hide/unhide buttons to the user panel where they edit the listing.

Downloaded / Viewed: 688

Submission Date: 09-15-2007

Last Update: --
Developer Details:

PMR Developers

PMR Developers (PMR LLC.)


Purchase / Download Link

Add To Favorites

Mail To A Friend

Send Message

Visit Website

3

Module Name


Module Type


Version


Supported?


With Images Only

     Advanced Search

Developer Control Panel

Login
Password

Developers Online



©2008 phpMyRealty.com Modules

Generated in 0.20388 secs, 21 SQL queries executed in 0.09429 secs