Hello @menzah
You should create a new PHP file (e.g. my-forminator.php) with the following exact content:
<?php
add_action( 'formiantor_cform_user_registered', 'my_custom_function', 10, 1);
function my_custom_function( $user_id ) {
// do something with $user_id
// e.g. add it to a group like this
groups_join_group( 'Students', $user_id );
}
and upload it to the /wp-content/mu-plugins/ folder of your server.
Details: https://wordpress.org/support/article/must-use-plugins/
The action hook used in there is the “formiantor_cform_user_registered”.
At this moment we don’t have any documentation about action hooks.
Thank you,
Dimitris
Thread Starter
menzah
(@menzah)
Thank you I’ll let you know.
I’ve few ideas to enhnce your plugin if you you wish to know i’ll send a document to you.
Thread Starter
menzah
(@menzah)
Dear, as I mentioned before I can’t find this location. Since I don’t have “mu-plugins” folder. I can only find the folder “plugins” in my folder WordPress/public_html/wp-content/, where I can see the folder forminator among other plugins installed.
I’m sorry for this @menzah
You can simply create the /wp-content/mu-plugins/ folder if it does not exist already, I apologize for not being clear on that.
Thank you,
Dimitris
Thread Starter
menzah
(@menzah)
I’m sorry to keep on negging for help. Since I’ve created 2 registration forms. Each one for an existing BuddyPress group. I added a hidden field with constant value 0 for the first group and 1 for the second group, I don’t know where or how to add the form identifier in the code, so I shall be able to add the correct BuddyPress group name.
Thank you
Hi @menzah
It seems there is a typo on the shared code, it is:
forminator_cform_user_registered instead of formiantor_cform_user_registered
In case you have multiple forms, we can basically create a conditional.
<?php
add_action( 'forminator_cform_user_registered', 'my_custom_function', 10, 2);
function my_custom_function( $user_id, $custom_form) {
$formId = (int)$custom_form->id;
if($formId === 346){
groups_join_group( 'Students', $user_id );
}elseif($formId === 123){
groups_join_group( 'Students', $user_id );
}
}
Replacing the number and groups_join_group( ‘Students’, $user_id ); to the correct group.
Let us know if you have any further question on this.
Best Regards
Patrick Freitas