role expirations not showing up on customer page

Posts: 68
Joined: 11/26/2007

from the start of this long thread:

Quote:
Users can ... see the expiration date on their user page if permitted by admins.

I'm not seeing this. I've enabled 'view role expirations' in access control and cleared the cache. When I go to admin/user/user/expiration as admin, I see that 'customer' has an expiration set, but when I go to /user/# or /user/#/orders as 'customer' I don't see anything about it. What am I missing?

Posts: 332
Joined: 08/07/2007
Administrator

Hmm, it's probably because "Show expirations on user page" isn't checked in admin/store/settings/products/edit/features to display expirations. That should be checked by default. I'm updating bazaar to allow that.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 68
Joined: 11/26/2007

No, that's checked, too. Any other ideas?

Posts: 332
Joined: 08/07/2007
Administrator

Curious, what version of ubercart are you running?

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 68
Joined: 11/26/2007

uc 5.x-1.0-alpha8
drupal 5.3

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

It shows up for me, but when I try to edit a user, I'm greeted with this error if I leave the "Add/Remove time" fields empty (if I'm just editing a User's password, for instance):

The new expiration date, Dec 31 1969 - 5:00pm, has already occurred.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 332
Joined: 08/07/2007
Administrator

Yeah, I don't know how that one got missed. Good show! Bug fixes have been committed to bazaar.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 68
Joined: 11/26/2007

could the fact that I have a custom user_profile.tpl.php file be the reason I'm not seeing these?

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Sounds like it. I don't know what the $fields item is for the roles module display, but I'm sure it can be gotten easily.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 332
Joined: 08/07/2007
Administrator

Let's see if we can try to knock this one out. On line 236 in uc_roles.module alpha-8 you should see the start of the 'view' $op in the function uc_roles_user. Two functions are checked for TRUE conditions:

<?php
if (user_access('view role expirations') || variable_get('uc_roles_default_show_expiration',FALSE)) {
...
}
?>

If the user viewing the user page doesn't have the 'view role expirations' permission or the option "Show expirations on user page" isn't set in admin/store/settings/products/edit/features the role expirations won't be displayed.

I suggest going in the code and dropping some drupal_set_message() calls to see what's firing and what isn't to pinpoint what's going on. As far as the user_profile.tpl.php having an effect, I'm not sure but this will be one definite way to test what's going on in there. Good luck!

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 146
Joined: 11/10/2007
Bug Finder

warning: strtr() [function.strtr]: The second argument is not an array. in /home/u4/testingtgf/html/modules/ubercart/uc_roles/uc_roles.module on line 256.

I'm seeing this error message when logged in as Admin. I'm using Beta 1 Drupal 5.5
The error doesn't show with member or a custom role "moderator"

Anyone seen this?

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 332
Joined: 08/07/2007
Administrator

I haven't but I do know where the bug came from. It had to do with looking at user with no role expirations (in which case the translation array in strtr is empty). I've committed a bug fix for this to bazaar. Thanks!

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 146
Joined: 11/10/2007
Bug Finder

Great Thanks

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 146
Joined: 11/10/2007
Bug Finder

oppps The error is still there when logged in as admin

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 332
Joined: 08/07/2007
Administrator

Check your cache. If you're running the latest bazaar release, there's no way you could still be getting that error since the call to strtr has been removed from that line.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 146
Joined: 11/10/2007
Bug Finder

I don't use the cache feature but cleared it. I did upgrade to the latest bazaar release and the same error occurs.

Any ideas?

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 332
Joined: 08/07/2007
Administrator

The only thing else I can think of is to open up uc_roles.module and goto line 256. You should see:

<?php
...
return array(
variable_get('uc_roles_default_expiration_header',
uc_get_message('uc_roles_user_expiration_header')) => $items);
...
?>

If that's the exact line you see, then you must be receiving a similar error on a different line because there's no way you can be receiving that same strtr() warning if the function call doesn't exist on that line.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 146
Joined: 11/10/2007
Bug Finder

I reverted the uc_roles.module back to 12-31 bazzar and the error goes away. I will look over the code and see what's going on.

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 10
Joined: 01/10/2008
Bug Finder

I downloaded what I believe is the latest bazaar version of uc_roles.module (the date is 08-Jan-2008 10:16) and line 256 looks like this:

<?php
...
return array(
strtr(variable_get('uc_roles_default_expiration_header', uc_get_message('uc_roles_user_expiration_header')), $substitution) => $items);
...
?>

while I know it shouldn't. I'll manually change it to remove that function call. But am I missing something?

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

