Support

  1. webarts
  2. Bug Report
  3. Monday, November 25 2019, 11:35 AM
Hello

I created one field name is company

And when I retrieve the field in external php file its not give the value

require_once JPATH_BASE . 'components/com_jsn/helpers/helper.php';
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');

$userf = JsnHelper::getUser();

echo $userf->getField('company');

echo "<pre>";print_r($userf);

But nothing is working

Let me know how to get the custom field value
admin Accepted Answer
Admin
Hi and sorry for late reply,
In which file do you put this code?
  1. more than a month ago
  2. Bug Report
  3. # 1
webarts Accepted Answer
Pro
Hello

/home/cys/public_html/genmem/vendor/WatermarkPDF/WatermarkPDF.php

In this file and I have some custom codes like I did below

define('JPATH_BASE', '/home/cys/public_html/');
require_once JPATH_BASE . 'components/com_jsn/helpers/helper.php';
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');

$userf = JsnHelper::getUser();
echo $userf->getField('company');
echo "<pre>";print_r($userf);

But it not give all fields value of current logged user

Thanks
  1. more than a month ago
  2. Bug Report
  3. # 2
admin Accepted Answer
Admin
Hi,
this file seems external to Joomla environment, so the the JsnUser Object will not works.

To use Joomla libraries and extension's functions you should load Joomla environment
  1. more than a month ago
  2. Bug Report
  3. # 3
webarts Accepted Answer
Pro
Hello

define('_JEXEC', 1);
define('JPATH_BASE', '/home/cys/public_html/');
require_once JPATH_BASE . 'includes/defines.php';
require_once JPATH_BASE . 'includes/framework.php';
require_once JPATH_BASE . 'components/com_jsn/helpers/helper.php';
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');


I added joomla framework but its not working
  1. more than a month ago
  2. Bug Report
  3. # 4
admin Accepted Answer
Admin
Hi,
in your code have not created the application instance, try to add following code after include framework.php:
$app = JFactory::getApplication('site');


Also, we recommend to enable PHP errors to see where are the errors :)
  1. more than a month ago
  2. Bug Report
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Online

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.