Pro Login Widget Question re: Title Modification

I’d like to modify the “My Account” title to “Affiliate Dashboard”. I’ve easily placed the dashboard URL in the widget (under My Account), but am at a loss regarding how to change “My Account” to a new title.

I know there’s got to be an easy way to do this, but I’m stumped.

Thanks, in advance.

See Changing s2member-list empty result text

I may not have been clear with my question. I’m trying to alter the display that reads “My Account” to "Affiliate dashboard’ after a user is logged in. Will your suggested solution do this?

Sorry for the need to clarify.

Yes. Just replace the strings of text as necessary and leave everything else as provided in the other thread. This is the way to change any default text in s2Member that appears on the front-end of your site.

Thanks Tim. I’ll give it a shot.

I’ve never installed an mu plugin before, and when I copied the following code, here’s what I get when attempting to login:

Parse error: syntax error, unexpected ‘’ (T_NS_SEPARATOR), expecting identifier (T_STRING) in /home/downlin4/public_html/wp-content/mu-plugins/s2-hacks.php on line 10

Here’s the code I installed with a slight modification to the if, then, else logic:

<?php /* Plugin Name: s2-hacks Description: This is just a test. Author: Version: 1.0 Author URI: */ function kts_text_context_changes( $translated, $original, $context, $domain ) { if ( $domain == 's2member' && $context == 's2member-front' ) { if ( $original == ‘My Account' ) { $translated = ‘Affiliate Dashboard'; } } return $translated; // return modified text } add_filter( 'gettext_with_context', 'kts_text_context_changes', 10, 4 ); ?>

Any suggestions as to what I am doing wrong?

Thanks!

First, when you post code here, put three backticks (on the same key as the ~ sign) on a line both before and after the code. Then it will be much easier to read.

Second, don’t add a closing ?> tag. In fact, you should never add that to the bottom of a PHP file. This helps to avoid white screens of death and headers already sent messages.

Third, you have a smart apostrophe before both My Account and Affiliate Dashboard. It must be a dumb (straight) apostrophe in each case.

Hi Tim,

I eliminated the closing tag and corrected both of the leading apostrophes, but still end up with a parsing error. I apologize – I am not conversant with .php.

Art

Are you sure that you loaded the file into the correct folder?

I think so - it’s under the mu-plugins directory, along with another mu plugin placed there automatically by a different plugin I had previously installed.

After experimenting a bit, I FTP’d a different file containing only the header information (no actual code) for the plugin and discovered it too is throwing the same parse error. Could this problem be related to two separate plugin files residing in the mu-plugins directory?

No. You can have lots of mu-plugins. It sounds like a hosting issue.

Thanks for your help. I’ll pursue this with siteground and let you know what I find.

Best… Art

Hi Tim,

I finally figured out what I was doing wrong. I recently migrated to an Apple, and the text editor I was using was inserting code that wasn’t seen. Got that straightened out and the mu-plugin worked.

Unfortunately the solution appeared to replace reference to My Account throughout s2 and this is causing problems with s2member’s interaction with an affiliate management program.

So my question is how best to localize the change from My Account to Affiliate Dashboard such that the change only affects the display of the Pro Login form and doesn’t propagate throughout s2?

Thanks for all your assistance!

At least we know the cause of the previous issue!

That code shouldn’t change anything on the back-end, though, so I’m surprised it’s causing problems with your affiliate stuff. In that case, your best bets are:

  1. Edit the relevant s2Member directly (but then you will need to redo this with every update, though they aren’t particularly frequent), or
  2. Use some javascript/jQuery, or
  3. Switch to using a different login widget, like Sidebar Login.

I’ll opt for solution #1, if you can tell me the name of the relevant file!

Thanks!

It’s in this file:

s2member-pro/src/includes/classes/login-widget.inc.php

There should be two instances there, so you will need to work out which one you need to change.

Hi Tim,

Many thanks for the tip!