1

I have created a searchkit query and results of our membership listing that I want to allow all the new and current members to be able to access.

I tried a searchkit display page (with a URL like "example.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fsearch#/display/Membership_Directory/Membership_Directory_List_1"), but I can't figure out how to allow members to access that page.

I tried the same searchkit results showing in formbuilder, but I can't get it to show the results, even if I back the "Permission" to "Generic: Allow all users (including anynous)".

How do I show the results on a page within the WordPress site (using an embed code? or as a CiviCRM AFForm?) that is restricted to viewing by only current members? What rights do they need? What am I missing?

March 20, 2024 Update Based on comment feedback below, here is a clarification of what happens in a WordPress page using the shortcode for the AFForm.

The permission in the FormBuilder is set to anonymous: enter image description here

The short code I'm using in the WordPress page is set to the form name:

[civicrm component="afform" name="afsearchMembershipDirectory" hijack="0"]

The site renders this in the HTML source:

<div class="wpb_wrapper">
  <div class="crm-container" id="bootstrap-theme">
    <crm-angular-js modules="afsearchMembershipDirectory">
       <afsearch-membership-directory></afsearch-membership-directory>
    </crm-angular-js>
  </div>
</div>

But the browser console shows errors like this and never displays anything:

Uncaught SyntaxError: expected expression, got '<'

1 Answer 1

2

2 options:

  1. As a CiviCRM path: Set a path for your form in the FormBuilder UI, and be sure to check the "Accessible on front-end of website" box to make it available to non-CiviCRM users. For testing purposes you can allow all users to view the form although you may be able to refine that permission if you have a specific permission granted to members. FormBuilder

  2. As a WordPress page with shortcode: Create a normal wordpress page or post and give your members appropriate access to view it. Embed your FormBuilder form onto that page with a shortcode, which is in the format:

[civicrm component="afform" name="fullNameOfMyForm"]
4
  • I've tried both of these (as noted in my original post). The 1st works when I'm logged in (as an admin user), but even with the anonymous, nothing shows when I view it in an incognito window. The 2nd doesn't work, even when I'm logged in editing and previewing the page.
    – Mark
    Feb 8 at 0:45
  • If I turn off "Enforce Permissions" on the SearchKit results, then the FormBuilder one does work (still with anonymous access to the form). Changing that setting did not make the WordPress shortcode page work. I'll head down the FB path to see if I can now lock things down so only members can view the results.
    – Mark
    Feb 8 at 0:52
  • What does "doesn't work" mean wrt the shortcode? Can you double-check the name? Should match exactly the filename of the afform minus the .aff.html suffix.
    – Coleman
    Feb 8 at 13:16
  • I confirmed the name by copying the filename and comparing it to the shortcode. It matches exactly. "Doesn't work" means that the HTML angular tags get output, but the browser console shows javascript errors and nothing ever renders on the front end. I'll update the main question with the details.
    – Mark
    Mar 21 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.