[Solved] Do FEU user props still work in CGUserDirectory?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Utter
Forum Members
Forum Members
Posts: 41
Joined: Sun Mar 06, 2005 11:39 pm

[Solved] Do FEU user props still work in CGUserDirectory?

Post by Utter »

Hi all,

I have just upgraded a fairly elderly site that used FEU and UserDirectory modules in tandem. On a user profile page, a UserDirectory detail template allowed a logged in user to view their profile details but rather than just dumping info to the page via the foreach I used this code:

Code: Select all

{capture assign="userid"}{$oneuser.id}{/capture}
{$feu_smarty->get_user_properties($userid,'userprops')}
to pipe specific FEU user properties into a table like this:

Code: Select all

<td class="profile-detail-value">{$userprops.email_address}</td>
After I updated the two modules and all the other main modules like CGExtension/SimpleSmarty etc. the profile page showed a blank.

The changelog of FEU at version 1.29 states:

Code: Select all

{$feu_smarty->get_user_properties($uid,'props')} must now be called like: {$props=feu_smarty::get_user_properties($uid)}
But when I rewrote my own code to

Code: Select all

{capture assign="userid"}{$oneuser.id}{/capture}
{$userprops=feu_smarty::get_user_properties($userid)}
it borked the page again and it's only when this piece of code is in the template that the problem occurs.

Have I made a mistake in rewriting this code or do FEU properties no longer work the same way in UserDirectory?

The Apache error logs were spectacularly unhelpful and I have not come across another query of this nature on the forums.

My relevant system data is:

CMS Version 1.12 / CGExtensions 1.50 / CGSimpleSmarty 1.9.1 / FrontEndUsers 1.30.6 / CGUserDirectory 1.5

Current PHP Version (phpversion) 5.5.9-1ubuntu4.14

Thanks in advance.
Last edited by Utter on Thu Jan 14, 2016 4:55 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Do FEU user properties still work in CGUserDirectory?

Post by calguy1000 »

welcome back utter. I will Look at this tomorrow.
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.
Utter
Forum Members
Forum Members
Posts: 41
Joined: Sun Mar 06, 2005 11:39 pm

Re: Do FEU user properties still work in CGUserDirectory?

Post by Utter »

Thanks, Robert.
Utter
Forum Members
Forum Members
Posts: 41
Joined: Sun Mar 06, 2005 11:39 pm

Re: Do FEU user properties still work in CGUserDirectory?

Post by Utter »

Robert,

I had another bash at generating some errors for the log and got this which may help:

Code: Select all

[Thu Jan 14 07:36:10.449456 2016] [:error] [pid 3037] [client 91.108.183.34:51823] PHP Notice:  Trying to get property of non-object in /var/www/html/tpb/tmp/templates_c/1ed9b7e2d86c34f9dab8c572f920035e590a161e.tpl_body.27.php on line 179, referer: http://xxx.xxxxx.co.uk/my-profile
[Thu Jan 14 07:36:10.449469 2016] [:error] [pid 3037] [client 91.108.183.34:51823] PHP Stack trace:, referer: http://xxx.xxxxx.co.uk/my-profile
[Thu Jan 14 07:36:10.449484 2016] [:error] [pid 3037] [client 91.108.183.34:51823] PHP   1. {main}() /var/www/html/tpb/index.php:0, referer: http://xxx.xxxxx.co.uk/my-profile
[Thu Jan 14 07:36:10.449500 2016] [:error] [pid 3037] [client 91.108.183.34:51823] PHP   2. Smarty_CMS->fetch() /var/www/html/tpb/index.php:243, referer: http://xxx.xxxxx.co.uk/my-profile
[Thu Jan 14 07:36:10.449517 2016] [:error] [pid 3037] [client 91.108.183.34:51823] PHP   3. Smarty_Internal_TemplateBase->fetch() /var/www/html/tpb/lib/classes/class.Smarty_CMS.php:341, referer: http://xxx.xxxxx.co.uk/my-profile
[Thu Jan 14 07:36:10.449533 2016] [:error] [pid 3037] [client 91.108.183.34:51823] PHP   4. content_56978366d2a7a0_71279906() /var/www/html/tpb/lib/smarty/libs/sysplugins/smarty_internal_templatebase.php:182, referer: http://xxx.xxxxx.co.uk/my-profile
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Do FEU user properties still work in CGUserDirectory?

Post by calguy1000 »

Just tested the CGUD Detail view.

This code worked fine to view the user properties:

Code: Select all

{$props1=$oneuser.properties}
<p>First Name = {$props1.first_name}</p>
{debug_display($props1,'props1')}
As did this code (returned exactly the same results).

Code: Select all

{$props2=feu_smarty::get_user_properties($oneuser.id)}
<p>First Name = {$props2.first_name}</p>
{debug_display($props2,'props2')}
Note. I have a property called first_name in my setup. prolly different in your install.
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.
Utter
Forum Members
Forum Members
Posts: 41
Joined: Sun Mar 06, 2005 11:39 pm

Re: Do FEU user properties still work in CGUserDirectory?

Post by Utter »

Robert,

thanks for that - page is back as it was now.

Can I conclude then that it's the Smarty {capture} syntax that's changed? I should have checked whether there was an update to capture but I just looked now and the syntax does seem different.

Now I just need to work out why none of the form fields appear on the Orders billing/shipping forms and I'm done :)

Thanks again.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Do FEU user properties still work in CGUserDirectory?

Post by calguy1000 »

Can I conclude then that it's the Smarty {capture} syntax that's changed? I should have checked whether there was an update to capture but I just looked now and the syntax does seem different.
Well, no the capture syntax has not changed... but variable scoping has changed, depending on what you were upgrading from and how your templates are organized etc. various things that did work in very old versions of CMSMS will have to be adjusted for newer versions. Typically even those changes are minor once you wrap your head around them.

{capture} is slow, and by and large should not be used. Smarty3 has more optimal ways to copy data around.

{$myvar=$oneuser.id} would do the trick in your case. but again, wasn't really necessary in the example you provided as $oneuser.id works fine.
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.
Post Reply

Return to “Modules/Add-Ons”