Need some php code help.

For some reason I can't get user validation by email to work on one of my elgg installations so I figured I would take a different approach to validating them.

I've changed the wording to say an email has been sent to me (even though it hasn't) and want to change the wording in en.php from

To activate your account, please confirm your email address by clicking on the link we just sent you.

to the text with a link. I can get it just with the text, the problem is when I add the email address as a link

To activate your account, please confirm your email address by sending us an email to community@domain.com requesting us to activate your account. 

The problem is I know bubkis about php coding. I even tried an online tool to convert html to php but I get an error(s) depending on what I try along the lines of Parse error: syntax error, unexpected 'mailto' (T_STRING), expecting ')'

Can someone provide the proper syntax of the code please?

  • I google'd your error and all people are saying is to change a double quote into a single quote or vice versa but email notification file is part of core.

  • I don't know if it's even necessary to include the email address in any special way. Surely not as a link as an email address in not an url.

    I just tested what happens if I simply enter an email address within an (text) email and the email address got already highlighted automatically by the email client to allow for sending a reply on a click. I use kmail but I assume that other email clients are capable of identifying email addresses within emails in the same way.

  • Thank you. That pointed me in the right direction. The is the code that worked.

    'uservalidationbyemail:registerok' => "To activate your account, please confirm your email address by sending us an email to <a href=\"mailto:community@domain.com\">community@domain.com</a> requesting us to activate your account.",

  • Oh yeah it mentioned something about escaping the double quotes, but I see you got it lol.

  • I don't know if it's even necessary to include the email address in any special way. Surely not as a link as an email address in not an url.

    You are correct pretty well any email client will treat it as an email address. By making it a link it just saves them copying and pasting into their email client and will automatically launch their email client with the email address in the to field.

  • My mail app automatically turns any words starting with http or https into a link. I think even www's, I'm on a Mac by the way.

  • With the assistance of Matt I found the cause and a solution to my problem. The cause was the subject length which for php mail appears to be 80 characters. When sending the email to the user it includes their display name and the site name; %s please confirm your email address for %s !

    If you have a long display name ie: Jonathan Cunningham and a long site name ie: Canadian Seniors Community when put together you have Jonathan Cunningham please confirm your email address for Canadian Seniors Community! which is 85 characters so it won't send. A shorter display name ie: Don Clark works since now the total is only 75 characters.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking