Skip Navigation

[Résolu] Membership with Cred commerce and Access

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created Il y a 10 années et 5 mois. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 17 réponses, has 2 voix.

Last updated by Pat Il y a 10 années et 3 mois.

Assisted by: Luo Yang.

Auteur
Publications
#153729

Pat

Hello,
I need to built a paid membership site and would like to know if I can do this with the Toolset.
What I need is to offer a yearly calendar membership (from Jan, 1st to Dec, 31st) and let people that have subscribed (paid) the ability to have access to specific part of the site (pages, posts ...). So, I need to define the start date and the end date of the subcription.
Thanks to tell me if this is possible and if I need other plugin than Toolset to perform this.
Pat

#154431

Hi Pat,

It is not possible within Toolset, and I am not sure it is possible with other plugins
You can try search in wordpress plugins:
http://wordpress.org/plugins/search.php?q=subscription

Or try the official Toolset Custom Development Services
hidden link
or our certified partners.
https://toolset.com/consultant/

#154450

Pat

Hello,
First of all, I'm surprised with this answer as I ask the same question in the "pre sales" contact form and everything was feasible!

I was thinking to create a product with the subscription price within Woocommerce, and then a form with CRED Commerce and assign the product to the form. What I need to know is how I can change the custom field linked to the "role" that have to be assigned to the member in the end of the order validation process.
Regards
Pat

#154455

Pat

Hello Luoy,
Just to give you additionnal info on this : the start date is not mandatory in this case. If I create a product, that would be for a specific year. The only point that bother me is what I was describing in my preview post (the way to change the "role level" of the member in the end of the order validation process) and the other point is that, if we cannot define an end date for the subscription, is it possible to create a form that would change the "role level" for all members (of a specific role) in the same time (meaning avoid the admin to have to go to each member and change the role level manually). I think this could be an acceptable solution for my client.
Regards
Pat

#154493

Pat, you can see our site https://toolset.com/
is using woocommerce + toolset + a custom subscription system(which created with custom php codes)

The subscription system we are using, also have same feature you mentioned above.

If you are not a PHP coder, as I suggest above, please
try the official Toolset Custom Development Services
hidden link
or our certified partners.
https://toolset.com/consultant/

#154568

Pat

Hello luoy,

Is there a list of the custom fields used by access in order to see if I can use them for this purpose within my form.
Thanks
Pat

#154993

Pat , what is the "my form" you mentioned above?
If it is a CRED form, Access can control it's user access,
More help:
https://toolset.com/documentation/user-guides/access-control-for-cred-forms/

#155021

Pat

Hello Luoy
In the meantime, I've found that all custom fields are listed in the database, so it's OK for me on this.
My remaining question concerns which custom field I have to use to change the role level for a user (ie : I want to move him from level 1 to level 2 for example).
If you have this info, that would be great to share it.
Many thanks.
Pat

#155527

The user role is stored in your database table "wp_usermeta", "meta_key" is wp_capabilities

#155539

Pat

Thanks luoy,
And how can I change this within a Cred form ?
Regards
Pat

#155825

Please try use CRED action hook:
cred_save_data
Hook to do custom action when post data are saved to database.
https://toolset.com/documentation/user-guides/cred-api/

#157328

Pat

Hi luoy,
Looking at the URL you gave me, I have a question : I understand I can modify any table field with the CRED hook. Now, what type of code do I have to use in the hook in order to change the value of a user meta data? The example in your URL shows something related to a specifiy type and not for a user.
Thanks
Pat

#157565

Pat, Please try use WP function update_user_meta() to change the value of a user meta data
http://codex.wordpress.org/Function_Reference/update_user_meta

#162135

Pat

Hello luoy,
As I need to make the action only after payment is received, I choose this code :

add_action('cred_commerce_after_payment_completed', 'affectation_membre',10,2);

function affectation_membre($post_id, $form_data)
{

if ($form_data['id']==279)
{
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
wp_update_user ( array ( $user_id, 'role' => 'membre' ));
}
}
Unfortunately, this is not working and the role is not modified (I tried to finalised the order in my Woocommerce admin, but this does not change anything). Is there any mistake in my code ?
Thanks.
Pat

#162434

I suggest you try debug your codes line by line,

1)

...
echo $user_id = $current_user->ID; die();
...

Make sure it outputs the current ID

2) wp_update_user ( array ( $user_id, 'role' => 'membre' ));
it should be something like this:

update_user_meta( $user_id, 'wp_capabilities', 'membre' );

http://codex.wordpress.org/Function_Reference/update_user_meta

Le forum ‘Types Community Support’ est fermé à de nouveaux sujets et réponses.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.