Tips and Tricks HQ Support Portal › Forums › WP eMember › WP eMember Tweaks › How do I set emember permissions when submitting a post via a form?
- This topic has 5 replies, 2 voices, and was last updated 10 years, 8 months ago by Donna.
-
AuthorPosts
-
March 6, 2014 at 6:47 pm #9968DonnaMember
Hi!
I am using a plugin that replaces the WP Dashboard post editor with a form for my members to submit content to my site. I need to set the emember permissions for the post when the form is submitted. I can add custom fields to the form but I don’t know how to reference that emember field.
Would this be done via a custom field? If so, what is the field name I should use? And would I set the default values to be numbers separated by commas? i.e. 2,3 (membership levels)
Hope that made sense!
Thanks!
March 7, 2014 at 12:45 am #61342adminKeymasterThis customization that you are doing is not going to be trivial unfortunately. emember sets permission through WordPress callback (when you save a post)… which will not be available in your case. It is not saved using custom fields.
You can save protection for a post then investigate how it is saved in the database by going to it via PHPMyAdmin and inspecting the tables.
March 7, 2014 at 8:57 pm #61343DonnaMemberThank you both for your responses. I believe I have a simple workaround I just want to make sure I’m not missing something important.
I have placed PHP emember code at the top of my single.php template file (it encompasses the entire page contents)….
<?php if(wp_emember_is_member_logged_in(‘3’)||wp_emember_is_member_logged_in(‘4’)) { ?>
So, even though the protection isn’t set when saving the post, the post template has the protection build into it. I have tested the process and it appears to work well and is adequate for my applicable. All “posts” will be using the same level of protection on my site anyway. Only “pages”, which use a different template file will require flexiblity with that.
My question for you is, have I lost any amount of security by doing it this way as opposed to physically setting the emember levels in the post editor? And if so, what?
Also, I have just discovered phpMyAdmin triggers and believe I could successfully update the post protection there when the new post is inserted. However, after looking for the post level settings there, I still can’t find the fields that store that information. Can you please tell me where to find it?
Thanks for your assistance,
Donna
March 7, 2014 at 10:16 pm #61344DonnaMemberRegarding the phpMyAdmin question: I finally found the field in question. So, I’m all set there.
Still need to know if I’ve lost any amount of security by setting the emember security level in the template file as opposed to physically setting the emember levels in the post editor? And if so, what?
Thanks again!
March 7, 2014 at 10:53 pm #61345adminKeymasterYou haven’t lost anything in my opinion.
March 7, 2014 at 11:13 pm #61346DonnaMemberOK, great! Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.