• How can I automatically assign the Post to registered group?
    I mean If the Post is created (through Registered user or through Form) than it should be assigned for registered user automatically?
    Groups – Read and the option should be Registered.
    At present I have to select Post and than assigned to registered.

    Many Thanks
    Amir

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kento

    (@proaktion)

    Hey Amir,

    Groups won’t do this automatically for you, but if you’re interested in a programmatic solution, you could craft a simple one based on the save_post action which would do

    Groups_Post_Access::create(
        array(
            'post_id' => $post_id,
            'group_id' => $group_id
        )
    );

    to assign the group restriction to the saved post. You’ll receive the $post_id obviously from the action and you can set the $group_id using Groups_Group::read_by_name( 'Registered' );

    Does that help?

    • This reply was modified 7 years, 1 month ago by Kento.
    Valdinia

    (@valdinia)

    Hi Kento,
    I have to restrict the visibility of a Post only to members of the Group of the current user. So how could I get the Group ID(s) of the user creating the post? (the currently logged-in user)

    Thank you

    Valdinia

    (@valdinia)

    I found the answer here: https://docs.itthinx.com/document/groups/api/examples/, see
    “Get all groups the current user belongs to”

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Created Post should automatically assigned to registered group’ is closed to new replies.