• Resolved spac3race

    (@spac3race)


    Hi, I’d like to change the wording the user sees on the User Account section, as shown on the screenshot – the menu item “Restricted Pages” and the section title “Restricted Pages List”. Is this possible?

    https://ibb.co/B4WfKts

    • This topic was modified 1 year, 3 months ago by spac3race.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Vlado Grcic

    (@vladogrcic)

    Sorry for the late response, I was sick. Regarding your question, you can but not directly with my plugin. You could use a translation plugin,
    maybe try this:

    add_filter( 'gettext', 'wpdocs_translate_text', 10, 3 );
    function wpdocs_translate_text( $translated_text, $untranslated_text, $domain ) {
    	if ( 'blah' !== $translated_text ) {
                   $translated_text = 'lorem';
    		return $translated_text;
    	}
    
    	// Now do your checking for your string within the 'blah' domain
    }

    Add that to your theme. Its not ideal but at least it should work.

    kitelife

    (@kitelife)

    I also need this feature, being able to change the title “Restricted Pages” to something like “Product Support Pages”, etc that are much more customer friendly. Would love to see it added to the plugin settings.

    Of course, we always try to avoid editing PHP or stylesheets due to the likelihood of changes being erased every time we fully update a plugin or theme.

    • This reply was modified 1 year ago by kitelife.
    • This reply was modified 1 year ago by kitelife.
    Thread Starter spac3race

    (@spac3race)

    Thanks for this code snippet. I must have done something wrong though! I tried to change “Restricted Pages” to “Purchased Content” but ended up with the below!

    add_filter( 'gettext', 'wpdocs_translate_text', 10, 3 );
    function wpdocs_translate_text( $translated_text, $untranslated_text, $domain ) {
    	if ( 'Restricted Pages' !== $translated_text ) {
                   $translated_text = 'Purchased Content';
    		return $translated_text;
    	}
    
    	// Now do your checking for your string within the 'blah' domain
    }
    Plugin Author Vlado Grcic

    (@vladogrcic)

    @kitelife


    Of course, we always try to avoid editing PHP or stylesheets due to the likelihood of changes being erased every time we fully update a plugin or theme.

    You can use a child theme. Then you can update the theme without overwriting anything.

    Plugin Author Vlado Grcic

    (@vladogrcic)

    @spac3race Sorry I made a mistake. Here is the updated:

    function wpdocs_translate_text( $translated_text, $untranslated_text, $domain ) {
    	global $post;
        $post_slug = $post->post_name;
    	if ( 'my-account' === $post_slug ) {
    		if ( 'Restricted Pages' === $translated_text ) {
    			$translated_text = 'Purchased Content';
    			return $translated_text;
    		}
    	}
    	return $translated_text;
    	// Now do your checking for your string within the 'blah' domain
    }
    add_filter( 'gettext', 'wpdocs_translate_text', 99, 3 );
    • This reply was modified 1 year ago by Vlado Grcic. Reason: Fixed messes up most of the text on admin and my account page
    Thread Starter spac3race

    (@spac3race)

    This has worked for the side menu perfectly thank you. What do I need to change to get the section ‘title’ to say the same?

    Plugin Author Vlado Grcic

    (@vladogrcic)

    Change “Restricted Pages” to “Restricted Pages List” and change “Purchased Content” to what you want.

    Thread Starter spac3race

    (@spac3race)

    Thank you! I repeated the replace string with the new wording. All sorted.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Change User Account Page Wording’ is closed to new replies.