Custom Display Where Clause

Hi,

I’m trying to compare one of my field values with the current user’s login or even first name.

I have tried the following comparing the dropdown value equals …

[user_id]
[25 show=first_name]
[current_user]
[login]
[first_name]
etc……

Is there an easier way of getting this value?

Thanks

I'm trying the alternative; by coding the where clause in the content area.

[if 327 equals=first_name]

[if 327 equals=[first_name]]

[if 327 equals =[user_id]]

Is there a better way to make this work in the content area?

I'm giving your other method or passing parameters instead.

In reference to this topic.. http://formidablepro.com/help-desk/current-logged-in-userid-to-use-in-custom-display/

You create a shortcode that captures the user's id, that then allows you to pass as a parameter.  But how would I pass the parameter right after login?  eg. After the login, the user get's sent to their dashboard.  Which needs the userid parameter to display reports.

Thanks

Here's a related post about writing a custom shortcode to compare two values like this.
http://formidablepro.com/help-desk/custom-display-if/

But how would I pass the parameter right after login?

I'm not sure what you're asking, or how it would be any different from any other time.

So, there isn't any shortcode to display the current user for the where clause?  Screenshot


Attachment:
screenshot 4

What type of field is "selling Agent", and what value are you saving into it? The dynamic default values will work in that box too.

On the form, I have a drop down that pulls in "dynamic entries" from another form. The dynamic entries is also their username field on the registration page (using the registration plugin). So it's usually text like "sam".

I tried the dynamic default values, found on the form builder ([login]), and they didn't pull back anything. I always get "No Entries Found".  The strange thing is, if I manually put the value in the where clause, it still doesn't show anything.

 

 

Data from entries fields work differently. You must use the ID or key of the entry. This sounds like it would need custom code to find the ID or the correct entry.

http://formidablepro.com/knowledgebase/frm_where_filter/

add_filter('frm_where_filter', 'filter_custom_display', 10, 2);
function filter_custom_display($where, $args){
  if($args['where_opt'] == 25){ //change 25 to the ID of your data from entries field
     global $user_ID, $wpdb, $frmdb;
     $entry_id = $wpdb->get_var("SELECT id from $frmdb->entries WHERE form_id=5 and user_id=$user_ID LIMIT 1"); //change 5 to the ID of the linked form
     $where = "meta_value = ". $entry_id ." and fi.id='". $args['where_opt'] ."'";
  }
  return $where;
}

Thanks, that worked.   Those filters are a life saver :)

Is there a way to compare that value in the content area? I need to nest a few if statements with it also.

[ if 317 equals=[login]]Show something[ /if 317]

Thanks

This will require custom code as described above.
http://formidablepro.com/help-desk/custom-display-if/

I am having difficulty showing a list of results based on a parameter in the url. As mentioned above, I believe that it is based on the fact that it is a "data from entries" field.

I have users creating a meeting with one form.  With another form users are able to choose the meeting (the data from entries field) and then put in a date and time that they are offering that meeting.  Several different users can offer each meeting at several different dates and times.

In a Custom Display I would like to list the meeting along with the dates and times that it is available. I am trying to link to this list of dates and times by using the [get-param=variable], but it always just shows all of the entries.

Stephanie, I am assuming that I need a filter similar to the one above, but I've tried a few different alterations to the one that you shared. Can you point me in the right direction?

You shouldn't need any custom code. The only thing that needs to be changed is the link you are using to show the list of dates for that meeting. What is your current link?

Link within Custom Display 1:

http://www.achieveopedia.com/command-center/steps/meetings-by-date-and-time/?meeting= moduletitle ]

In Custom Display 2:

The WHERE value is "Which meeting would you like to present?" is equal to [get-param=meeting].

No matter what the meeting is equal to in the url it still shows all of the dates and times for all meetings. I have even just typed the url in manually.  I assumed that it had something to do with the fact that the "Which meeting would you like to present?" is a data from entries field.

Since its a data from entries field, you need to pass the id of the entry selected in that field. Try replacing [moduletitle] with [id].

This didn't work. It still shows all of them.  Do I need to change something in the WHERE also?

What do you have in the advanced box? Screenshot please?

Custom Display 1


Attachment:
Screen shot 2012-11-29 at 8.02.31 PM

Custom Display 2


Attachment:
Screen shot 2012-11-29 at 8.00.56 PM

[get-param=meeting] is invalid. Use [get param=meeting].

Ahh!! I swear I tried both!! :-p  It works perfectly now. Thanks so much!

Topic closed.