News:

Looking for documentation? Take a look on our wiki

Main Menu

Remove Displayed name field in registration email

Started by ex3mist, November 12, 2020, 19:03:44 PM

Previous topic - Next topic

ex3mist

Hello,
I guess I'm the next one who wants to remove the Displayed name field, but this time from the registration confirmation email. I edited the mail_html_reguser.php file and partially I succeeded.

<tr>
<td style="width: 100%;">
<?php
echo vmText::_('COM_VIRTUEMART_YOUR_LOGINAME') . $this->user->username $li;
//echo vmText::_('COM_VIRTUEMART_YOUR_DISPLAYED_NAME') . $this->user->name . $li;
if (!empty($this->password) ) {
echo vmText::_('COM_VIRTUEMART_YOUR_PASSWORD')  . $this->password $li;
}
echo $li.vmText::_('COM_VIRTUEMART_YOUR_ADDRESS')  . '<br/>' $li;
foreach ($this->userFields['fields'] as $userField) {
if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'hidden') {
?>

                        <span class="reg-<?php echo $userField['name']?>">
                        <?php
echo $userField['title'] . ': ' $userField['value'] . $li;
?>

</span>
                        <?php
}
?>

</td>
</tr>


This field is displayed twice and the first time I just commented out this line:

//echo vmText::_('COM_VIRTUEMART_YOUR_DISPLAYED_NAME') . $this->user->name . $li;

But the second table is extracted from the user data. That's why I decided to add a span around each row with a class that has the field name in it. And to set "display:none;" style for this row in the styles that are in the file's head.
The rows are correctly generated with spans and classes in it in the email, but unfortunately this particular field is not hidden!

If anyone helps with ideas, it'd be highly appreciated...

Jörgen

Are You loading enough CSS templates for the PRINT type of unit?
If not the You have to make sure the cprrect CSS is loaded, maybe by writing inline CSS?

Jörgen

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

ex3mist

Hello, Jörgen,
The CSS is in this same file. The whole code is:

<?php
defined
('_JEXEC') or die('');

/**
 * Renders the email for the user send in the registration process
 * @package VirtueMart
 * @subpackage User
 * @author Max Milbers
 * @author Valérie Isaksen
 * @link https://virtuemart.net
 * @copyright Copyright (c) 2004 - 2019 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version
 */
$li '<br />';
?>

