latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

1 Registration form that decides access level

Home Forums Community Forum 1 Registration form that decides access level

This topic contains 17 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 2 months ago.

Topic Author Topic
Posted: Friday Sep 28th, 2012 at 12:10 pm #26855
Raz R
Username: raz110

Dear All

I am interested in getting your members plugin

What I wanted to know is, will your plugin fulfill this scenario out of the box:

1) I want to look some pages (by making 2 different types of user acess levels/groups, which are not charged for)

2) I need to make a registration form which visitors will access all via the front end.

3) The registration form should be able to have drop downs and check boxes (as I have one type of user who I dont want to access the full protected site, which I will be able to identify from their drop down selection)

4) Then after they have filled in their registration form, I want the member plugin to automatiacally do one of the following two scenarios

a) Give full access to the newly registered member (so to put them in user group 1)
b) To not give full access to the newly registered member based on them selecting a certian category from the drop down option at registration (so this would put them in user group 2)

Please let me know if this is possible

I am guessing this is something to do with if statements and conditional access

List Of Topic Replies

Viewing 17 replies - 1 through 17 (of 17 total)
Author Replies
Author Replies
Posted: Saturday Sep 29th, 2012 at 6:35 pm #26973

Hi Raz.

1) I want to look some pages (by making 2 different types of user acess levels/groups, which are not charged for)

You mean “lock”? Yeah, you can protect pages with levels that users can have. This doesn’t require s2Member Pro.

2) I need to make a registration form which visitors will access all via the front end.

Ah, s2Member Pro has the pro-forms, which allow registration (paid or free) on the front end.

3) The registration form should be able to have drop downs and check boxes (as I have one type of user who I dont want to access the full protected site, which I will be able to identify from their drop down selection)

The pro-forms don’t have dropdowns for type of access, but you can add drop downs for profile fields using the s2Member custom profile fields. [hilite path]Dashboard -› s2Member® -› General Options -› Registration/Profile Fields[/hilite]

These profile fields can’t be used with the access restrictions, but you can definitely use them in conditionals to protect content.
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals[/hilite]
[hilite path]Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants[/hilite]

You could also use custom capabilities and do a customization that allows the user to pick them before purchasing.
Video » s2Member (Custom Capabilities)
http://www.primothemes.com/forums/viewtopic.php?f=36&t=1604

4) Then after they have filled in their registration form, I want the member plugin to automatiacally do one of the following two scenarios

a) Give full access to the newly registered member (so to put them in user group 1)
b) To not give full access to the newly registered member based on them selecting a certian category from the drop down option at registration (so this would put them in user group 2)

a) Yes. When the user gets the level required for the protected content, he will have access to it.

b) Yes, either because he got the level for the other content, or because your conditional checks his choice in the custom profile field. If you used custom capabilities, then pages/posts can be protected with these too, but can also be used in conditionals.


Let us know if you have more questions. I hope that helps. :)

Posted: Monday Oct 1st, 2012 at 11:20 am #27084
Raz R
Username: raz110

Dear Support, thanks for your answer.. I do not mind buying your product if it matches my needs.. Quick question about licensing, if I buy the Single-Site License, but then realise I need multi site license, do you allow for smooth upgrading by paying the difference?

Now about the registration forms that I require..

1) Its ok if the form doesn’t offer drop down selectors (as check boxes will be sufficient), but drop downs would be ideal on the registration form. I will write the spec below assuming only check boxes are allowed on the registration form

2) I saw the videos about conditionals

3) Below is a more clear picture of what I want to achieve

===

I want to have only 1 registration form on the site not two. To view protected pages, the user must register

I will make two access levels for the site (this can be done by conditions if it has to)

I need the registration form to have 4 different check boxes

If the any of the first 3 check boxes are selected then the user will get access to (level 1)

If the 4th check box is selected then the user will get access to (level 2)

