Community Support Forums — WordPress® ( Users Helping Users ) — 2011-09-21T23:59:42-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=14973 2011-09-21T23:59:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=38911#p38911 <![CDATA[Re: level 1 access via email activation link]]>
Also, is it possible to still use Cristian's hack to automatically log the user in when they click on that link you created, then navigating to a page to activate them using your code. The code for the hack I was using was in this file (s2hacks.php in mu_plugins):

<?php
add_action('ws_plugin__s2member_during_configure_user_registration_front_side', 's2_auto_login_after_registration');
function s2_auto_login_after_registration($vars = array()) {
wp_set_auth_cookie($vars['user_id'], false, is_ssl());
wp_redirect('http://www.domain.com/welcome' . '?first');
exit;
}
?>

OR, is there a trigger in s2member for logging in the first time (only)?

Statistics: Posted by antseo — September 21st, 2011, 11:59 pm


]]>
2011-09-21T20:24:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=38904#p38904 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by Bruce C — September 21st, 2011, 8:24 pm


]]>
2011-09-21T20:15:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=38903#p38903 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by antseo — September 21st, 2011, 8:15 pm


]]>
2011-09-21T19:56:19-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=38900#p38900 <![CDATA[Re: level 1 access via email activation link]]> viewtopic.php?f=4&t=15226

Statistics: Posted by Bruce C — September 21st, 2011, 7:56 pm


]]>
2011-09-16T18:52:59-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37350#p37350 <![CDATA[Re: level 1 access via email activation link]]>
So only members who have level 0 privilege (they've signed which means they can log in) and who do not have admin role will be upgraded. Based on that logic, what can be changed on the following to make it so that if an admin hits that script on a page, he does not downgrade his role?

This does not seem to work:

[s2If current_user_is_not(administrator)]
[s2If current_user_is(s2member_level0)]
<?php $user = new WP_User(wp_get_current_user()->ID);
$user->set_role("s2member_level1"); ?>
[/s2If]
[/s2If]

Statistics: Posted by antseo — September 16th, 2011, 6:52 pm


]]>
2011-09-16T17:48:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37348#p37348 <![CDATA[Re: level 1 access via email activation link]]>
<?php
if (!empty($_REQUEST['id']))
{
$user = new WP_User($_REQUEST['id']);
$user->set_role("s2member_level1");
}
else
{
//Regular content
}
?>

I'm just trying to hit that page via the url such as http://www.domain.com/page?id=50

But the user does not upgrade from level 0 to level 1 now.

Did any recent upgrade to s2member prevent that code from working. I have php execution installed and can run php on a page (tested in using hello world script).

Statistics: Posted by antseo — September 16th, 2011, 5:48 pm


]]>
2011-09-16T10:33:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37319#p37319 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by antseo — September 16th, 2011, 10:33 am


]]>
2011-09-15T22:59:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37282#p37282 <![CDATA[Re: level 1 access via email activation link]]>
http://example.com/my-page?id=%%user_id%%

Statistics: Posted by Bruce C — September 15th, 2011, 10:59 pm


]]>
2011-09-15T09:53:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37242#p37242 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by antseo — September 15th, 2011, 9:53 am


]]>
2011-09-14T23:23:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37232#p37232 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by Bruce C — September 14th, 2011, 11:23 pm


]]>
2011-09-14T06:44:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=37186#p37186 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by antseo — September 14th, 2011, 6:44 am


]]>
2011-09-14T00:29:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35948#p35948 <![CDATA[Re: level 1 access via email activation link]]>
What might be causing that is that you're using the $_GET method for it. If you want to do it like that, try using the $_REQUEST['']; function instead, which can be used for both post and get methods.

Statistics: Posted by Bruce C — September 14th, 2011, 12:29 am


]]>
2011-09-13T23:52:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35946#p35946 <![CDATA[Re: level 1 access via email activation link]]>
Just to test it out, I tried it in the url using... http://www.domain.com/email-validate?id=43

But the level did not change from level0 to level1.

Statistics: Posted by antseo — September 13th, 2011, 11:52 pm


]]>
2011-09-13T23:28:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35945#p35945 <![CDATA[Re: level 1 access via email activation link]]>
Could it have something to do with an else function not being placed?

Statistics: Posted by Bruce C — September 13th, 2011, 11:28 pm


]]>
2011-09-13T23:27:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35943#p35943 <![CDATA[Re: level 1 access via email activation link]]>
This is mostly for those not as experienced with s2Member, or with PHP/HTML, therefore not directed at seozones himself, but those who may be interested in this for their own sites.

Here's a simple, easy way to get this working on your site.

There are 2 things that need to be set up in order to get this to work, the e-mail, and the page.

