Favorites Plug-in: Count listings

6 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 25, 2011   (RSS)

By gversion - June 28, 2011

Hello,

I've just bought the Favorites Plug-in and I'd like to display the total number of Favorites that a user has.

I'd be really grateful if someone could someone please tell me how to achieve this.

Thanks,
Greg

Re: [gversion] Favorites Plug-in: Count listings

By robin - June 29, 2011

Hey Greg,

The data for Website Favorites is stored in a hidden table called "_website_favorites". You can see it in the Section Editor. I've included an example below of displaying how many favourites a user has. In this case it's user with num of 1.


// load records
list($_website_favoritesRecords, $_website_favoritesMetaData) = getRecords(array(
'tableName' => '_website_favorites',
'where' => "createdByUserNum='1'"
));
echo $_website_favoritesMetaData['totalRecords'];


Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Favorites Plug-in: Count listings

By gversion - June 29, 2011

Hi Robin,

Many thanks for the help. I seem to have got this to work! :)

Thanks again for all your help.

Regards,
Greg

Re: [gversion] Favorites Plug-in: Count listings

By gversion - July 22, 2011

Hi Robin,

Could you please tell me how to update the code you provided so that it displays the total number of listings for the currently logged in user?

The example you provided was just for a user with UserNum='1'

Thank you,
Greg

Re: [gversion] Favorites Plug-in: Count listings

By robin - July 25, 2011

Hey Greg,

That looks good to me. $CURRENT_USER['num'] is exactly what I would use.

Robin
Robin
Programmer
interactivetools.com