This is because the site’s registration is for the financial services sector (which has strict regulations, so if someone selects check box 4, they should not be allowed to see the pages that (level 1) has access to

Is there a way I can add a validation for only 1 tick box to be selected on this registration form (as the 4th check box enables a different access level, if selected)

If this is all possible, please let me know, how I would set this up, THE MAIN thing is I can only have one registration form in total on the site.

Please view this image to see the website menu structure and below it, it shows the 4 membership types and how I want to split the access. The site only has 3 protected pages in total

http://privatepaste.com/download/8137b97923

===========

Once the above site is accomplished, I have another website (again for the financial industry, so has strict guidelines), which will require the following; We dont have to go into details for this one just yet, as the site above is a priority of mine.

Only 1 registration form for the site

Form will contain different check boxes (which will represent 10 different countries)

The site will have 3 different access levels (which give access to different protected sites)

From the 10 check boxes, different access levels will automatically be assigned upon registration based on which check box (country has been selected)

So example,
if someone selected any of these :UK, USA or France they access to (level 1)
if someone selects any of these: UAE, Qatar or Malaysia they get access to (level 1 and 2)
if someone selects any of these : Luxembourg, Sweden, Germany or other country they get access to (level 3)

THE MAIN thing is I can only have one registration form in total on the site.

Posted: Monday Oct 1st, 2012 at 6:44 pm #27148
Raam Dev
Username: Raam
Staff Member

Hello,

s2Member allows you to create Custom Registration Fields and display those fields as checkboxes, drop-downs, or text fields on the Pro-Forms (requires s2Member Pro) that you display for registration. However, there are no options for setting the Membership Level based on the selection of those fields. If you require this, you will need to hire a programmer to create such a customization.

if I buy the Single-Site License, but then realise I need multi site license, do you allow for smooth upgrading by paying the difference?

Yes, after purchasing the single-site license, there is an upgrade button available inside your account that is configured for the difference in the price between the two licenses.

Posted: Tuesday Oct 2nd, 2012 at 5:13 am #27180
Raz R
Username: raz110

Dear Support, thanks for your reply. Ok that is established now, so my solution would be to make a pricing like table first on the registration page, which describes the 4 types of users I have

Then from there, those who select options 1 – 3 from the pricing table will be taken to registration form 1

and those who select option 4 will be taken to registration form 2

===

Please tell me, will your team be able to do the customisation for site 1 I described yesterday, if so, how much $$

Thanks

Posted: Wednesday Oct 3rd, 2012 at 3:44 am #27297
Raam Dev
Username: Raam
Staff Member

Hello,

We do not provide installation services (please see Support Policy). If you need to hire a programmer, we recommend posting your job on jobs.wordpress.net.

Posted: Thursday Oct 4th, 2012 at 8:51 am #27436
Raz R
Username: raz110

Ok, I got the pro version and have installed it, but I could not find out how to do something

I want to put my login form into a page (can this be done simply via a short code, please tell me how, thanks)

Posted: Friday Oct 5th, 2012 at 3:29 am #27532
Raam Dev
Username: Raam
Staff Member

Hello,

s2Member Pro comes with the s2Member Pro Login Widget (see Dashboard -> Appearance -> Widgets) but that will require a widgetized area of your theme (such as the sidebar or footer; however you can also add custom widgetized areas by editing your theme).

Otherwise, s2Member uses the WordPress login page (wp-login.php) and offers customization options in Dashboard -› s2Member® -› General Options -› Login Registration Design. If you want to create your own custom login page, you’ll need to find a plugin that does that, or hire a programmer to code one for you.

The Pro Login Widget can also be called via PHP (see this thread), which you may be able to use in a page if you also install the Exec-PHP Plugin.

Posted: Monday Oct 8th, 2012 at 10:49 am #27799
Raz R
Username: raz110

Hi there, I have set up s2 member pro and made the front end login via the exce-php plugin + short code and then modifying the CSS style sheet associated to it

I also have made a pre registration page, found here http://bit.ly/Q8heGa

I only need 2 access levels as previously described (which I am using custom capabilities for)

But as I have 4 different types of investors and for the financial regulations I need to make sure they login only after they specify which type of investor they are, so I have made 4 separate front end login forms

THE ISSUE I AM HAVING is, that I need to be able to make sure that in my database (Browse Members area of the Dashboard), I can see what URL they came from. In normal forms, this would be a siteID via a hidden field

Is there a way I can add this siteID to each form, which will then be added to the database

One crude way I can think of is to add a new “Ccap” for each form, and this will then be displayed on the datbase, but I prefer to have this showing up in its own field in the Browse Members section of the dashboard as siteID

Thanks

Posted: Monday Oct 8th, 2012 at 1:37 pm #27811
Raz R
Username: raz110

Hi another important question,

In the functions.php file, I have added the code as instructed from your youtube video to not allow a user who doesnt have the required custom capability (this works)

WHAT I WANT TO DO IS: redirect the users who do not have the required custom capability to a page within my site, opposed to their membership options page, please tell me what code I should modify from the one I am using below. I tried to edit the location redirect, but it seems I was doing it wrong.

/**

 START Membership Access Restrictions

**/


add_action ("template_redirect", "my_custom_capabilities");

function my_custom_capabilities ()

{
	if(is_page("12") && !current_user_can ("access_s2member_ccap_qualified_investor"))
	{
		 header( "Location: ". S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) ;
		 exit ();
		
	}



}




/**

 END Membership Access Restrictions

 **/
Posted: Tuesday Oct 9th, 2012 at 3:48 am #27859
Raam Dev
Username: Raam
Staff Member

THE ISSUE I AM HAVING is, that I need to be able to make sure that in my database (Browse Members area of the Dashboard), I can see what URL they came from. In normal forms, this would be a siteID via a hidden field

This would best be handled by a WordPress Custom User Field somewhere on the account. This is really outside the scope of the s2Member plugin and I personally wouldn’t recommend using an s2Member Custom Registration Field for this, since it’s really an administrative field holding administrative data that only admins should see. I definitely would not recommend using Custom Capabilities for this.

The PHP code for detecting the URL they came from is relatively straight forward ($_SERVER[‘HTTP_REFERER’]), but plugging that into the WordPress login process involves familiarity with your custom code and with how WordPress stores data in Custom User Fields. The WordPress Codex and WordPress Support Forums may be helpful, but I can also recommend wordpress.stackexchange.com.

please tell me what code I should modify from the one I am using below. I tried to edit the location redirect, but it seems I was doing it wrong.

To accomplish that you simply need to change this line:

header( "Location: ". S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) ;

To something like this:

header( "Location: http://example.com/some-other-page/") ;
Posted: Wednesday Oct 10th, 2012 at 7:01 am #27972
Raz R
Username: raz110

Hi, thanks for your reply, In regards to the redirection of URL for those who do not have the custom capability I found out why the redirection was not working, it was because I added the ccap requirement into the page on the top right here http://privatepaste.com/download/dda1316a99

So it seems if someone adds a Ccap there it clashes with code if added to the functions.php , by not allowing the custom redirection to take place

===
What I wanted to know is, how can I;

a) Add a login link to the bottom of each of my pages, and then if someone is logged in, that link will dissapear, preferably by a shortcode that I put into each page via the wordpress dashboard>pages section

