[Resolved] Need help setting up simple membership site

This thread is resolved. Here is a description of the problem and solution.

Problem: The user was trying to setup a simple membership website (where members can register and post new), searched the forum and tutorials and didn't find a definitive tutorial for doing this.

Solution: The tutorials are available now.

Relevant Documentation: How to build a directory and How to create a membership site

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 29 replies, has 4 voices.

Last updated by Agnes Bury 4 years, 11 months ago.

Assigned support staff: Adriano.

Author
Posts
#295233

If someone could please help me, I submitted another thread as you told me to but haven't had a response for two days: https://toolset.com/forums/topic/cred-form-creates-two-entries/

As I said above, trying to work out how to set up a membership site using your Toolset without a step by step guide is a nightmarish, long process using the support ticket system.

This is taking weeks, with proper documentation I could have finished this in a day.

Thanks

#295548

Waqas
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I apologize for the delay in this matter. I am referring this thread to our Senior Team Lead. He will be taking over and will resume the communication with you.

Thank you for your cooperation and patience. He will be with you soon.

#295577

Over two weeks of trying to get an answer to do something that should be absolutely straight forward. No documentation available for doing this, no tutorials, and after over two weeks of support requests still no-one can help me setup a simple membership site with an updateable profile.

Appalling.

#295611

peg

Hi mikes-12.

Let me try to help as I am sitting on a similar project. When I got you right you are basically trying to connect a "profile" to a user. Unfortunately we need a little workaround as long as toolset does not provide user functionality.

The way I set it up is that I created a custom user field "profile_id". (Make sure it is a user field)

In your functions.php add the following shortcode:

add_shortcode( 'wpv-post-profile-id', 'current_user_profile_id' );
function current_user_profile_id() {
    $id = get_current_user_id();
    $disp = get_the_author_meta( 'display_name', $id );
	
    $profile_id = get_user_meta($id, 'wpcf-profile_id', true);
    if (empty($profile_id)) {
        // create profile post		
        $profile_id = wp_insert_post(array('post_type' => 'author-profile' , 'post_title' => $disp));
        update_user_meta($id, 'wpcf-profile_id', $profile_id);
		
	   }
    return $profile_id;
}

Please replace 'author-profile' with the name of your CPT.

The way CRED now works is a bit different. You do not create a "create content" form. All you need is a "edit content" form since the shortcode will take care for creating a profile post if there is none created yet. So if your members submit the Edit form the profile is created (only one is possible) and is linked to their user meta throught the custom user field (profile_ID). The title of the new created profile post is in my case the display name of the user. You can, of course, use something else by changing $disp.

Hope this will help you. Let me know how it goes.
Peg

#295630

Hi Peg,

Thanks for the reply. I've created a new Usermeta Group 'Profiles', and added to this a custom user field "profile_id", 'numeric' type, types name 'wpcf-profile_id'.

I already have a post type called "Profiles", and Taxonomy Name 'Members', and into this I've already setup two categories - Community and Associate. I've also setup Custom Fields for profile details such as email, address, url etc.

I added your functions file, using my 'profile' CPT to replace 'author-profile' in your example. So I added this below to my functions file:

add_shortcode( 'wpv-post-profile-id', 'current_user_profile_id' );
function current_user_profile_id() {
$id = get_current_user_id();
$disp = get_the_author_meta( 'display_name', $id );

$profile_id = get_user_meta($id, 'wpcf-profile_id', true);
if (empty($profile_id)) {
// create profile post
$profile_id = wp_insert_post(array('post_type' => 'profile' , 'post_title' => $disp));
update_user_meta($id, 'wpcf-profile_id', $profile_id);

}
return $profile_id;
}

I added a test profile using my existing 'Community Member Profile' creation form and this did the same thing as before - it created a second blank version, and also members can still post as may profiles as they wish. Plus it still has the dropdown category selector. So the next thing I need to do is to setup the profile creation form you've suggested. Can you please tell me how to do this? This is what I have so far:

