Support » Plugin: Airpress » Attempting to use on a page where there is collection

  • Hello

    I am getting an error stating – “attempting to be used on a page where there is no collection”.

    This is on virtual fields on a page, and I have the WordPress Field set to “user-url”. This is so it pull the corresponding field for a specific users website.

    Any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author chetmac

    (@chetmac)

    WordPress Field should be a property of the WordPress $post object.

    So ID or post_name or post_title

    Thread Starter matthewbee9111

    (@matthewbee9111)

    Ah – so I can’t look up a user specific field? Like user email or user ID? My bad.

    Thanks for the response

    Plugin Author chetmac

    (@chetmac)

    Not currently with VirtualFields. You can with VirtualPosts.

    Also you can with a custom function in your functions.php file.

    Thread Starter matthewbee9111

    (@matthewbee9111)

    Good to know – I can switch to VirtualPosts to achieve this so will try that.

    Thread Starter matthewbee9111

    (@matthewbee9111)

    Hello – so all is working on the virtual posts apart from the personalization aspect.

    I have the below in my filter by formula
    {user_url} = ‘get_userdata( $user_url)’

    Is this where the personalization should occur?

    Thanks

    Plugin Author chetmac

    (@chetmac)

    First off, what should happen if a user NOT logged in loads the page? Because we can’t “get_useredata” on a non-logged in user, and we don’t want to query Airtable for NULL or empty URLs.

    Secondly, the purpose of a Virtual Post is to use a piece of the requested URL to fetch matching records from Airtable.

    So some URLs like:
    /airtable-users/chester
    /airtable-users/matthew

    Could use a single page (as a template) and a single Airpress Virtual Post configuration and load custom Airtable data into the template based on the requested URL.

    If you want to fetch data based on the current logged in user, I would recommend just creating a normal WordPress page and then using a function in your functions.php file to either A) fetch the appropriate data and/or B) generate a custom shortcode to output exactly what you want where you want it.

    Depending on your use case you could also have that function redirect users who are not logged in or just show a message telling them to login.

    If you book some time with me at https://chetmac.setmore.com/ I can provide some code samples and probably provide a working solution in ~30 minutes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Attempting to use on a page where there is collection’ is closed to new replies.