News:

Looking for documentation? Take a look on our wiki

Main Menu

[Off Topic] General Joomla! Question

Started by oneyozfest182, June 01, 2017, 18:28:43 PM

Previous topic - Next topic

oneyozfest182

I'm so sorry for posting here, but the Joomla! forums keep giving me 403 errors for some reason, and everyone here is always super helpful, so I thought I'd try posting my question here and seeing if anyone can help me. Sorry if this is against the rules; feel free to remove and I'll totally understand.

Hey all; I use Smooch for a web support chat on my site, and all used to work fine, but after updating to PHP 7.0.15 and Joomla! 3.7.2, suddenly the PHP I use to pull their username into Smooch.

This is the code I used:
<script src="https://cdn.smooch.io/smooch.min.js"></script>
<script>
Smooch.init({appToken: 'INTENTIONALLY OMITTED', givenName: '<? echo $user->name ?>', email: '<? echo $user->email ?>', emailCaptureEnabled: 'Yes', customText: {
    headerText: 'Chat with Customer Support', settingsText: 'You can also leave us your e-mail address so that we can get back to you later.', messageIndicatorTitleSingular: '({count}) New Message', messageIndicatorTitlePlural: '({count}) New messages', introText: 'To help us better serve you, please provide us with your account number if you have it available. Feel free to ask us anything\; we\'re here to help!',
}, properties: {
        'Account Number': '<? echo $user->username ?>'
    }
});
</script>


I used to have to place that inside of the <head> content in index.php and everything worked fine, but now after updating, it seems PHP is just completely ignoring that script and the output is literally <? echo $user->name ?>, etc. instead of the PHP displaying the proper values. Is there something I'm doing wrong?

Side-note: Someone also said I should be able to put them inside a custom module so they survive updates, (since index.php is overwritten each update), using $user =& JFactory:;getUser(); as well, somehow, (I'm clueless on PHP, though), so if we sort this out and someone could help me out with this as well, that would be fantastic!

Thanks again, so much, in advanced, for any help. :)

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

GJC Web Design

try

<?php echo $user->name ?>

assuming $user is available
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

Ghost

You can't post on Joomla forum because your post contains <script> tags. You can break them (e.g. change to <s cript>) and it will allow you to post.

oneyozfest182

Quote from: GJC Web Design on June 01, 2017, 22:21:32 PM
try

<?php echo $user->name ?>

assuming $user is available

This was indeed the issue! I was using short code.  :-X

Quote from: Ghost on June 02, 2017, 07:46:35 AM
You can't post on Joomla forum because your post contains <script> tags. You can break them (e.g. change to <s cript>) and it will allow you to post.

Is there any chance that by trying too many times, I got banned? I can't access forum.joomla.org at all from my office anymore, (though I can on my cell, and my USER isn't banned).