Hi, support,
Finally, I have now a basic membership site, (by following Toolset membership site tutorial), everything works fine.
Now I want to add some kind of sub-accounts or "account extensions" inside user's accounts for some specific type of users.
Already I have sub-account for affiliates ( it is a complete solution by another 3rd party plugin, It just needed to put shortcode into the visual editor cell), but also I need a similar layout for business entities ( Partners).
Beyond default users' account features (publishing, commenting, etc.), business users (Partners) should have some Access option to participate in other features such as "online auction" (another 3rd party plugin) ...
In short, I need a registration form (inside of member dashboard) for business users who will participate in some additional action such as an online auction (also in all usual features for as all other registered members).
I've started to create a part for this but it's a bit confusing to my level of Toolset knowledge.
So far I have created: new custom Access role for business users (Partner), new user custom Type's fields exclusively for them (Partner registration), custom user form for Partner registration.
But what now?
I need that feature works similarly to existing basic features like with installed affiliate 3rd party plugin in another tab which has already function like sub-account (please see screenshot attachments):
-1. the tab for that is already created (Partner Program)
- 2. inside of the tab of "Partner program" needs a message that logged users can become "Partner and link for registration" (similar as in affiliate registration)
-3. then opening registration form inside tab or separate page (when user click on registration as a Partner)
- 4. finally visible data from registration inside that tab, (after user's sub-registration)
Also how to create restricted access role to some specific functional part such is auction form (3rd part plugin) only for registered business Partners ( i don't know can I provide it only with Toolset Access)
Thanks in advance for helpful tips!
Sinisa
You can create Edit User CRED forms to accomplish this. Add the Edit User CRED forms in each tab to collect additional information. When the form is submitted, the form can be set up to automatically change the User's role, or you can use CRED Commerce to require the User to pay a fee:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/
In these tabs, you can turn forms on or off, or display the collected information instead of the CRED form using inline Access Controls or conditional HTML:
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Hello Christian,
Thank you for help, I've created as you suggest me, but how to create a possibility to change an user role with Edit user form?
I don't know how to set up automatically a change to the new User's role...? I need change after submitting from "Contributor" to "Partner" role.
I don't see any option for that...
P.S.
As You can see, I put control inside content field by Access wrapp codes
Thank you very much in advance,
Sinisa
Changing the User's role requires some custom code. To change from "contributor" to "partner", you can add this code to your child theme's functions.php file:
add_action('cred_save_data', 'cred_update_contributor_to_partner_role_action',10,2);
function cred_update_contributor_to_partner_role_action($user_id, $form_data) {
if ($form_data['id'] == 12345)
{
// modify the user role from contributor to partner
$u = new WP_User( $user_id );
$u->remove_role( 'contributor' );
$u->add_role( 'partner' );
}
}
Replace '12345' with the numeric ID of this CRED form.
Hello Christian,
Thank you for custom PHP code, I think it fits well (see attachment)...
Also, I've learned a lot from your support, many thanks...
But (always some but), I am receiving popup error message after click on "submit" ("There was an error while submitting the form").
I think is not related to the custom php.code because it shows even before pasting that code...
I've checked Access and custom roles but I cant find what cause error. Maybe "a bug" from my another open support thread?
What do you think?
Okay if it's happening even without this custom code, there must be something else going on. One way to help figure that out is to activate server logs, then submit the form again to try to reproduce the error. If any server-side errors are thrown, the logs will include that information. If you're not familiar with server logs, I can show you how to activate them. Go in your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:
define('WP_DEBUG', true);
Then add these lines, just before it says 'stop editing here':
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
Update wp-config.php on the server, then resubmit the form to reproduce the error. Now look in the root directory of your site for a new file called "error_log.txt". Feel free to open a new ticket to discuss the results in that log.
Done! ? Thank you for your effort!
Here is from 'error_log.txt' (it seems as the same error like the reported bug in my other thread 'with */1/c/5/*):
[05-Mar-2018 20:58:29 UTC] PHP Notice: Undefined offset: 2 in /customers/1/c/5/geoproblem.one/httpd.www/wp-content/plugins/types-access/includes/Helper.php on line 3750
[05-Mar-2018 20:58:29 UTC] PHP Fatal error: Uncaught Error: Call to undefined method CRED_Form_User::try_to_update_relationships_by_id() in /customers/1/c/5/geoproblem.one/httpd.www/wp-content/plugins/cred-frontend-editor/application/models/form/user.php:344
Stack trace:
#0 /customers/1/c/5/geoproblem.one/httpd.www/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(392): CRED_Form_User->save_form(2)
#1 /customers/1/c/5/geoproblem.one/httpd.www/wp-content/plugins/cred-frontend-editor/application/controllers/form_builder_base.php(47): CRED_Form_Base->print_form()
#2 /customers/1/c/5/geoproblem.one/httpd.www/wp-content/plugins/cred-frontend-editor/application/controllers/ajax/form_ajax_init.php(28): CRED_Form_Builder_Base->get_form(2231, 2)
#3 /customers/1/c/5/geoproblem.one/httpd.www/wp-includes/class-wp-hook.php(286): CRED_Form_Ajax_Init->register_entry_point('')
#4 /customers/1/c/5/geoproblem.one/httpd.www/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#5 /customers/1/c/5/geoproblem.one/httpd.www/wp-includ in /customers/1/c/5/geoproblem.one/httpd.www/wp-content/plugins/cred-frontend-editor/application/models/form/user.php on line 344
P.S.
I've open another ticket about this problem as you suggested me in your last post. I will mark this post as resolved, if everything works after.
Okay thanks, the Fatal Error is something I can reproduce with CRED 2.0-b1, Views 2.6-b3, and Types 2.3-b3 active. I'm passing that information along to my 2nd tier support team for investigation. I'll update you as soon as I hear something.
Our developers have acknowledged this urgent issue in the betas and will address it in an upcoming beta release. If a code patch is provided before the beta release, I will update you here. Thanks for your patience.
Ok, Chris! Thank you for a prompt info ...
Regards,
Sinisa
Hello Chris,
Waiting for the beta update takes a long time.
Will switching to production solve the problem?
I tried to switch to production plugins, but beta plugins stay...
Do I need to delete all plugins, and reinstall them, and will that action solve my problem till new beta updates?
Thanks,
Sinisa
Yes, if you want to revert to the production releases, you must first delete the beta plugins from your site. You will be unable to utilize any of the updated M2M post relationship features of the beta plugins.
Hello, just a quick update to let you know that CRED 2.0-b2 is now available. Please update all beta plugins to the latest versions to receive the fix for this issue.
Hi Chris!
I've made new beta update... But no changes, everything is the same (with bugs)... 🙁
Also I noticed that update doesn't end even after 15 minutes of waiting, but after page reload, update seems ok, but as I mentioned above, bugs remain.
Sinisa
Hi, could you provide an updated error log like before? I would like to confirm the source of the error.