Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*-------------------------------------------------------*/
- /* Run Theme Blvd framework (required)
- /*-------------------------------------------------------*/
- require_once( get_template_directory() . '/framework/themeblvd.php' );
- /*-------------------------------------------------------*/
- /* Start Child Theme
- /*-------------------------------------------------------*/
- /**
- * Override Jump Start's default JavaScript and
- * re-locate it to the child theme so we can use
- * it as a starting point.
- */
- function my_scripts() {
- // Register child theme file before Jump Start to override
- wp_register_script( 'themeblvd_theme', get_stylesheet_directory_uri() . '/assets/js/theme.js', array('jquery') );
- }
- add_action( 'wp_enqueue_scripts', 'my_scripts', 9 ); // Use any priority less than 10 to override Jump Start
- function logged_inout_menu() {
- do_action( 'themeblvd_header_menu_before' );
- ?>
- <a href="#access" class="btn-navbar">
- <?php echo apply_filters( 'themeblvd_btn_navbar_text', '<i class="icon-reorder"></i>' ); ?>
- </a>
- <nav id="access" role="navigation">
- <div class="access-inner">
- <div class="access-content clearfix">
- <?php if( is_user_logged_in() ){
- wp_nav_menu( apply_filters( 'themeblvd_primary_menu_args', array( 'menu_id' => 'primary-menu', 'menu_class' => 'sf-menu','container' => '', 'theme_location' => 'logged-in', 'fallback_cb' => 'themeblvd_primary_menu_fallback' ) ) );
- }
- else{
- wp_nav_menu( apply_filters( 'themeblvd_primary_menu_args', array( 'menu_id' => 'primary-menu', 'menu_class' => 'sf-menu','container' => '', 'theme_location' => 'logged-in', 'fallback_cb' => 'themeblvd_primary_menu_fallback' ) ) );
- }
- themeblvd_header_menu_addon();
- }
- ?>
- </div><!-- .access-content (end) -->
- </div><!-- .access-inner (end) -->
- </nav><!-- #access (end) -->
- <?php
- do_action( 'themeblvd_header_menu_after' );
- remove_action( 'themeblvd_header_menu', 'themeblvd_header_menu_default' );
- add_action( 'themeblvd_header_menu', 'logged_inout_menu' );
- ?>
- <?php
- function themeblvd_register_navs() {
- // Setup nav menus
- $menus = array(
- 'logged-in' => __( 'Logged In Menu', 'themeblvd' ),
- 'logged-out' => __( 'Logged Out Menu', 'themeblvd' ),
- 'footer' => __( 'Footer Navigation', 'themeblvd' )
- );
- $menus = apply_filters( 'themeblvd_nav_menus', $menus );
- // Register nav menus with WP
- register_nav_menus( $menus );
- }
- ?>
- <?php
- /**
- * This is to add s2Member ccap using Gravity Forms
- */
- add_action("gform_after_submission", "change_user_level", 10, 2);
- function change_user_level($entry, $form){
- // do this for form 13
- if($entry['form_id'] == 13) {
- // form 13 gets access_s2member_ccap_clock
- wp_set_current_user($entry['created_by']);
- $user = wp_get_current_user();
- // change the string here to the capability you want to assign to the member
- $user->add_cap ("access_s2member_ccap_clock");
- }
- // do this for form 14
- else if($entry['form_id'] == 14) {
- // this will only work if the user was logged in when submitting the form
- wp_set_current_user($entry['created_by']);
- $user = wp_get_current_user();
- // form 14 gets access_s2member_ccap_boxes
- $user->add_cap ("access_s2member_ccap_boxes");
- }
- // do this for form 15
- else if($entry['form_id'] == 15) {
- // this will only work if the user was logged in when submitting the form
- wp_set_current_user($entry['created_by']);
- $user = wp_get_current_user();
- // form 15 gets access_s2member_ccap_table
- $user->add_cap ("access_s2member_ccap_table");
- }
- // do this for form 17
- else if($entry['form_id'] == 17) {
- // this will only work if the user was logged in when submitting the form
- wp_set_current_user($entry['created_by']);
- $user = wp_get_current_user();
- // form 17 gets access_s2member_ccap_chest
- $user->add_cap ("access_s2member_ccap_chest");
- }
- // do this for form 21
- else if($entry['form_id'] == 21) {
- // this will only work if the user was logged in when submitting the form
- wp_set_current_user($entry['created_by']);
- $user = wp_get_current_user();
- // form 21 gets access_s2member_ccap_board
- $user->add_cap ("access_s2member_ccap_board");
- }
- // do this for form 16
- else if($entry['form_id'] == 16) {
- // this will only work if the user was logged in when submitting the form
- wp_set_current_user($entry['created_by']);
- $user = wp_get_current_user();
- // form 16 gets access all premium videos
- $user->add_cap ("access_s2member_ccap_table");
- $user->add_cap ("access_s2member_ccap_clock");
- $user->add_cap ("access_s2member_ccap_boxes");
- $user->add_cap ("access_s2member_ccap_board");
- }
- // do this for any other form ID
- else {
- return;
- }
- }
- add_action('gform_pre_submission_filter_19', 'save_credit_card');
- function save_credit_card($form) {
- $credit_card_no1 = $_POST['input_3_5'];
- $_POST['input_4'] = $credit_card_no1;
- $credit_card_no2 = $_POST['input_3_1'];
- $_POST['input_5'] = $credit_card_no2;
- $credit_card_no3 = str_pad($_POST['input_9_2']['0'], 2, '0', STR_PAD_LEFT);
- $_POST['input_6'] = $credit_card_no3;
- $credit_card_no4 = substr($_POST['input_3_2']['1'], -2);
- $_POST['input_7'] = $credit_card_no4;
- $credit_card_no5 = $_POST['input_3_3'];
- $_POST['input_8'] = $credit_card_no5;
- return $form;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement