Change default subscription settings
Quote from sequane on May 17, 2018, 5:52 pmHello,
I would like to know if it is possible to change the default subscription settings ?
Indeed, I would like that every time I create a new user, it is directly settled on “New Topics & Posts“.
Thanks in advance for your help.
Hello,
I would like to know if it is possible to change the default subscription settings ?
Indeed, I would like that every time I create a new user, it is directly settled on “New Topics & Posts“.
Thanks in advance for your help.
Quote from Asgaros on May 17, 2018, 9:13 pmHello @sequane
this is not possible at the moment. In a couple of countries – for example germany – there exists a lot of laws/rules which prohibits the sending of unwanted mails. This is the reason why all notification-functionalities are opt-in only. Changing this settings would require a custom implementation – but you have to keep in mind that you are responsible for all legal actions in this case.
Hello @sequane
this is not possible at the moment. In a couple of countries – for example germany – there exists a lot of laws/rules which prohibits the sending of unwanted mails. This is the reason why all notification-functionalities are opt-in only. Changing this settings would require a custom implementation – but you have to keep in mind that you are responsible for all legal actions in this case.
Quote from sequane on May 18, 2018, 9:29 amHi @Asgaros
Thanks for your answer and this additional information.
We use the forum in a special way to communicate with our customers and it is to warn them of a new message that we wanted to put this feature in place.
I will look if I can do it manually.Thank you again for this fantastic tool.
Hi @Asgaros
Thanks for your answer and this additional information.
We use the forum in a special way to communicate with our customers and it is to warn them of a new message that we wanted to put this feature in place.
I will look if I can do it manually.
Thank you again for this fantastic tool.
Quote from Asgaros on May 18, 2018, 10:28 amHello again @sequane
You can try to use the following code which you have to add to your themes functions.php file:
add_action('user_register', array($this, 'change_subscription_settings'), 10, 1); public function change_subscription_settings($user_id) { update_user_meta($user_id, 'asgarosforum_subscription_global_posts', 1); delete_user_meta($user_id, 'asgarosforum_subscription_global_topics'); }This should set the option for new users to “New topics & posts” when they register.
Hello again @sequane
You can try to use the following code which you have to add to your themes functions.php file:
add_action('user_register', array($this, 'change_subscription_settings'), 10, 1); public function change_subscription_settings($user_id) { update_user_meta($user_id, 'asgarosforum_subscription_global_posts', 1); delete_user_meta($user_id, 'asgarosforum_subscription_global_topics'); }
This should set the option for new users to “New topics & posts” when they register.
Quote from ray on September 24, 2018, 8:07 amI too am in a similar situation and need to change the default subscription.
I run a private forum. Its private because
1) it is members only (ie Forum visible to logged in users only is checked)
2) to become a member you must apply and be approved by a committee of management (ie no online registrations)
It is a condition of the paid membership is that all members accept email communications as approved by the committee of management (in the same way as snail mail is delivered).
All WP user records are added via the WP admin UI and not via a registration form.
So I need a way to change the default subscription to ‘new topics’ instead of ‘individual subscriptions’ and the best time for this to happen for me is when the member is assigned to a ‘members’ usergroup (as distinct from moderators and/or administrators) as I have ‘Add new users automatically’ checked to assign new members to this ‘members’ usergroup.
Is their a ‘add user to user group’ equivalent to the ‘user_register’ hook that I could try in the above code for when a member is added to a particular forum user group?
If not is their an alternate way?
thanks for your help
I too am in a similar situation and need to change the default subscription.
I run a private forum. Its private because
1) it is members only (ie Forum visible to logged in users only is checked)
2) to become a member you must apply and be approved by a committee of management (ie no online registrations)
It is a condition of the paid membership is that all members accept email communications as approved by the committee of management (in the same way as snail mail is delivered).
All WP user records are added via the WP admin UI and not via a registration form.
So I need a way to change the default subscription to ‘new topics’ instead of ‘individual subscriptions’ and the best time for this to happen for me is when the member is assigned to a ‘members’ usergroup (as distinct from moderators and/or administrators) as I have ‘Add new users automatically’ checked to assign new members to this ‘members’ usergroup.
Is their a ‘add user to user group’ equivalent to the ‘user_register’ hook that I could try in the above code for when a member is added to a particular forum user group?
If not is their an alternate way?
thanks for your help
Quote from Asgaros on September 24, 2018, 11:41 amHello @ray
Currently there is no such hook available. If you want I can add an additional hook which can be triggered when an user is added to a specific group (based on its ID).
Hello @ray
Currently there is no such hook available. If you want I can add an additional hook which can be triggered when an user is added to a specific group (based on its ID).
Quote from ray on September 24, 2018, 12:24 pmHi Thomas
That would be fantastic.
I’m out of action for the next couple of weeks so no particular rush.
thanks
R
Hi Thomas
That would be fantastic.
I’m out of action for the next couple of weeks so no particular rush.
thanks
R
Quote from Asgaros on September 25, 2018, 11:28 amHello @ray
I added two new hooks to the development version of the plugin. The IDs of usergroups are now also shown inside the administration area. It might take a while until the release of the next update but you can download a stable development version which contains those changes here:
https://github.com/Asgaros/asgaros-forum/archive/acedec03c7ccfe5bb3861e8b19393812a9b8398b.zip
The hooks are the following:
- asgarosforum_usergroup_###ID###_add_user: Gets executed after adding an user to an usergroup of the given ID.
- asgarosforum_usergroup_###ID###_remove_user: Gets executed after removing an user from an usergroup of the given ID.
You have to replace the ###ID### with the ID of the specific usergroup for which you want to execute custom actions.
The hooks take two arguments, the first one is the ID of the user and the second one is the ID of the usergroup.
Hello @ray
I added two new hooks to the development version of the plugin. The IDs of usergroups are now also shown inside the administration area. It might take a while until the release of the next update but you can download a stable development version which contains those changes here:
https://github.com/Asgaros/asgaros-forum/archive/acedec03c7ccfe5bb3861e8b19393812a9b8398b.zip
The hooks are the following:
- asgarosforum_usergroup_###ID###_add_user: Gets executed after adding an user to an usergroup of the given ID.
- asgarosforum_usergroup_###ID###_remove_user: Gets executed after removing an user from an usergroup of the given ID.
You have to replace the ###ID### with the ID of the specific usergroup for which you want to execute custom actions.
The hooks take two arguments, the first one is the ID of the user and the second one is the ID of the usergroup.
Quote from ray on September 25, 2018, 12:33 pmHi Thomas
Thank you so much for your prompt response
But I have reached a a knowledge limit.
I have installed the development version and all looks good. The Id i want is 42 (from the admin screen).
So – assuming I am correct in thinking that what I have to do is –
My hooks become asgarosforum_usergroup_42_add_user($user_id,42) and asgarosforum_usergroup_42_remove_user($user_id,42)
But I don’t know how to turn this into php code to put in my child theme functions.php file .
So , one more favour please, what is the php code I need to use?
R
Hi Thomas
Thank you so much for your prompt response
But I have reached a a knowledge limit.
I have installed the development version and all looks good. The Id i want is 42 (from the admin screen).
So – assuming I am correct in thinking that what I have to do is –
My hooks become asgarosforum_usergroup_42_add_user($user_id,42) and asgarosforum_usergroup_42_remove_user($user_id,42)
But I don’t know how to turn this into php code to put in my child theme functions.php file .
So , one more favour please, what is the php code I need to use?
R
Quote from Asgaros on September 25, 2018, 4:13 pmHello again @ray
An example code could look like this:
function do_something($user_id, $usergroup_id) { do_something_with_user($user_id); do_something_else($user_id, $usergroup_id); } add_action('asgarosforum_usergroup_42_add_user', 'do_something', 10, 2);
Hello again @ray
An example code could look like this:
function do_something($user_id, $usergroup_id) { do_something_with_user($user_id); do_something_else($user_id, $usergroup_id); } add_action('asgarosforum_usergroup_42_add_user', 'do_something', 10, 2);