PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Custom expected formats for registration fields

s2Member Plugin. A Membership plugin for WordPress®.

Custom expected formats for registration fields

Postby niallw » January 14th, 2012, 11:04 am

Hi there.

Really enjoying the quality of this plug-in.

Just wanted to know if there was a way to add custom formats to registration fields. There are several covered, however, I was wondering if there was a way to add your own?

Wanting to ensure that the entry ties in a password that will have been sent to the user from another site.

thanks,

niallw
User avatar
niallw
Registered User
Registered User
 
Posts: 8
Joined: January 3, 2012

Re: Custom expected formats for registration fields

Postby Raam Dev » January 17th, 2012, 2:09 pm

Hi niallw,

Glad to hear you're enjoying the plugin! :)

Are you referring to the Expected Format: drop-down box when adding a new Custom Registration Field? What kind of format are you wanting to add?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Custom expected formats for registration fields

Postby niallw » January 17th, 2012, 2:50 pm

Hi there.

Thanks for getting back.

It would be if the first two characters were letters and the next 6 were numbers. Or similar.

Could you help with a query on advanced conditionals if possible. It's just an if else statement to redirect to a certain page based on membership level. I've been trying location headers but I am getting errors. Someone suggested wp_redirect function. Would/should this work?

Sorry if explanation poor. I can post code if required.
User avatar
niallw
Registered User
Registered User
 
Posts: 8
Joined: January 3, 2012

Re: Custom expected formats for registration fields

Postby Raam Dev » January 18th, 2012, 1:18 pm

Yes, please post the code and I'll take a look.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Custom expected formats for registration fields

Postby niallw » January 18th, 2012, 2:38 pm

Hi there,

The code i've been trying is as follows

Code: Select all
<?php if (current_user_can("access_s2member_level1")){
    header("address here");
} else {
    header("address here");
} ?>


I have also tried this having read other forums

Code: Select all
<?php if (current_user_can("access_s2member_level1")){
wp_redirect( a url() ); exit;
}else{
wp_redirect( another_url() ); exit;
} ?>


I have installed the php exec plugin but get this error:-

Warning: Cannot modify header information – headers already sent by (output started at /homepages/39/d372554375/.............../template-full-width.php:7) in /homepages/39/d372554375/................./wp-content/plugins/php-execution-plugin/includes/class.php_execution.php(273) : eval()’d code on line 29
User avatar
niallw
Registered User
Registered User
 
Posts: 8
Joined: January 3, 2012

Re: Custom expected formats for registration fields

Postby Raam Dev » January 18th, 2012, 10:51 pm

You cannot use that code inside a WordPress post because the browser has already output data, thereby rendering redirect functions like header() useless (that's why you're getting the cannot modify header errors).

You might be able to use that code if you manually edit your theme templates and add the code there.

The alternative for redirecting inside a WordPress post is to use JavaScript. See here for an example: viewtopic.php?f=4&t=16867&p=60929#p60929
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Custom expected formats for registration fields

Postby niallw » January 19th, 2012, 5:26 am

Hi there,

I looked at the topic you posted and generated the following code. Is this right?

Code: Select all
<?php
$redirect_url = "http://www.url.co.uk/?page_id=53" . S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 1 . "/";
?>
<script type="text/javascript">

window.location = "<?php echo $redirect_url; ?>";

</script>


All that happened was the same page loaded, without any content and it kept trying to load like the javascript was stuck in a loop.

I literally want to redirect, almost skip, the login welcome page if they have access level 1

I looked at the options for specific redirection url in the login welcome page. Surely this would solve the issue as it would direct to a specific page based on user level. Here is the url i typed in.

http://www.url.co.uk/?page_id=53/%%current_user_level%%/s2member_level1/

this didnt work either.

There must be a solution to this. I know I'm new and probably missing the obvious.

Appreciate ongoing help.

niall
User avatar
niallw
Registered User
Registered User
 
Posts: 8
Joined: January 3, 2012

Re: Custom expected formats for registration fields

Postby Raam Dev » January 19th, 2012, 11:08 pm

niallw wrote:I literally want to redirect, almost skip, the login welcome page if they have access level 1

I looked at the options for specific redirection url in the login welcome page. Surely this would solve the issue as it would direct to a specific page based on user level. Here is the url i typed in.

http://www.url.co.uk/?page_id=53/%%current_user_level%%/s2member_level1/

this didnt work either.


I misunderstood earlier what you were trying to do. If you don't want to use the Login Welcome Page at all, then using the Special Redirection URL with Replacement Codes is exactly what you should be using.

Could you try using this URL:

Code: Select all
http://www.url.co.uk/?page_id=53/s2member_level%%current_user_level%%/


Then, make sure the s2member_level1 page actually exists so when the redirect happens it goes somewhere.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Custom expected formats for registration fields

Postby niallw » January 20th, 2012, 2:57 am

When you say s2 member level 1 page exists , do you mean it is in the comma separated list of page ids that have s2 member level 1?

With this special redirection URL on, will those logging in with level 0 still see the login welcome page?

How do you go about setting up more than 1 special redirection URL?

Thanks

Niall
User avatar
niallw
Registered User
Registered User
 
Posts: 8
Joined: January 3, 2012

Re: Custom expected formats for registration fields

Postby niallw » January 20th, 2012, 9:24 am

I am using the sidebar login widget as recommended by you guys. Does this have an effect on the way s2member functions?

With regard to the url you suggested, should the actual user level not be included and read s2member_level_1 like this??

http://www.url.co.uk/?page_id=53/s2member_level_1%%current_user_level%%/

You can assume from these questions that I still havent solved it!! So stupid!

Niall
User avatar
niallw
Registered User
Registered User
 
Posts: 8
Joined: January 3, 2012

Re: Custom expected formats for registration fields

Postby Raam Dev » January 23rd, 2012, 2:00 pm

Hi Niall,

%%current_user_level%% gets replaced with the user level of the user currently logged in.

If my user level is 4, %%current_user_level%% will be replaced with 4.

If my user level is 1, %%current_user_level%% will be replaced with 1.

So, let's say I have a user level of 3 and I login. If your special redirection URL is set to this,

http://www.url.co.uk/?page_id=53/s2member_level_1%%current_user_level%%/

Then I will be redirected to this,

http://www.url.co.uk/?page_id=53/s2member_level_13/

Does that make sense? Not really, no! What you want is this:

http://www.url.co.uk/s2member_level_%%current_user_level%%/

So now, when I login, I will go to this page:

http://www.url.co.uk/s2member_level_3/

However, you need to do two things:

1) Configure permalinks so you're not using ?page_id=53
2) Create a WordPress page for each of your s2Member Levels. If you have 3 levels, you will need to create three WordPress pages: s2member_level_1, s2member_level_2, and s2member_level_3. If those pages don't exist, then the redirect won't go anywhere.

Does that make sense?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron