BuddyDev

Search

[Resolved] Auto join groups – cron job

  • Participant
    Level: Initiated
    Posts: 2
    Darshan Makadia on #39385

    Hi, is there a way to setup a cron job to run the auto join groups function? I am using identity manager which creates users automatically when a new user is loaded there. And the auto list is not assigning users. So, thinking to setup a cron job to run this task frequently unless someone knows how to resolve this issue. Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #39386

    Hi Darshan,
    Thank you for purchasing the plugin.

    Our team will help you with the cron. Is there any way to know the list of newly registered users on your site via the identity manager?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Darshan on #39435

    Hi Brajesh,

    Could we setup a cronjob to go through all ‘subscriber’ role and auto-subscribe and auto-unsubscribe them based on the auto lists that I create which will have different conditions? If you prefer, I can connect over email.

    This way the system can auto join and unjoin automatically?

    Thanks

  • Participant
    Level: Initiated
    Posts: 2
    Darshan Makadia on #39446

    Hi Brajesh,

    Please let me know how I can setup Cron job. Thanks

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2934
    Ravi on #39452

    Hello Darshan,

    Please look at the following WordPress document that guides you in setting up corn jobs in WordPress. Please check and let me know if it helps or not.

    https://developer.wordpress.org/plugins/cron/

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 19
    Darshan on #39460

    HI Ravi,

    Thanks for your reply. What hook is available for auto join groups which I can use in the cron job function? If you have any sample that would be a great help

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #39462

    Hi Darshan,
    At the moment, the plugin runs on the three actions

    1. On Activation
    2. On profile Update
    3. On Member type change

    If you want I can add it on another action(a custom one)?( e.g bp_auto_group_user_updated)

    You can trigger this action for each user using the cron.

    The problem is running a cron and each time checking all users is not efficient or feasible for larger sites(say you have 50 k members).

    Using cron is fine as long as there is a way to know a small subset of users for which this event needs to be fired.

    Is there a way the plugin you are using for login can add a custom meta to user and we can use that to detect(and after updating them using cron, we can remove this meta).

    Please let me know if that is feasible?

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Darshan on #39463

    Hi Brajesh, we might have around 4000 users if everyone joins and it’s an internal only application. Scenario we have is that if a users changes their department or location of work (which will be updated automatically from other system) then their group subscription need to change for the relevant group for the new dept or location to which they belong to. That is why I am thinking of setting up a cron job so it runs and updates user group based on the latest profile.

    Hope that helps.

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #39464

    Hi Darshan,
    Thank you for the details.

    I have avoided sharing the code due to it being used for larger sites and having the side effect.

    I or Ravi will share a complete code example for you by day end tomorrow.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 19
    Darshan on #39465

    Thank you very much. Appreciate it

You must be logged in to reply to this topic.

This topic is: resolved