In order to get the e-mail set up, you first need to enable custom e-mail settings via Dashboard -> s2Member -> General Options -> Email Configuration

1.png


This is an example code that needs to be added to the e-mail.

(EDIT: in order to get this to work, follow the instructions in viewtopic.php?f=4&t=15226 to change the form to accept HTML)

Code:
<form action="http://example.com/my-custom-page" method="post" name="regId">
<input type="hidden" name="id" value="%%user_id%%"/>
</form>
<a href="#" onClick="document.regId.submit();return false">To finish the registration process, click here.</a>


This creates a link that cannot be replicated, and only works if used through the e-mail.

Then, the action="" part of the code should be customized to the page that is being used.

The page should contain this code, which can be customized to how you like it. Really, any page could be used, as long as the conditionals block the normal output.


This is the code that will bump the user to level 1.
Code:
<?php
if (!empty($_POST['id']))
{
$user = new WP_User($_POST['id']);
$user->set_role("s2member_level1");
}
else
{
//Regular content
}
?>


And that does it. If the user got the e-mail, they should click on the link, it checks to see if the id is posted, then, if it is, it bumps the user who clicked the e-mail's account to s2Member Level 1 whether they are logged in or not.

Cheers!

Statistics: Posted by Bruce C — September 13th, 2011, 11:27 pm


]]>
2011-09-13T23:24:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35942#p35942 <![CDATA[Re: level 1 access via email activation link]]>
Is there a code for is not administrator?

Statistics: Posted by antseo — September 13th, 2011, 11:24 pm


]]>
2011-09-13T23:16:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35941#p35941 <![CDATA[Re: level 1 access via email activation link]]> [s2If current_user_is(s2member_level0)]

then there is no chance of you having to go through that again.

Statistics: Posted by Bruce C — September 13th, 2011, 11:16 pm


]]>
2011-09-13T23:13:01-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35940#p35940 <![CDATA[Re: level 1 access via email activation link]]>
[s2If is_user_logged_in() AND current_user_is(s2member_level0)]
<?php $user = new WP_User(wp_get_current_user()->ID);
$user->set_role("s2member_level1"); ?>
[/s2If]

If I'm logged in as admin, I shouldn't be affected, right? Only users who log in who have level0 access will be bumped up to level1 access. Does that code look correct then?

Statistics: Posted by antseo — September 13th, 2011, 11:13 pm


]]>
2011-09-13T21:02:42-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35926#p35926 <![CDATA[Re: level 1 access via email activation link]]> )

This page can help you do that.
http://www.dnawebagency.com/how-to-add- ... s-database

Try using the current_user_is('s2member_level0') function instead.

Statistics: Posted by Bruce C — September 13th, 2011, 9:02 pm


]]>
2011-09-13T17:42:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=35910#p35910 <![CDATA[Re: level 1 access via email activation link]]>

I added this bit of code onto a page:

[s2If is_user_logged_in()]
$user = new WP_User(wp_get_current_user()->ID);
$user->set_role("s2member_level1");
[/s2If]

I logged in as admin and it changed my role from admin to level 1! What do I change now to get my admin role back?

Statistics: Posted by antseo — September 13th, 2011, 5:42 pm


]]>
2011-09-13T10:59:55-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=34686#p34686 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by antseo — September 13th, 2011, 10:59 am


]]>
2011-09-13T10:31:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=34683#p34683 <![CDATA[Re: level 1 access via email activation link]]>
Code:
$user = new WP_User(wp_get_current_user()->ID);
    $user->set_role("s2member_level1");


You could wrap this in conditionals (Dashboard -> s2Member -> API/Scripting -> Simple Shortcode/Conditionals) to see if the user is logged in, and if they are already level 1.
This would be in a post or page of your liking that is private.

Statistics: Posted by Bruce C — September 13th, 2011, 10:31 am


]]>
2011-09-12T21:20:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=34653#p34653 <![CDATA[Re: level 1 access via email activation link]]>
I guess I could set it up so all pages are accessed if a user is logged in. which of course would mean they registered and successfully logged in.

Okay, how about we disregard the email validation then. is there no other way to make it so that open enrollment can be bumped up to level 1 access upon a successful registration?

Statistics: Posted by antseo — September 12th, 2011, 9:20 pm


]]>
2011-09-12T21:08:35-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=34650#p34650 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by Bruce C — September 12th, 2011, 9:08 pm


]]>
2011-09-12T20:58:13-05:00 http://www.primothemes.com/forums/viewtopic.php?t=14973&p=34647#p34647 <![CDATA[Re: level 1 access via email activation link]]> Statistics: Posted by antseo — September 12th, 2011, 8:58 pm


]]>