• Resolved ailaina123456

    (@ailaina123456)


    Hi,

    I have added a shortcode field to the profile form, which is displayed on the front end.
    I would like the user to be able to modify the shortcode from the front end on his profile page.
    However, when going on the profile edit page, the shortcode field is not open for modification. (Eventhough the field is set as “View Everywhere” and the Privacy set to Everyone)

    Thanks for your help

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @ailaina123456

    Shortcode field only renders that shortcode that you add in the Field settings. It doesn’t display a text field so users can add their own shortcode. It requires customization if you want users to add their shortcode. I suggest adding a text/textarea field and then use the example code below to render that shortcode:

    add_filter("um_view_field", function( $res, $data, $type ){
       if( 'my_shortcode_field_key' === $data['metakey'] ){
           if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
            return do_shortcode( $res );
           } else {
            return apply_shortcodes( $res );
           }
        } 
       return $res;
    },10, 3);

    Just change the metakey ‘my_shortcode_field_key’ to the field that you will create for the shortcode.

    Thread Starter ailaina123456

    (@ailaina123456)

    Hi,

    Thanks a lot for this solution!

    Where should this code be added exacly?

    Regards

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @ailaina123456

    You can add the code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    Thread Starter ailaina123456

    (@ailaina123456)

    Hi,

    When I paste the code into the functions.php file some of the code appear in green, is that normal? Also the 2 last brackets “}” have no counterparts when I click on it. When I implemented the code, it created a critical error.

    https://prnt.sc/55fDddTlrFRq

    Thanks!

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @ailaina123456

    Try changing those &#039 to ".

    Thread Starter ailaina123456

    (@ailaina123456)

    Hi,

    It is working perfectly! I had a copy/paste issue.

    Thank’s a lot for the great support

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Thanks for letting us know.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Shortcode field edit on profile page’ is closed to new replies.