1. jimmywiddle
  2. Support
  3. Tuesday, September 15 2015, 08:12 PM
Hi,

I have a payment form on my site, some of the fields on that form are the same as those used on easyprofile.

Therefore id like the fields on the payment form that are also present on easyprofile to be autopopulated (the value to = corresponding easyprofile field).

With default joomla profile fields you can use in the value of the field:
<?php return JFactory::getUser()->get('name'); ?>

Is there something similar I can use with the easyprofile fields?

Many thanks in advance!
jimmywiddle Accepted Answer
Sorry, the code in my post got removed its:

<?php return JFactory::getUser()->get('name'); ?>
  1. more than a month ago
  2. Support
  3. # 1
admin Accepted Answer
Admin
Hi,
sorry for late reply,

you can use our API, try to read this docs: https://www.easy-profile.com/docs/38-jsnuser-object.html
  1. more than a month ago
  2. Support
  3. # 2
jimmywiddle Accepted Answer
Hi, Sorry still cant get this to work in either breezingforms or my payment form

The following code works as the value, and if the user is logged in, the email is added as the default value in the field.

<?php return JFactory::getUser()->get('email'); ?>


But I cant get it to work for fields other than name and email, ive tried different code such as, but as I say I cant get it to work.

<?php return JFactory::getUser()->get('phone'); ?>


Your assistance would be very much appreciated.
Many thanks!!!
  1. more than a month ago
  2. Support
  3. # 3
admin Accepted Answer
Admin
Hi,
try to read docs at https://www.easy-profile.com/docs/38-jsnuser-object.html

you can use code like this:
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$user=JsnHelper::getUser();
$user->getValue('name');
$user->getValue('email');
$user->getValue('phone');
  1. more than a month ago
  2. Support
  3. # 4
jimmywiddle Accepted Answer
Hi, The code below as the value for the field all dont work and most stop the page loading where this code appears.


<?php $user->getValue('phone'); ?>

<?php return $user->getValue('phone'); ?>

<?php echo $user->getField(phone); ?>

<?php return JFactory::$user->getField(phone); ?>

<?php return JsnHelper::$user->getField(phone); ?>


Once again your help would be much appreciated, many thanks!
  1. more than a month ago
  2. Support
  3. # 5
admin Accepted Answer
Admin
Hi,
have you included our library?
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');

Your code
1. 2. 3.
<?php $user->getValue('phone'); ?>
Have you populate $user var with JsnUser Object?

4.
<?php return JFactory::$user->getField(phone); ?>
This is wrong, you use user variable in JFactory class, correct is JFactory::getUser(), but this return JUser object and this not contain Easy Profile functions

5.
<?php return JsnHelper::$user->getField(phone); ?>
This is wrong, you must use something like this
<?php return JsnHelper::getUser()->getField(phone); ?>
  1. more than a month ago
  2. Support
  3. # 6
jimmywiddle Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 7
admin Accepted Answer
Admin
Hi,
can you please post me your site details*, also point me where is located your code and how to see this issue?

* You can use the form below the reply in "Site Details" tab
  1. more than a month ago
  2. Support
  3. # 8
jimmywiddle Accepted Answer
Thanks very much for this, site details attached
  1. more than a month ago
  2. Support
  3. # 9
admin Accepted Answer
Admin
Hi,
I have put this code and works:
<?php require_once( JPATH_SITE.'/components/com_jsn/helpers/helper.php' ); return JsnHelper::getUser( )->getValue( 'phone' ); ?>
  1. more than a month ago
  2. Support
  3. # 10
jimmywiddle Accepted Answer
Thanks so much!

Lastly, Is there any issue with my calling the require_once( JPATH_SITE.'/components/com_jsn/helpers/helper.php' ); for every other field on the form, I do already have this code in my template.
  1. more than a month ago
  2. Support
  3. # 11
jimmywiddle Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 12
admin Accepted Answer
Admin
Hi,
So sorry about all these questions, your be pleased to hear
No problem, this is our job :) . We think that all question in this forum are helpful for all our customer.

Is there any issue with my calling the require_once...
I don't know, when we have been in your backend, we seen the value for phone field (breezingforms) set to empty.

Id just like to fill the name and email of my livehelp with the name and email of the user if they are logged into joomla.
If your livehelp not load Joomla envirment then our APIs not works.

The are different possibilities:

1. Your livehelp create a iframe, you can pass in iframe src name and email of user. I think this is the most simple method, but you need to ask support at livehelp provider because the Javascript code that does this is minimized.

2. You can get Session id from cookie and get data from Joomla database, sessions are stored into #__session table, in this table there is column with various parameters coded in JSON format (also contain Name and Email of user). In theory we can do, but we have never studied this

3. You can fill data with Javascript, maybe in your joomla page you can put some hidden tag with user data and your livehelp can retrieve info from this. I'm not sure that it works, you use two different subdomains (www and secure) and there are some limitations of Javascript script
  1. more than a month ago
  2. Support
  3. # 13
jimmywiddle Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 14
jimmywiddle Accepted Answer
Sorry the code was stripped out of the end of my last post, here it is (hopefully!)

$user =& JFactory::getUser(); 

------JAVASCRIPT-------
..
LHCChatOptionsPage.attr_prefill.push({'name':'username','value':'<?php echo $user->name; ?>'});
..
-------ENDJAVASCRIPT
  1. more than a month ago
  2. Support
  3. # 15
admin Accepted Answer
Admin
Hi,
this works?
if yes you can improve by adding something to quote Name of user. Now if some name contain ' char, you will get a javascript error.
  1. more than a month ago
  2. Support
  3. # 16
jimmywiddle Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 17
admin Accepted Answer
Admin
No sorry, I don't know :( , you need to ask support at livehelp developer.

All javascript code is minimized and we don't know this product.
  1. more than a month ago
  2. Support
  3. # 18
jimmywiddle Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 19
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.