Support » Plugin: Contact Form DB » Need Syntax for Filtering GET parameter and User ID

  • I can filter forms data (captured using CF7) submitted by the logged in user using:

    [cfdb-table form=”my_form” filter=”Submitted Login=$user_login”]

    but I would also like to be able to filter the results based on the same user’s USERID found in variables obtained from URL parameters. For example: http://www.mywebsite.com/entryform/?affiliate=7&adcode=1234

    So, 7, the affiliate/user id is in the db. The adcode is also in the db from the form.

    Sorry, I’m new to this and I just can’t seem to get the right syntax for querying the affiliate field to match the logged in userID. Can anyone help? I’m sure it’s quite simple for someone who knows. I’ve tried …

    [cfdb-table form=”MY FORM” filter=”affiliate=$id”]
    [cfdb-table form=”MY FORM” filter=”affiliate=$ID”]
    [cfdb-table form=”MY FORM” filter=”affiliate=my_lookup_user($ID)”]

    I’ve tried Affiliate/Member plug-ins and used their variables … but I can’t get it to work.

    Any help would be greatly appreciated!

    https://wordpress.org/plugins/contact-form-7-to-database-extension/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    Filter Variable Substitution

    Assuming your form data has an “affiliate” field and your URL contains an “affiliate=7” GET parameter:

    [cfdb-table form=”MY FORM” filter=”affiliate=$_GET(affiliate)”]

    Michael, thanks, but that’s not exactly what I need.

    Maybe this explanation will help …

    The Affiliates all have their UserID. (e.g. 7)

    They direct their customers to go to a form page with the /?affiliate=7 parameter. That gets put into form, which gets put into the db affiliate field.

    Now, when the affiliate logs in, I want him to be able to see all of the records that were submitted using the /?affiliate=7

    So, where the affiliate’s userid/affiliateid = the stored value already inserted with the ‘GET’ during form entry.

    Plugin Author Michael Simpson

    (@msimpson)

    So you have:
    – Form entries with field affiliate=7
    – A user with login id = 7

    When that user is logged in, he should be able to see those entries using
    [cfdb-table form=”MY FORM” filter=”affiliate=$ID”]

    turn on debug to show what $ID evaluates to:
    [cfdb-table form=”MY FORM” filter=”affiliate=$ID” debug=”true”]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need Syntax for Filtering GET parameter and User ID’ is closed to new replies.