<html>
<head>
<style type="text/css">
body, p, span, a, th, td {font-size: 16px;}
table.html-email {margin: 10px auto;background-color: #b9298b;border: 1px solid #DAD8D8;}
a.default:link, a.default:hover, a.default:visited {display: inline-block;line-height: 25px;margin: 10px ;padding: 3px 8px 1px 8px;background-color: #F2F2F2;color: #666666;border: 1px solid #CAC9C9;border-radius: 4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;text-decoration: none;}
a.default:hover {color: #888888;background-color: #F8F8F8;}
table.html-email th {background-color: #DDDDDD;margin: 0px;padding: 10px;}
.sectiontableentry2, .html-email th, .cart-summary th {background-color: #ccc;margin: 0px;padding: 10px;}
.sectiontableentry1, .html-email td, .cart-summary td {background-color: #fff;margin: 0px;padding: 10px;}
.v1reg-name {
display:none;
}
</style>
</head>

<body style="background-color: #F2F2F2;word-wrap: break-word;">
<div style="background-color: #b9298b;" width="100%">
<table style="margin: auto;" cellpadding="0" cellspacing="0"  >
<tr>
<td>
<table class="html-email" style="width: 100%;border:1px solid #DAD8D8;padding: 0;margin: 10px;">
<tr>
<td style="width: 100%;">
<?php echo vmText::sprintf('COM_VIRTUEMART_WELCOME_USER'$this->user->name); ?>
<br />
<?php
if (!empty($this->activationLink)) {
$activationLink '<a class="default" href="' JURI::root() . $this->activationLink '">' vmText::_('COM_VIRTUEMART_LINK_ACTIVATE_ACCOUNT') . '</a>';
echo $li;
echo $activationLink $li;
?>

</td>
</tr>
</table>
<table class="html-email" style="width: 100%;border:1px solid #DAD8D8;padding: 0;margin: 10px;">
<tr>
<th style="width: 100%;">
<?php echo vmText::_('COM_VIRTUEMART_SHOPPER_REGISTRATION_DATA'?>
</th>
</tr>
<tr>
<td style="width: 100%;">
<?php
echo vmText::_('COM_VIRTUEMART_YOUR_LOGINAME') . $this->user->username $li;
//echo vmText::_('COM_VIRTUEMART_YOUR_DISPLAYED_NAME') . $this->user->name . $li;
if (!empty($this->password) ) {
echo vmText::_('COM_VIRTUEMART_YOUR_PASSWORD')  . $this->password $li;
}
echo $li.vmText::_('COM_VIRTUEMART_YOUR_ADDRESS')  . '<br/>' $li;
foreach ($this->userFields['fields'] as $userField) {
if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'hidden') {
?>

                        <span class="reg-<?php echo $userField['name']?>">
                        <?php
echo $userField['title'] . ': ' $userField['value'] . $li;
?>

</span>
                        <?php
}
?>

</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>


Maybe a PHP function to skip this field will be more appropriate. But unfortunately my knowledge in PHP is miserable...

pinochico

From better SEO and better fill forms and confirm order:

"Show Display name fileds"

Then option Remove Displayed name filed is wrong and for me
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

ex3mist

Quote from: pinochico on November 13, 2020, 09:35:18 AM
https://uxplanet.org/the-18-must-do-principles-in-the-form-design-fe89d0127c92

not to invent something new at all costs, but to think

I don't understand what you mean? Everyone desides if this field is needed or not. I haven't seen an online shop that asks you to fill your name twice when registering - First name, Last name and then Displayed name. That's why I think the less is better. (See number 1 from the link you posted.) I found resolution here how to hide it from the form, but now if you are not asking the user to fill this field, you shouldn't show him the information from it in the email either. My opinion is that it shouldn't be required at all, but obviously the developers don't think so.

The point here is not if it should exist or not - I decided I don't want it. I hope to here ideas hot to hide that information from the message.

GJC Web Design

if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'hidden' && $userField['name'] != 'name') {

might work  -- or something similar
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

ex3mist

Quote from: GJC Web Design on November 13, 2020, 10:32:49 AM
if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'hidden' && $userField['name'] != 'name') {

might work  -- or something similar

Wow! That was perfect! It works great, just as I wanted. Thanks a lot!

ex3mist

Quote from: GJC Web Design on November 13, 2020, 10:32:49 AM
if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'hidden' && $userField['name'] != 'name') {

might work  -- or something similar

Hello GJC Web Design,
Can you, please, help with this? May I exclude another field - "agreed"? I'm trying with this code but obviously not working for it, only for the "name" field:

if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'hidden' && $userField['name'] != 'name' && $userField['agreed'] != 'agreed') {

Could another field be added?

pinochico

Hello GJC Web Design,

are you free freelancer? :)

I send to you my 426 issues from our customers, it'd be highly appreciated...
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

ex3mist

Quote from: pinochico on December 15, 2020, 12:46:27 PM
Hello GJC Web Design,

are you free freelancer? :)

I send to you my 426 issues from our customers, it'd be highly appreciated...

Thanks for the opinion! But if you have character issues, that's not the place. There are other forums for that. If you are not willing to help, don't post.

pinochico

I don't have a problem with character issues, but with people who confuse the freelancer forum and VirtueMart forum - they want custom adjustments for free, instead of paying for them.
And they have the courage to write specifically to individual members of the forum with a request for program modifications - yes, this post is up to you.

I want adjustments that I can't - I pay support - it's possible here too.
If you want to adjustments, you write on the forum and if no one answers you, you specifically address the post to the person who last helped you to continue to make adjustments.

You can hide it for whatever you want, you can name it whatever you want, you can blame me, but it's still an effort to get the benefit for free - don't you have your own developer?

You didn't understand my post at all - I don't need GJC to do anything to me, I'm a developer myself and if I don't know, I'll order an external developer and pay for it.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

ex3mist

@pinochico
Not that I need to answer to you, but yes, I don't have a developer - I develop it myself, and I develop it for myself. And I address it to GJC Web Design, because he suggested the solution last time. All you do from the begining of my post is to give an opinion when it's not wanted.

I hope moderators to pay attention at that.

AH

Aggreed ex3

@pinochio this is a support forum - we don't always tell people to get a developer as the first response and then act rudely to developers who support user posts!

And people come to the forums to try and solve real world issues.

This is the obvious first place to come many starting out that need config advice or editing help - as a result the team get to see wider issues and as a result can gain some insight.

It would be great if they scoured the forums first - many requirements are not new or require only a little adjustment to existing posts.

Regards
A

Joomla 4.4.5
php 8.1