当前位置: 首页>>代码示例>>PHP>>正文


PHP Student::add_student方法代码示例

本文整理汇总了PHP中Student::add_student方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::add_student方法的具体用法?PHP Student::add_student怎么用?PHP Student::add_student使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Student的用法示例。


在下文中一共展示了Student::add_student方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array


//.........这里部分代码省略.........
                                                    $form_errors++;
                                                } else {
                                                    if ($_POST['password_confirmation']) {
                                                        $student_data['user_pass'] = $_POST['password'];
                                                    } else {
                                                        $form_message = __("Passwords don't match", 'cp');
                                                        $form_message_class = 'red';
                                                        $form_errors++;
                                                    }
                                                }
                                            } else {
                                                $form_message = __('Passwords don\'t match', 'cp');
                                                $form_message_class = 'red';
                                                $form_errors++;
                                            }
                                            $student_data['role'] = 'student';
                                            $student_data['user_login'] = $_POST['username'];
                                            $student_data['user_email'] = $_POST['email'];
                                            $student_data['first_name'] = $_POST['first_name'];
                                            $student_data['last_name'] = $_POST['last_name'];
                                            if (!is_email($_POST['email'])) {
                                                $form_message = __('E-mail address is not valid.', 'cp');
                                                $form_message_class = 'red';
                                                $form_errors++;
                                            }
                                            if (isset($_POST['tos_agree'])) {
                                                if ($_POST['tos_agree'] == '0') {
                                                    $form_message = __('You must agree to the Terms of Service in order to signup.', 'cp');
                                                    $form_message_class = 'red';
                                                    $form_errors++;
                                                }
                                            }
                                            if ($form_errors == 0) {
                                                if ($student_id = $student->add_student($student_data) !== 0) {
                                                    //$form_message = __( 'Account created successfully! You may now <a href="' . ( get_option( 'use_custom_login_form', 1 ) ? trailingslashit( site_url() . '/' . $this->get_login_slug() ) : wp_login_url() ) . '">log into your account</a>.', 'cp' );
                                                    //$form_message_class = 'regular';
                                                    $email_args['email_type'] = 'student_registration';
                                                    $email_args['student_id'] = $student_id;
                                                    $email_args['student_email'] = $student_data['user_email'];
                                                    $email_args['student_first_name'] = $student_data['first_name'];
                                                    $email_args['student_last_name'] = $student_data['last_name'];
                                                    $email_args['student_username'] = $student_data['user_login'];
                                                    $email_args['student_password'] = $student_data['user_pass'];
                                                    coursepress_send_email($email_args);
                                                    $creds = array();
                                                    $creds['user_login'] = $student_data['user_login'];
                                                    $creds['user_password'] = $student_data['user_pass'];
                                                    $creds['remember'] = true;
                                                    $user = wp_signon($creds, false);
                                                    if (is_wp_error($user)) {
                                                        $form_message = $user->get_error_message();
                                                        $form_message_class = 'red';
                                                    }
                                                    // if( defined('DOING_AJAX') && DOING_AJAX ) { cp_write_log('doing ajax'); }
                                                    if (isset($_POST['course_id']) && is_numeric($_POST['course_id'])) {
                                                        $course = new Course($_POST['course_id']);
                                                        wp_redirect($course->get_permalink());
                                                    } else {
                                                        if (!empty($redirect_url)) {
                                                            wp_redirect(apply_filters('coursepress_redirect_after_signup_redirect_url', $redirect_url));
                                                        } else {
                                                            wp_redirect(apply_filters('coursepress_redirect_after_signup_url', CoursePress::instance()->get_student_dashboard_slug(true)));
                                                        }
                                                    }
                                                    exit;
                                                } else {
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:67,代码来源:class.shortcodes.php

示例2: Student

 function signup_create_user()
 {
     // cp_write_log( 'creating user....' );
     parse_str($_POST['data'], $posted_data);
     if (wp_verify_nonce($posted_data['submit_signup_data'], 'popup_signup_nonce')) {
         $student = new Student(0);
         $student_data = array();
         $student_data['role'] = get_option('default_role', 'subscriber');
         $student_data['user_login'] = $posted_data['username'];
         $student_data['user_pass'] = $posted_data['cp_popup_password'];
         $student_data['user_email'] = $posted_data['email'];
         $student_data['first_name'] = $posted_data['student_first_name'];
         $student_data['last_name'] = $posted_data['student_last_name'];
         $student_id = $student->add_student($student_data);
         if ($student_id !== 0) {
             $email_args['email_type'] = 'student_registration';
             $email_args['student_id'] = $student_id;
             $email_args['student_email'] = $student_data['user_email'];
             $email_args['student_first_name'] = $student_data['first_name'];
             $email_args['student_last_name'] = $student_data['last_name'];
             $email_args['student_username'] = $student_data['user_login'];
             $email_args['student_password'] = $student_data['user_pass'];
             coursepress_send_email($email_args);
             $creds = array();
             $creds['user_login'] = $student_data['user_login'];
             $creds['user_password'] = $student_data['user_pass'];
             $creds['remember'] = true;
             $user = wp_signon($creds, false);
             $args['student_id'] = $student_id;
             $args['course_id'] = $posted_data['course_id'];
             $this->popup_signup('enrollment', $args);
             exit;
         }
     }
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:35,代码来源:coursepress.php

示例3:

     $form_message = __("Passwords don't match", 'cp');
     $form_message_class = 'error';
     $form_errors++;
 }
 //$student_data['role'] = 'student';
 $student_data['user_login'] = $_POST['username'];
 $student_data['user_email'] = $_POST['email'];
 $student_data['first_name'] = $_POST['first_name'];
 $student_data['last_name'] = $_POST['last_name'];
 if (!is_email($_POST['email'])) {
     $form_message = __('E-mail address is not valid.', 'cp');
     $form_message_class = 'error';
     $form_errors++;
 }
 if ($form_errors == 0) {
     if ($student_id = $student->add_student($student_data) !== 0) {
         $global_option = !is_multisite();
         update_user_option($student_id, 'role', 'student', $global_option);
         $form_message = __('Account created successfully!', 'cp');
         $form_message_class = 'updated';
         /* $email_args['email_type'] = 'student_registration';
         	  $email_args['student_id'] = $student_id;
         	  $email_args['student_email'] = $student_data['user_email'];
         	  $email_args['student_first_name'] = $student_data['first_name'];
         	  $email_args['student_last_name'] = $student_data['last_name'];
         	  coursepress_send_email( $email_args ); */
     } else {
         $form_message = __('An error occured while creating the account. Please check the form and try again.', 'cp');
         $form_message_class = 'error';
     }
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:student-add.php

示例4:

    {
        echo "{$var} students.";
    }
}
echo Student::$total_students;
Student::$total_students = 13;
echo "<br>";
echo Student::$total_students;
echo "<br>";
echo Student::welcome_students();
echo "<br>";
Student::add_student();
// 14
Student::add_student();
// 15
Student::add_student();
// 16 $total_students
echo Student::$total_students;
echo "<br>";
// static variable are the php version of class variables. These will go with
// all instances of the classes. As well these variables can be accessed
// without declaring an instance of the class at all. Therefore I do not need
// to go `$x = new ClassName();`
//
// However to access the static variables I use the :: instead of the ->
//
// In python these had a much subtler difference as the instance version was
// called `self.VARIABLE` and the class version got declare like normal.
// Recall having to be carefully in python with making mutable objects as
// class variables like a list and dicts.
//
开发者ID:natac13,项目名称:PHP-Advanced,代码行数:31,代码来源:static_modifier.php


注:本文中的Student::add_student方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。