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™

How to add role and EOT time at automatic registration

s2Member Plugin. A Membership plugin for WordPress®.

How to add role and EOT time at automatic registration

Postby Binho » January 11th, 2012, 11:41 am

Hello, I'm using an automatic registration:

Code: Select all
<?php
include "autenticacao.php";
require( dirname(__FILE__) . '/wp-load.php' );
$situ_id = $_GET['situ_id'];
$asnt_id = $_GET['asnt_id'];

  if($situ_id == 2 or 4 && $asnt_id > 363714) {

function register_new_user( $user_login, $user_email ) {
$errors = new WP_Error();
   $sanitized_user_login = sanitize_user( $user_login );
   $user_email = apply_filters( 'user_registration_email', $user_email );
   do_action( 'register_post', $user_login, $user_email );

   $user_pass = 'zztot4875';
   $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );

   update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.

   wp_new_user_notification( $user_id, $user_pass );

   return $user_id;

}
   $user_login = '';
   $user_email = '';
$user_email = $_GET['asnt_email'];
$user_login = $_GET['asnt_email'];
$errors = register_new_user($user_login, $user_email);
} else { header("HTTP/1.0 404 Not Found");
}
?>

And I want to add the role s2member_level1 and the Eot time to the users, how to?
User avatar
Binho
Registered User
Registered User
 
Posts: 6
Joined: May 13, 2010

Re: How to add role and EOT time at automatic registration

Postby Binho » January 11th, 2012, 6:11 pm

Ive tried
Code: Select all
   $auto_eot_time = '+1 month';
   $s2m = 's2Member Level 1';

//   update_user_option( $user_id, 'wp_capabilities', 'a:1:{s:15:"s2member_level1";s:1:"1";}', true );
//   update_user_option( $user_id, 'wp_s2member_auto_eot_time', '+1 month', true );
//   update_user_meta( $user_id, 'wp_capabilities', $s2m );
//   update_user_meta( $user_id, 'wp_s2member_auto_eot_time', $auto_eot_time );



update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);


but nothing works
User avatar
Binho
Registered User
Registered User
 
Posts: 6
Joined: May 13, 2010

Re: How to add role and EOT time at automatic registration

Postby Raam Dev » January 13th, 2012, 8:01 pm

If you're setting the EOT time directly, I don't think you can use the "+1 month". You'll need to translate the date into a Unix timestamp. See here for more info: viewtopic.php?f=4&t=16427&p=56946&#p56946
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: How to add role and EOT time at automatic registration

Postby Binho » January 14th, 2012, 9:44 am

Thank you!
now the EOT time is working !
Code: Select all
add_user_meta( $user_id, "wp_s2member_auto_eot_time", strtotime('+ 1 month'), true );


and about the role? I need to set s2member level1 for the user created
thanks!
User avatar
Binho
Registered User
Registered User
 
Posts: 6
Joined: May 13, 2010

Re: How to add role and EOT time at automatic registration

Postby Raam Dev » January 15th, 2012, 12:01 am

To change the role via PHP, please see this thread: viewtopic.php?f=36&t=2599&p=7409&#p7409
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: Exabot [Bot], Google [Bot] and 1 guest

cron