Closed (fixed)
Project:
Taxonomy Access Control Lite
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2011 at 22:24 UTC
Updated:
10 Jul 2013 at 09:20 UTC
I'm needing to be able to programmatically load a user, modify their tac_lite permissions, then save it again. The problem is that I can't seem to find a way to do this. I set up the tac_lite array on the $user object like so:
$user->tac_lite[1][105] = 105;
This, in theory, should grant the user the privelage of viewing nodes tagged with a tid of 105. Unfortunately, as it would turn out, this property does not get saved at all, either in $user->data (which it appears that tac_lite makes use of) or in $user->tac_lite (it's simply empty). I'm not sure if this should be an issue, or if I'm simply doing it wrong. But my overall goal is that this must be done programmatically.
Comments
Comment #1
Dave Cohen commentedThe right way is to use drupal_execute(). It's complicated, but it is the right way to do this sort of thing in Drupal.
Comment #2
jerdiggity commentedJust saw you on IRC (@ShooterMG)... Wondering if it worked or not.
Incidentally, @Dave: would something like this work or no?
Comment #3
Dave Cohen commentedI dunno. Let us know. The only technique I'd recommend is
drupal_execute(), or whatever it now is in D7.Comment #4
tharna commentedI got it working like this (on d7):
Comment #5
kotnik commentedBased on #2, this works for D6:
Comment #6
tinker commented