Cannot get information from FEU Module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Cannot get information from FEU Module

Post by KarlDD »

Hello Forum,

I've been having troubles with the FEU module,

First it wasn't able to retrieve the FEU details for the Orders Module order form, but that wasn't a big issue for me.

But not I'm trying to add FEU details to the Admin Email template in the orders module using this UDT but I keep getting the error that it cannot communicate with the FEU Module.

I'm beginning to pull my hair out because I'm not sure how to fix this!

I just want the FEU details to be emailed to the Admin.

My system is as follows:

Code: Select all

CMS Install Information
CMS Version		1.11.3

Installed Modules
CMSMailer		5.2.1
CMSPrinting		1.0.3
FileManager		1.4.2
MenuManager		1.8.4
MicroTiny		1.2.4
ModuleManager		1.5.5
News		2.12.10
Search		1.7.7
ThemeManager		1.1.7
SEOTools2		1.1.1
TinyMCE		2.9.11
CGExtensions		1.31.2
FrontEndUsers		1.21
FormBuilder		0.7.3
CGSimpleSmarty		1.5.2
JQueryTools		1.1.1
Products		2.18.4
CGEcommerceBase		1.3.11
CGPaymentGatewayBase		1.1
Orders		1.13.3
Cart		1.8.4
CustomContent		1.8.3
CGSmartImage		1.9.4
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1921
Joined: Mon Jan 29, 2007 4:47 pm

Re: Cannot get information from FEU Module

Post by Jo Morg »

Replace

Code: Select all

global $gCms;
$error = "";
$result = "";
$feusers = $gCms->modules['FrontEndUsers']['object'];
with

Code: Select all

$error = "";
$result = "";
$feusers = cms_utils::get_module('FrontEndUsers');
The UDT code is quite old and the methods deprecated... but the rest should work.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

Thanks for your reply, that fixed the error, but now I get this error from the UDT:

Code: Select all

[UDT get_feu_properties Error; Missing or empty parameter: username]
Any ideas why?

Thanks,
Karl.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1921
Joined: Mon Jan 29, 2007 4:47 pm

Re: Cannot get information from FEU Module

Post by Jo Morg »

KarlDD wrote:Thanks for your reply, that fixed the error, but now I get this error from the UDT:
Code:
[UDT get_feu_properties Error; Missing or empty parameter: username]
check this bit from the UDT:

Code: Select all

...
   $username = $params['username'];
   if ($username == "") {
      $error = " [UDT get_feu_properties Error; Missing or empty parameter: username] ";
....
$params['username']; is empty...

so it means you have to call the UDT with a paremeter called username
Parameters:

username (required): the Frontend Users username.
property (optional): the name of the property value to return as the result; When not specified, the result will be the Frontend Users uid.
method (optional): when not specified, the result is simply displayed; When method="assign", the value is returned in a Smarty variable with the same name as the property.

Usage:

To display the user id (uid) of a FEU user named "Frank" use:

{get_feu_properties username="Frank"}

To display the value of the property "phone_number" of the user "Jane" use:

{get_feu_properties username="Jane" property="phone_number"}

To assign the value of the property "email_addr" of the currently logged in FEU user use:

{get_feu_properties username=$username property="email_addr" method="assign"}

In this case nothing is displayed but instead the variable "$email_addr" now contains this users' email address.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

I wanted it to get the details from the logged in user, so this is how I set it up:

Code: Select all

{get_feu_properties username=$username property="first_name"}
{get_feu_properties username=$username property="last_name"}
{get_feu_properties username=$username property="address"}
{get_feu_properties username=$username property="phone"}
{get_feu_properties username=$username property="email"}
Is that not correct? Still have the error :/
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1921
Joined: Mon Jan 29, 2007 4:47 pm

Re: Cannot get information from FEU Module

Post by Jo Morg »

Where does $username comes from?
Put {$username} on the template. If it comes empty or null then it's not a valid Smarty variable.
Use {get_template_vars} to check what vars are available to you on a template, on a given context.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

I'm unsure how to get the username from the currently logged in user, the {$username} tag works in the FrontEndUser module templates but I don't know how to get the same property to work in the UDT, I'm stuck. :/
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

How can I get the username info from the current logged in user into this UDT?
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: Cannot get information from FEU Module

Post by rotezecke »

it looks like you dont need the username for the script, as the username is later converted to an ID which is what the rest of the script uses.

try this: remove

Code: Select all

   $username = $params['username'];
   if ($username == "") {
      $error = " [UDT get_feu_properties Error; Missing or empty parameter: username] ";
   }
   else {
      $uid = $feusers->GetUserID($username);
and replace with

Code: Select all

$uid = $feusers->LoggedInId();
i didn't quite follow (that is read) the entire post but maybe this helps.
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

ok, well that returns the id of the current logged in user, but if I try display any of the user properties its returns a blank field ?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Cannot get information from FEU Module

Post by calguy1000 »

How can I get the username info from the current logged in user into this UDT?

Code: Select all

$feu->LoggedInName();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

I still can't get it to display the selected category, I guess I'm jst going to have to call it quits on this one.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: Cannot get information from FEU Module

Post by rotezecke »

Assuming you applied the changes I posted before try this.
Add:

Code: Select all

print_r($properties);
after
$properties = $feusers->GetUserProperties($uid);

If that prints ok, work on the if statement within the foreach loop.
KarlDD
Forum Members
Forum Members
Posts: 15
Joined: Wed Jul 04, 2012 3:48 am

Re: Cannot get information from FEU Module

Post by KarlDD »

It's jusst doing the same thing, prints "6" which is the id of the logged in user, but still no properties :/
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: Cannot get information from FEU Module

Post by rotezecke »

hmm.

replace the print_r with:

Code: Select all

echo $feusers->GetUserPropertyFull(first_name,$uid );
or, since you pass on the paramenter when calling the UDT

Code: Select all

echo $feusers->GetUserPropertyFull($params['property'],$uid );
Post Reply

Return to “Modules/Add-Ons”