Jump to content

Limit Number of Listings


Lee Wilson1424296141

Recommended Posts

I need the ability to limit the number of listings a user can post for Jreviews 2.3x on J1.6 or above.

 

I had an old hack that worked in listings_controller.php for joomla 1.5 but this nolonger works.

 

 

 

/* LIMIT NUMBER OF LISTINGS */

 

            $user =& JFactory::getUser();

 

            $userID = $user->get('id');

 

            $db =& JFactory::getDBO();

 

 

 

            $query = 'SELECT count(*) FROM `jos_content` where created_by=' . $userID . ' AND sectionid='.(int) $this->data['Listing']['sectionid'].' AND sectionid IN (5)';

 

            $db->setQuery($query);

 

            $numPosts = $db->loadResult();

 

 

 

            if($numPosts >= 1)

 

            {

 

              $update_html = 'You already submitted a listing';

 

            }

 

            else

 

            {

 

              $update_html = $this->render('listings','create_form'); 

 

            }

 

/* LIMIT NUMBER OF LISTINGS END */

 

 

Please get in touch if you are interested.

Link to comment
×
×
  • Create New...