[credform class="cred-form cred-keep-original"]
[cred_field field="form_messages" value=""]
<div class="cred-field cred-field-post_title">
<label class="cred-label">
Organisation:
</label>
[cred_field field="post_title" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-post_content">
<label class="cred-label">
Profile description:
</label>
[cred_field field="profile-details" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-telephone">
<label class="cred-label">
Telephone:
</label>
[cred_field field="telephone" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-email">
<label class="cred-label">
Email:
</label>
[cred_field field="email" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-address">
<label class="cred-label">
Address:
</label>
[cred_field field="address" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-website-url">
<label class="cred-label">
Website URL:
</label>
[cred_field field="website-url" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-profile-pic">
<label class="cred-label">
Profile Pic:
</label>
[cred_field field="profile-pic" post="profile" value="" urlparam=""]
</div>
<div class="cred-group cred-group-taxonomies">
<div class="cred-taxonomy cred-taxonomy-member">
<div class="cred-header"><h3>Member Category:</h3></div>
[cred_field field="member" display="checkbox"]
</div>
[cred_field field="form_submit" value="Submit" urlparam=""]
[/credform]

The form is set to create content, post type 'profiles',.

I also have a version of this to 'edit' profiles. I realise I need to condense this now to a single form to create and edit profiles.

The form needs to be able to create a single, editable profile assigned to the logged in user that has created it, and it needs to be associated with the member group the logged in user is already asigned to. I already have a post type called "Profiles", and Taxonomy Name 'Members', and into this I've already setup two categories - Community and Associate. So a user in the Community group needs to be able to submit the form to the Community category, without the use of a dropdown.

If I need two separate forms for each member category (Community and Associate) that's not a problem for me, I just want the profile to submit to the correct category, only create a single copy (no blank duplicates), and set so that members can't create another one.

Thanks.

#295642

peg

Hi again,

It is far less complicated than you think. You only need one form. I have attached a screenshot displaying how I have set up my form. When a user now accesses this form and submits it then either the profile is created (done by the shortcode) or the post is updated (means the user can change entries at any time). The form keeps being displayed on this page.

You are getting double entries because you are still using the "create content" form.

Concerning the other solution to automatically assign your users/profiles to certain taxonomies - have a look into this post:
https://toolset.com/forums/topic/i-would-like-to-set-the-post-category-with-a-hidden-field-in-a-cred-form/
Could be the solution you are looking for. I have not tried that yet, though.

#295648

Hi Peg, thanks, I've setup a new form using the same settings as you've used in your screengrab (edit content, keep displaying form,post type setting - profiles/published), used the form builder wizard to populate the fields and added the shortcode to a page: [cred_form form="Member Profile"]

Problem is I'm just getting a blank page - no form is being displayed. I've no idea what I'm doing wrong, the structure seems very similar to my previous forms but there's nothing there - regardless of whether the user is logged in, has a profile or not. The form I created is below:

[credform class="cred-form cred-keep-original"]
[cred_field field="form_messages" value=""]
<div class="cred-field cred-field-post_title">
<label class="cred-label">
Profile Name
</label>
[cred_field field="post_title" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-post_content">
<label class="cred-label">
Profile Description
</label>
[cred_field field="post_content" post="profile" value="" urlparam=""]
</div>
<div class="cred-group cred-group-Profiles">
<div class="cred-header"><h3>Profiles</h3></div>
<div class="cred-field cred-field-telephone">
<label class="cred-label">
Telephone:
</label>
[cred_field field="telephone" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-email">
<label class="cred-label">
Email
</label>
[cred_field field="email" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-address">
<label class="cred-label">
Address
</label>
[cred_field field="address" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-website-url">
<label class="cred-label">
Website URL
</label>
[cred_field field="website-url" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-profile-pic">
<label class="cred-label">
Profile Pic
</label>
[cred_field field="profile-pic" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-profile-details">
<label class="cred-label">
Profile Details
</label>
[cred_field field="profile-details" post="profile" value="" urlparam=""]
</div>
<div class="cred-field cred-field-organisation">
<label class="cred-label">
Organisation
</label>
[cred_field field="organisation" post="profile" value="" urlparam=""]
</div>
</div>
<div class="cred-group cred-group-taxonomies">
<div class="cred-taxonomy cred-taxonomy-member">
<div class="cred-header"><h3>Members</h3></div>
[cred_field field="member" display="checkbox"]
<div class="cred-taxonomy-auxilliary cred-taxonomy-auxilliary-member_add_new">
[cred_field field="member_add_new" taxonomy="member" type="add_new"]
</div>
</div>
</div>
[cred_field field="form_submit" value="Submit" urlparam=""]
[/credform]

If you can spot anything amiss I'd love to get this sorted.
Thanks

#295650

peg

Sounds like Murphy's law. What can go wrong...

How did you include the form into your page?

If you go to the editor and select cred forms you need to take the "edit content" form.

Might be the reason. Other than this it can only be a naming issue. But I can only guess, sorry.

#295651

peg

Another try would be just to use your previous "create content" form (as I guess this one was displaying?) and simply let it not "create content" but "edit content".

#295654

I added the form using the 'edit content' option, this added some other options which didn't work so I finally used: [cred_form form="Member Profile"]

I'm completely stuck. I've been trying to get this to work after three long weeks, encouraged by the blog post about using Toolset for a membership form. Support seem to have given up, and there's no relevant documentation.

Thanks for your help though, maybe I'll get a response from paid support at some point that works.

#295661

peg

No worries. I am very familiar with your situation as I also only move forward with the help of try and error.
Fingers crossed that you can solve it.

#295684

Hi Peg - I took your advice above and tried the existing 'Community Member Profile' creation form and changed the settings from 'create content/display the post' to 'edit content/keep displaying this form' as you suggested I do with the new form. This works perfectly, and is only creating a single entry - so I've managed to fix that bit with your help.

It also seems to have fixed the multiple profile issue as well - when the user tries to submit a second profile, an option to edit the existing profile is shown rather than a form to add an additional profile. Looks like your single form suggestion, and probably the extra function worked. No idea why the new form didn't work but at least the old one with the new settings is doing the job.

Just had a reply from support, so I've also managed to get it to submit to a single custom post type category via my original support thread here: https://toolset.com/forums/topic/cred-form-creates-two-entries/

Seems like I've managed to fix all three issues...phew. Thanks for your help Peg.

I'm going to keep this thread open until I've finished more testing though, and still need to add a few tweaks.

#295705

peg

Hey, glad to hear that it worked. You are welcome.

#295871
#295896

Agnes Bury
Supporter

Languages: English (English )

Timezone: Pacific/Midway (GMT-11:00)

We are taking our customers complaints seriously. There are some changes planned in our CRED plugin to add all missing features to make creating membership sites possible without a pain. Then we will build a reference (demo) site and will write some tutorials.