• Resolved webbernaut

    (@webbernaut)


    /wp-admin/admin.php?page=pmpro-advancedsettings

    Message for Logged-in Non-members:
    <h1>This content is for !!levels!! Members only.</h1> [shortcode]

    Message for Logged-out Users:
    <h1>This content is for !!levels!! Members only.</h1> [shortcode]

    Im customizing the message for Logged-in and Logged-out users. I have a shortcode I have written that pulls in the member levels dynamically. (for stylizing purposes) Adding a shortcode here doesn’t render the shortcode on the front end. Looking through some of the source code it appears this is it’s own shortcode. There is a way to have shortcodes nested in shortcodes.

    1. Is there is a filter here I can add to over ride this?
    2. If not I would officially like to request a restructuring of the code to allow shortcodes inside these settings fields?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Andrew Lima

    (@andrewza)

    Hi @webbernaut

    Thank you for reaching out to Paid Memberships Pro.

    You may adjust this using the following filters:

    * https://www.paidmembershipspro.com/hook/pmpro_non_member_text_filter/
    * https://www.paidmembershipspro.com/hook/pmpro_not_logged_in_text_filter/

    You should also be able to apply the ‘do_shortcode’ filter to the above filters to convert shortcodes which may also work.

    I hope this helps get you started.

    Hey @andrewza,

    could you possibly explain in more detail how to adjust the filters in order to show the shortcodes?

    Thanks in advance!

    Thread Starter webbernaut

    (@webbernaut)

    @ritlance Not sure if you worked your way through this but here is a little help if you haven’t.

    If you follow the hook link it will take you to the github source.
    https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/functions.php

    Here you can see how it’s used in the code written by paidmembership pro themselves.

    On line 1925:
    function pmpro_get_no_access_message( $content, $level_ids, $level_names = NULL )

    Inside that function on line 1958:
    You will see the filter text function being used. Not a member and not logged in are probably what you are looking for. As you can see they just add the text inside Advanced Settings.
    stripslashes( pmpro_getOption( 'nonmembertext' ) )

    So you can actually add your own text/function to replace this.

    Inside your theme functions.php (custom theme or child theme) you declare your own function that you then apply to the filter. You can have two different outputs for non member and not logged in or just apply the same to both. A quick example is below. Hope this helps!

    function custom_pmpro_non_member_text () {
    ...code goes here for the output you want or this could just be plain html or you can probably echo do_shortcode('shortcode') ...
    }
    add_filter( 'pmpro_non_member_text_filter', 'custom_pmpro_non_member_text' );
    add_filter( 'pmpro_not_logged_in_text_filter', 'custom_pmpro_non_member_text' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode inside Advanced Settings : Message’ is closed to new replies.