FreeForm Count: how can I filter by author_id?
Posted: 26 November 2007 07:55 PM   [ Ignore ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

FreeForm:Count is supposed to filter by author_id and the filters (parameters) are supposed to be cumulative.

But I can’t make it find entries for the same form that have ‘Open’ status and authored only by the logged-in member.

Here’s the code I’m using:

{exp:freeform:count form_name="myForm" author_id={logged_in_member_id} status="Open"

What do I get? I get a count of every open-status entry. I know (by testing) that the {logged_in_member_id} is correct. I know that the count of open-status entries is correct. But there is no way I can find to get both “open” and “authored by the logged-in member”

Is FreeForm:Count working for anyone else?

PS: I think it would be a great idea to put the"author_id” parameter in the Freeform:Entries tag. That would pretty much eliminate the need for a FreeForm:Count tag, in my view.

Profile
 
 
Posted: 27 November 2007 03:33 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

You should probably try:

{exp:freeform:count form_name="myForm" author_id="{logged_in_member_id}" status="Open"

Notice the quotations around the {logged_in_member_id} variable

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 29 November 2007 12:02 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Thanks Pie Man, but this makes not the slightest difference on my set-up (EE 1.6.1 and FF 2.5.9).

Quoted or not the ‘author_id={logged_in_member_id}‘ parameter does not filter for the logged_in member alone.

Do you have it working as expected?

Best,

Peter

Profile
 
 
Posted: 29 November 2007 07:26 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

This is not yet a feature for Freeform, according to the Documentation:
http://www.solspace.com/docs/entry/freeform_25_entries_tag/#parameters

Sorry for setting you in the wrong direction raspberry
I’ll add this as a feature request smile

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 02 December 2007 10:16 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Hi PieMan,

As you say, ‘author_id’ is not a parameter in the FreeForm:entries tag. But the problem I refer to is with the FreeForm:count tag, where it IS listed as a parameter. I don’t think it works there.

Profile
 
 
Posted: 03 December 2007 08:01 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

I apologize for that smile

Well, the parameter seems to work fine when manually entering an Author ID, but does not seem to support the {logged_in_member_id} variable.

I’ll let the developers know, as even if this feature is not yet implemented, it definately makes sense for it to be. smile

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 03 December 2007 01:54 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Thanks Pie Man. No need for apologies. I am grateful for your help.

Best wishes,

Peter

Profile
 
 
Posted: 03 December 2007 02:48 PM   [ Ignore ]   [ # 7 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Hi Pie Man,

Just to help others who might be in the same predicament, here’s a little piece of PHP that will perform COUNT by ‘logged_in_member_id’. Where you would use {count} inside {freeform:count} tags just echo the value of a variable such

<?php echo $count_entries ?> 

You fill-in the value of this variable with a small piece of PHP included in the page after you have used EE to check that you have a logged-in member i.e. between the {if logged_in} {/if } tags. Here’s the code I’m using:

<?php 
// Get the count of open entries for this user
function count_entries(){
global $DB$SESS;
$user_id $SESS->userdata['member_id'];
$results $DB ->query("SELECT * FROM exp_freeform_entries WHERE `author_id` = $user_id AND `status` = 'open'");
return 
$results->num_rows;
}
?> 

Hope this helps. No guarantees… naturally :->.

Profile