can i use the memberships pro to show an mu-plugin?

In this site I use a MU-plugin for so that clients can fill out a form in the appointments confirmation pop up.
Can I use the membership plugin to show this option to only members that are loved in for this permission?

i have granted access.

thanks,
matt

  • Tyler Postle

    Hey Matt,

    Yes you could show it to only a specific membership or if the user is a member of any membership. I think it might be easier to write the logic into your mu-plugin in this case. We have some dev docs via: Membership 2 > Help > API Docs.

    You will see there a ms_has_membership() function that I think would be useful here :slight_smile:

    Hope that helps! If you have further questions just let us know.

    Cheers,
    Tyler

  • Mattbkelly

    I found the ma_has_membership, But I am bran new to memberships and do not know how to implement it.

    do I just add this code to the mu-plugin:
    <?php if ( ms_has_membership() ) : ?> Current user has any membership

    What settings do I need to use for the site to call the code?
    It looks like I can use a invitation which is perfect, but I am going in blind right now.

    any help would be appreciated.
    thanks,
    matt

  • Tyler Postle

    Hey Matt,

    You would need to include it into the function you have as your mu-plugin. Who created the mu-plugin? If you have a developer then I would suggest asking them to implement it :slight_smile:

    Otherwise, could you paste in the mu-plugin code here? We could have a look, depending on how complex the mu-plugin is though I can't guarantee it is something we'll be able to implement for you, but we can usually at least provide guidance.

    Look forward to hearing back!

    Cheers,
    Tyler

  • Mattbkelly

    It was a WPMU developer that helped me with it. here it is.
    I guess the question is more of what settings do I use for membership plugin to activate the API mu_plugin code?

    <?php
    
    add_action( 'wp_footer', 'additional_questions' );
    function additional_questions() {
    
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery("input.appointments-pleasecheckthisboxifthisyourfirsttimebeingseenatsteelcaseforthiscondition-field-entry").click(function() {
                var test = jQuery(this).is(':checked')
                if (test == false) {
                    jQuery(".appointments-dateofbirth-field").hide();
                } else {
                    jQuery(".appointments-dateofbirth-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-male-field").hide();
                } else {
                    jQuery(".appointments-male-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-female-field").hide();
                } else {
                    jQuery(".appointments-female-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-plantlocation-field").hide();
                } else {
                    jQuery(".appointments-plantlocation-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-department-field").hide();
                } else {
                    jQuery(".appointments-department-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-describesymptomsandareaofthebodythatisaffected-field").hide();
                } else {
                    jQuery(".appointments-describesymptomsandareaofthebodythatisaffected-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-whendidyoufirstnoticesymptomsdatetime-field").hide();
                } else {
                    jQuery(".appointments-whendidyoufirstnoticesymptomsdatetime-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-whateventorincidentledtothesymptom-field").hide();
                } else {
                    jQuery(".appointments-whateventorincidentledtothesymptom-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-ifsymptomoccurredwithoutadirectcausecheckbox-field").hide();
                } else {
                    jQuery(".appointments-ifsymptomoccurredwithoutadirectcausecheckbox-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-areyoucurrentlybeingtreatedorhaveyoueverbeentreatedforthiscondition-field").hide();
                } else {
                    jQuery(".appointments-areyoucurrentlybeingtreatedorhaveyoueverbeentreatedforthiscondition-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-doyouhaveanyongoingsymptomsorneedadditionaltreatment-field").hide();
                } else {
                    jQuery(".appointments-doyouhaveanyongoingsymptomsorneedadditionaltreatment-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-referredby-field").hide();
                } else {
                    jQuery(".appointments-referredby-field").show();
                }
            });
        });
    </script>
    <?php
    }
  • Tyler Postle

    Hey Matt,

    So just to clarify, you are wanting to hide the above custom fields to visitors and show them only to users who have an M2 Membership, is that right?

    In that case we would need to implement some logic into that above code to only show the fields if they have a Membership, which involves the function I pointed out above.

    I'll need to call in one of our coding experts to point you further in the right direction here, just let me know if my first statement above is correct so I can pass on the right info to our coding expert :slight_smile:

    Cheers,
    Tyler

  • Mattbkelly

    Do you think I could just edit a new users sign up method of M2 membership plugin to include these questions? If so, where would the answers be stored? Is there is a way to list the answers in the appointment's users admin page?

    I just had a better idea using Membership and appointments data:
    Is there a database/form builder/query/notes plugin that will take multiple data tables from different web sites and custom order the placed data?
    For example can a plugin
    - take data tables from the membership plugin from a specific user (if we can edit the users membership sign up questions)
    - take all data from past appointments admin from the same specific users
    - add notes to the current appointment to the same specific user
    - do a search for a specific user to find all this data on one form
    - design/organize this form into categories that can hide separate appointments/membership data (ex. Joe smith: Membership questions/answers (click on section to reveal info); Past appointments notes and data (click on section to reveal all appointments in a list and then click on individual appointments to reveal notes and data); Current appointment (click on section to reveal notes and data and then enter notes that saves in the original database of the appointments admin area)

    thanks,
    matt

  • Tyler Postle

    Hey Matt,

    Everything you described above I think would be possible but it would take quite a bit of development to achieve.

    You can already add fields to the membership sign up form by using BuddyPress. You don't need all the BuddyPress features, just the extended profile component so you can turn the rest off from the BP settings if you don't want them.

    Then the fields you create in BP will be used in the M2 form as well if you choose :slight_smile: you can activate the "Profile Fields" M2 add-on to manage this.

    As for taking the data and organizing it how you are wanting, with all the functionality you want - it would require a developer. At least I'm not aware of a plugin that will do what you're wanting.

    There are a lot of exporting plugins out there where you could export data to a CSV and manage it there. Would something like that work? Or does the database need to be searchable from your dashboard? It sounds like you're wanting more of a customer management plugin where you can choose which fields display and make them searchable.

    Hope you had a happy new year!

    Cheers,
    Tyler

  • Mattbkelly

    thank you. I love it that you actually understand what I am asking for. I will look into a customer management plugin to see if there is something out there.

    I am doing my best to learn to build things instead of going in debt with a developer. I would imagine it would cost $1000 to build that customer manager tool for my dashboard. I need something for my dashboard, because i will need to compare notes on the same clients with my other therapists. Also, the other medical records software is way too expensive and OVERKILL for what I will use it for.
    thanks again,
    matt

  • Tyler Postle

    No problem. Glad I could help :slight_smile:

    You'll want to look for a WordPress CRM plugin that supports adding custom fields to the customer profile page. Hopefully it will be able to recognize the Appointments+ fields.

    This one here mentions ability to add custom fields to profile page, although I've never actually used it myself so not sure if it would work the way you want: http://codecanyon.net/item/woocommerce-customer-relationship-manager/5712695

    Regardless, if you can find one that is at least close - then hiring a developer to add the feature you need on top of the base functionality would be a lot cheaper :slight_smile:

    Cheers,
    Tyler

  • Mattbkelly

    I added the if ( ms_has_membership() ) to line 7 of the intake mu_plugin below, but the form is still there to both members and non members. Do I need to add it differently?

    <?php
    
    add_action( 'wp_footer', 'additional_questions' );
    function additional_questions() {
    
    ?>
    if ( ms_has_membership() )
    <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery("input.appointments-pleasecheckthisboxifthisyourfirsttimebeingseenatsteelcaseforthiscondition-field-entry").click(function() {
                var test = jQuery(this).is(':checked')
                if (test == false) {
                    jQuery(".appointments-dateofbirth-field").hide();
                } else {
                    jQuery(".appointments-dateofbirth-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-male-field").hide();
                } else {
                    jQuery(".appointments-male-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-female-field").hide();
                } else {
                    jQuery(".appointments-female-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-plantlocation-field").hide();
                } else {
                    jQuery(".appointments-plantlocation-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-department-field").hide();
                } else {
                    jQuery(".appointments-department-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-describesymptomsandareaofthebodythatisaffected-field").hide();
                } else {
                    jQuery(".appointments-describesymptomsandareaofthebodythatisaffected-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-whendidyoufirstnoticesymptomsdatetime-field").hide();
                } else {
                    jQuery(".appointments-whendidyoufirstnoticesymptomsdatetime-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-whateventorincidentledtothesymptom-field").hide();
                } else {
                    jQuery(".appointments-whateventorincidentledtothesymptom-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-ifsymptomoccurredwithoutadirectcausecheckbox-field").hide();
                } else {
                    jQuery(".appointments-ifsymptomoccurredwithoutadirectcausecheckbox-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-areyoucurrentlybeingtreatedorhaveyoueverbeentreatedforthiscondition-field").hide();
                } else {
                    jQuery(".appointments-areyoucurrentlybeingtreatedorhaveyoueverbeentreatedforthiscondition-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-doyouhaveanyongoingsymptomsorneedadditionaltreatment-field").hide();
                } else {
                    jQuery(".appointments-doyouhaveanyongoingsymptomsorneedadditionaltreatment-field").show();
                }
                if (test == false) {
                    jQuery(".appointments-referredby-field").hide();
                } else {
                    jQuery(".appointments-referredby-field").show();
                }
            });
        });
    </script>
    <?php
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.