By Jamie Barker on Friday, 18 November 2022
Posted in Technical Issues
Replies 1
Likes 0
Views 471
Votes 0
Hi there,

After updating EasyBlog to v6, we wanted to make changes to the look of the email notifications, for example the "New Post" email.

We want to change the colour of the "View Post" button at the bottom of the email from the "primary" blue to our branded green, but cannot see how this is achieved.

From what I can work out, the button is generated via the "/foundry/themes/html/email/button.php" template file:
<td align="center" bgcolor="<?php echo $buttonColor->background;?>" role="presentation" style="border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:<?php echo $buttonColor->background;?>;" valign="middle">
<a href="<?php echo $link;?>" style="display: inline-block;background: <?php echo $buttonColor->background;?>;color: <?php echo $buttonColor->text;?>;font-family: Arial, sans-serif;font-size: 16px;font-weight: bold;line-height: 120%;margin: 0;text-transform: none;padding: 10px 25px;mso-padding-alt: 0px;border-radius: 3px;text-decoration: none;" target="_blank">
<?php echo JText::_($text);?>
</a>
</td>


How can we change the $buttonColor variable to our own colour? If we override this template and replace that variable with a hardcoded colour, that would mean every button will be coloured that way. Is there a way to only change the colour for the "New Post" email? In the "/com_easyblog/themes/wireframe/emails/post.new.php" template file, I can see the button is being inserted here with this code:

<?php echo $this->fd->html('email.button', 'COM_EASYBLOG_VIEW_POST', $templatePreview ? 'javascript:void(0);' : $blogLink, 'primary'); ?>


Changing "primary" to other variables takes effect (eg "danger" turns the button red) but how can we create a new variable to apply our changes to make the button a specific colour of green?

Thanks in advance for your assistance, please let me know if you need any clarification on the question.
You can refer to this file on how the default system style the view post button in the email.

JoomlaFolder/libraries/foundry/html/email.php (function button)

And I believe that you should know a bit of PHP and CSS knowledge, so you can apply the custom CSS styling to the email PHP file then override this file into the following file location so you do not need to reupdate this when you update your site Easyblog to the latest version in the future.

JoomlaFolder/templates/stackideas/foundry/html/email/button.php
·
Friday, 18 November 2022 12:55
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post