Since og_expire_set() is invoked by cron, it probably shouldn't use the access check: user_access('administer organic groups'). Forcing admin access also prevents using og_expire_set() from various user-driven contexts where the current user isn't an admin.

Comments

idcm’s picture

@justin2pin, did you patch your instance of this module? If so, will you share it back? What problems did it create for you? The maintainer looks to be unavailable for comment and I am interested in this module.
thanks

tinker’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new4.37 KB

Ran into this problem a while back but never got around to posting a patch. Basically I have created a new function og_expire_set_cron which allows changes to be made by anonymous user (as in the case of cron). og_expire_set remains the same in functionality but reuses og_expire_set_cron to make the changes if the user has permission. og_expire_cron now uses og_expire_set_cron. og_expire_set_cron can also be used by other modules.

This patch assumes code format changes from #1145702: Module does not follow Drupal code format standards

jhrizz’s picture

Hello,

Could this be described a bit more?

I am interested in having the OG Expiration duration to be determined based on a the features of Ubercart product, based on UC OG Subscribe (with the OG Expire mods applied). Or, in the mean time, I would take a blanket policy that would make ANY group memberships added, expire based on the offset policy set in the OG Expire module.

Right now, expirations are not being entered automatically via either the UC OG Subscribe + OG Expire or the OG Expire defaults.

Am I missing a step? Do I need to call this API? Set a conditional action? Cron is running, and all other cron tasks are executing.

Thank you in advance to your help!

tinker’s picture

@jhrizz First you need to apply the patch I created to OG_Exipre. If you are using UC_OG_Expire you will have to modify it slightly. I believe (from memory) that you have to search for "og_expire_set" and replace it with "og_expire_set_cron".

The problem is that the original "og_expire_set" needs a user id to set the expiration and when UC_OG_Expire uses it in a CRON run there is no user and therefore the expiration is not set.

Let me know if you get it working or not. I am no longer using it on site but can look up the code from an archive if this does not work for you.

jhrizz’s picture

Thank you!

I will test and get back to you!

Again, thanks!

- jr

jhrizz’s picture

StatusFileSize
new42.58 KB

So-

I thought I had it working- I could manually add a user to a group, and a date would be entered, but it was today's date, it trigger all CAs and expired immediately.

So I started from scratch- uninstalled, deleted, re-downloaded the most recent DEV version of both modules, uploaded, applied all patches (including the code cleanup patch) and installed, only to get nada. Ran update.php and cron.php a few times (more to vent frustrations) and still nothing.

If I manually edit a user, it goes to the default values set in the module and values are recorded to the DB. Likewise, if I create expiration values on the group subscription feature, all values are recorded to the DB.

I did get errors when applying the og_expire_cron-673988-2.patch but I went back and made changes manually.

Group subscription purchases are kicking it off, either.

Should I not be using DEV versions? I feel I have missed something silly!

I have attached both module folders to this post, if you would care to take a look. Let me know if you think you can help, and if you feel the scope of work is too great, I may be willing to make it worth your while.

Thanks again!

- Josh

tinker’s picture

StatusFileSize
new13.28 KB
new12.13 KB

Sorry @jhrizz I should have looked at the new uc_og_subscribe code. It appears that the module has changed significantly since my implementation and no longer supports og_expire. I have attached my last working implementation from archives but you should probably not use it. There are known problems with the code. I tried to implement generic drupal date formats, with multi-select dates, but did not complete it. I know that admin edit of expire dates does not work. Do not use this on a live site.

The uc_og_subscribe code was surely changed for a good reason and the archives I have attached will probably be a step back in many ways. I don't have the time to check over it right now so I don't know why the features were removed. The attached code may be a good starting point to create a new patch for the current versions which is why I am providing it. Basically I was trying to change all text input dates to use drupal date multi select inputs.

The proper next steps would be to find out why og_expire features were dropped, see if they can or should be reinstated, if so port the patches to the new code, fix all the date inputs, test, and hopefully have a working version.