One of the pages about getting the latest code was out of date, and you probably got some old code. You can download the latest code tarball again from http://bazaar.ubercart.org/, or if you used Bazaar, run
bzr bind http://bazaar.ubercart.org/drupal5/ubercart
in the ubercart directory.

Posts: 24
Joined: 11/17/2007

i got this issue:

im not too smart about these things, but i want to make sure that im actually on some solid knowledgeable ground before i execute user roles prior to actually knowing if they are ok. lol

warning: strtr() [function.strtr]: The second argument is not an array. in .../uc_roles.module on line 256.

is this because of?:

1.uc_catalog module: not being "on" for public view? ie: view catalog checked on.
1.1 does it need to be on? is this a no brainer? "view catalog" MEANS viewable catalog.?

2.is it becuase uc_roles module isnt checked (ie:"view all role expirations")for public users/reg. users? giving them the right to: "view all role expirations"
2.2. and if it needs to be on. can i get a laymens terms as to why i would need this.

(on a side note, some of the documentation doesnt go into areas such as this, alot of the drupal and ubercart community has "laymans" terms but after the user has performed exhausting ounces of measure attempting to resolve these issues.)

3.i just now attempted to check or click on function.strtr actualy in the string of the warning code, and it doesnt do but it says,:

"You are not authorized to access this page."

no? i cant. that sucks. and if i could. how would i be able to.
is something micchecked somewhare not allowing me to "do that". its clickable so "someone or some people" can. right?

ugh....not too big of a deal i have alot of other areas of work to do before i get to this, but could someone help me out?

thanks,
ksprjms

Posts: 332
Joined: 08/07/2007
Administrator

Let me break it down for you.

1> The catalog module has nothing to do with this issue. It's merely a bug uc_roles module.

2> The permission "view all role expirations" needs to be checked to for whatever role you wish to view the expirations. In addition, "Show expirations on user page" needs to be checked in the product feature settings page (admin/store/settings/products/edit/features) under Role assignment settings > Expiration display to display the expiration information (it should be on by default now).

2.1> The reason for this is as follows. The "view all role expirations" permission is there to only give certain users permission to see when other user's roles expire. Otherwise, anyone (including anonymous users) could see this information. The permission exists for those who wish to restrict this information from prying eyes. In addition, some people might not want to display role expirations at all this is why the "Show expirations on user page" option exists.

3>The link to strtr(), I believe, is generated by PHP rather then Drupal. So I think the link it generates on errors will attempt to retrieve a page that doesn't exist in Drupal.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 24
Joined: 11/17/2007

what if i dont want anyone BUT the admin to view it? i dont see a check area that limits it to the admin section, im about to check this out in more detail, but this is just off the top of my head.

is their another area to troble shoot this?

re:"Show expirations on user page"
is this the answere? i havent gone to find this location, but just in case you get to me prior to my search, and execution of an "answere" whats your thoughts?
what location is this at?
this clears up the issue?

thanks again.

Posts: 332
Joined: 08/07/2007
Administrator

You don't want want anyone to view the expirations on the user pages but admins? Give admins a administer role with that permission. You don't want any admins to view expirations on user pages (but at admin/user/user/expiration)? Uncheck "Show expirations on user page".

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 24
Joined: 11/17/2007

i guess i was mostly asking if this was wrong or bad.
i guess its not bad or wrong to have these shown?
over all im asking which settings to make to accomidate the user role's error that i was having, however...i am going to update and install the bazaar mod. and see how this changes and effects the error string i have.

thanks for bearing with me people, i know im new, but im trying to find out all the information before updating, installing, editing hooks, and modules.

let alone even try and edit and provide my own strings, php/array/js/and other codes.

but dont worry, ill have an entierly new batch of goods once i get there.
haha

thanks again for the help, advice, and assistance.

Burnin' the midnight oil,
kasperjames

Posts: 22
Joined: 11/02/2007

Quote:
I'm not seeing this. I've enabled 'view role expirations' in access control and cleared the cache. When I go to admin/user/user/expiration as admin, I see that 'customer' has an expiration set, but when I go to /user/# or /user/#/orders as 'customer' I don't see anything about it. What am I missing?

I just had the same problem, and wanted to post my solution.

Basically i had the advanced_profile module (http://drupal.org/project/advanced_profile) enabled (but not setup)... so disabling it made everything appear as expected...

So make sure you don't have a user profile module enabled that may be overtaking the display.

Posts: 4
Joined: 08/11/2008

Hi duntuk,

do you have any idea what code to add to the advanced profile to display expiration on user profile?
Maybe code for block that can be included into adv_profile?

Thank you!!!