Support » Plugin: Client Portal - Private user pages and login » Pre Determined Content

  • Resolved invishane

    (@invishane)


    Hello! I love the plug-in! Is there a way to inject some predetermined content into the private page posts when the page is CREATED when the user registers? I would like for some content (combination of shortcodes and text) to be created for EVERY user, that i can then go edit on an individual basis for each user through their private page posts. Any help or idea how to do this would be GREAT! Thank you!

    https://wordpress.org/plugins/client-portal/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author madalin.ungureanu

    (@madalinungureanu)

    Hello,

    I will take this in consideration to add it as a feature but for the time being you could use the following filter: $data = apply_filters( ‘wp_insert_post_data’, $data, $postarr ); and replace the data[‘post_content’] with the desired content only for the post_type ‘private-page’.
    Hope this helps.

    Hi,

    Thank you for reaching out to us, for your feed-back and for your kind words.

    For now we don’t have this feature, to add default content in private pages, inside the plugin but I’ve talked with the dev team and they will add this functionality in future updates.

    As soon as I know more about this I will contact you.

    Best regards,

    i’m interested too by this function 🙂

    photoMaldives

    (@photomaldives)

    yes, this is exactly what I’m looking for, too. 🙂

    Please I want to add a welcome note and other related content to be displayed immediately a user private page is created. Please guide me on how to do this. I love you for what you are doing, God will reward abundantly. More power to your elbow.

    (@madalin.ungureanu)
    Where do I add this? $data = apply_filters( ‘wp_insert_post_data’, $data, $postarr ); and data[‘post_content’]. Please guide me through it and answer me as soon as possible.

    Hi,

    In order to add default content inside the Private Pages you will need to use some custom code:

    1. Create an empty plugin like this: https://gist.github.com/sareiodata/76f701e01db6685829db

    2. Add the following code to the end of it:

    /*
     * Filter to add default content inside the User Private Page created with Client Portal plugin
     */
    
    add_filter('wp_insert_post_data', 'wppbc_client_portal_default_content', 10, 2);
    
    function wppbc_client_portal_default_content($data, $postarr) {
    
        if ($data['post_type'] == 'private-page') {
    
            $data['post_content'] = 'Custom Text';
    
        }
    
        return $data;
    }

    3. Replace Custom Text with your content

    4. Install this plugin via FTP (copy it inside wp-content/plugins) or create a zip archive with it and install it via the WordPress plugin upload functionality

    If you have existing users with Private Pages you will need to manually update every Private Page to display the default content. The default content will be displayed after the update.

    After you add the default Content you will need to deactivate the plugin in order to use the backend editor. Otherwise the filter will overwrite the content added in Editor.

    Test it out and let me know if it works.

    Best regards,

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Pre Determined Content’ is closed to new replies.