// This is where we'll add the HTML code for the form field(s).
add_action("ws_plugin__s2member_during_users_list_edit_cols_after", "my_special_custom_fields");
function my_special_custom_fields($vars){
$user = $vars["user"];
$fields = get_user_option ("s2member_custom_fields", $user->ID);
echo '<tr>';
echo '<th><label>Licensee:</label></th>';
echo '<td><input type="text" name="ws_plugin__s2member_profile_licensee" value="' . format_to_edit ($fields["licensee"]) . '" class="regular-text" /></td>';
echo '</tr>';
}
// Now we'll dynamically update the fields through this Hook.
// This uses the __refs array ( which are variables - by reference ).
add_action("ws_plugin__s2member_during_users_list_update_cols", "store_my_special_custom_fields");
function store_my_special_custom_fields($vars){
$fields =& $vars["__refs"]["fields"];
$fields["licensee"] = $_POST["ws_plugin__s2member_profile_licensee"];
}
Statistics: Posted by Jason Caldwell — September 7th, 2010, 6:03 pm
add_action("ws_plugin__s2member_during_configure_user_registration_front_side", "my_function");
function my_function($vars) {
$user = new WP_User($vars['user_id']);
$user->add_cap('access_s2member_ccap_view');
$custom_fields = get_user_option("s2member_custom_fields");
$custom_fields["licensee"] = "Big Corp";
update_user_option($user->ID, "s2member_custom_fields", $custom_fields);
}
Statistics: Posted by kenduret — September 3rd, 2010, 4:12 pm
add_action("ws_plugin__s2member_during_configure_user_registration_front_side", "my_function");
function my_function($vars)
{
$user = new WP_User($vars["user_id"]);
$user->add_cap("access_s2member_ccap_view");
update_user_option($user->ID, "licensee", "Big Corp");
// print_r($vars); for a bigger picture during development.
// You can also see: /s2member/includes/functions/register-access.inc.php
// - look for Hook: ws_plugin__s2member_during_configure_user_registration_front_side
}
Statistics: Posted by Jason Caldwell — September 2nd, 2010, 2:20 pm
/* Load registration file. */
require_once( ABSPATH . WPINC . '/registration.php' );
/* Check if users can register. */
$registration = get_option( 'users_can_register' );
/* If user registered, input info. */
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' ) {
$userdata = array(
'user_pass' => esc_attr( $_POST['pass1'] ),
'user_login' => esc_attr( $_POST['user-name'] ),
'user_email' => esc_attr( $_POST['email'] ),
'first_name' => esc_attr( $_POST['first-name'] ),
'last_name' => esc_attr( $_POST['last-name'] ),
'role' => get_option( 'default_role' ),
);
if ( ($_POST['user-name'] ) && ( $_POST['email'] ) && ( $_POST['pass1'] ) && ( $_POST['pass1'] == $_POST['pass2'] ) ) {
$new_user = wp_insert_user( $userdata );
}
Statistics: Posted by kenduret — September 2nd, 2010, 12:44 am