b) Add the name of users into certain pages content, I am not using the firstname field that came with s2, instead I made my own field called full_name (thats the unique id)

c) How can I add a menu item thats only visible for logged in members, as I want to add a menu item called Logout

Thanks

Posted: Wednesday Oct 10th, 2012 at 1:11 pm #28003
Raz R
Username: raz110

Hi there, regarding the 3 questions I mentioned earlier, I have solved 2 of them

a) I solved this by using the shortcode

[s2If !is_user_logged_in()]
Add content here for non logged in users
[/s2If]

c) I solved this by getting this plugin http://wordpress.org/extend/plugins/baw-login-logout-menu/ which makes a menu that dynamically changes from login to logout depending on the users role.

BUT PLEASE do tell me another way to do this so I can add more control to this menu functionality

===

Point b) from my previous post I still have not solved, which adding the registered users full name inside certain pages, and if they are not logged in then nothing would be displayed in place, this would be example on the first few words of the opening sentence of certain pages

Posted: Wednesday Oct 10th, 2012 at 8:57 pm #28053
Raam Dev
Username: Raam
Staff Member

Point b) from my previous post I still have not solved, which adding the registered users full name inside certain pages, and if they are not logged in then nothing would be displayed in place, this would be example on the first few words of the opening sentence of certain pages

You can do that with a snippet of PHP (echo S2MEMBER_CURRENT_USER_FIRST_NAME;), or if you need echo a Custom Registration Field that you created you’ll need to use the S2MEMBER_CURRENT_USER_FIELDS array and pull out the necessary field. Please see Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants.

Keep in mind that you’ll need to be using the Exec-PHP Plugin to run PHP code inside a WordPress Post/Page.

Posted: Thursday Oct 11th, 2012 at 12:35 pm #28143
Raz R
Username: raz110

Hi, thanks, I am using this shortcode [s2Get user_field="full_name" /] to display the full name, but how do I make it show the first character of name as capitals, I entered them as capitals when logging in but the names are displayed as lower case

Thanks

Posted: Thursday Oct 11th, 2012 at 12:52 pm #28145
Raz R
Username: raz110

Ignore my last question, if I get problems I will let you know, by the way, when I tried this it didnt work

and this didnt work either

but this worked?

[s2Get user_field="full_name" /]
Posted: Thursday Oct 11th, 2012 at 12:52 pm #28146
Raz R
Username: raz110

Ignore my last question, if I get problems I will let you know, by the way, when I tried this it didnt work

<?php echo S2MEMBER_CURRENT_USER_FULL_NAME; ?>

and this didnt work either

<?php echo S2MEMBER_CURRENT_USER_full_name; ?>

but this worked?

[s2Get user_field="full_name" /]
Posted: Friday Oct 12th, 2012 at 4:44 am #28197

Ah, the [hilite mono]S2MEMBER_CURRENT_USER_FULL_NAME[/hilite] constant doesn’t exist, that’s why it didn’t work. [hilite path]Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants[/hilite]

But the [hilite mono]full_name[/hilite] field does so the shortcode worked. If you want to do it with PHP, you can use [hilite mono]get_user_field[/hilite]. http://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_get_user_field()

[hilite pre_code]

[/hilite]

I hope that helps. :)

Viewing 17 replies - 1 through 17 (of 17 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.