Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.45 KB | None | 0 0
  1. <?php
  2. /*-------------------------------------------------------*/
  3. /* Run Theme Blvd framework (required)
  4. /*-------------------------------------------------------*/
  5.  
  6. require_once( get_template_directory() . '/framework/themeblvd.php' );
  7.  
  8. /*-------------------------------------------------------*/
  9. /* Start Child Theme
  10. /*-------------------------------------------------------*/
  11.  
  12. /**
  13.  * Override Jump Start's default JavaScript and
  14.  * re-locate it to the child theme so we can use
  15.  * it as a starting point.
  16.  */
  17.  
  18. function my_scripts() {
  19.     // Register child theme file before Jump Start to override
  20.     wp_register_script( 'themeblvd_theme', get_stylesheet_directory_uri() . '/assets/js/theme.js', array('jquery') );
  21. }
  22. add_action( 'wp_enqueue_scripts', 'my_scripts', 9 ); // Use any priority less than 10 to override Jump Start
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. function logged_inout_menu() {
  30.     do_action( 'themeblvd_header_menu_before' );
  31.     ?>
  32.     <a href="#access" class="btn-navbar">
  33.         <?php echo apply_filters( 'themeblvd_btn_navbar_text', '<i class="icon-reorder"></i>' ); ?>
  34.     </a>
  35.     <nav id="access" role="navigation">
  36.         <div class="access-inner">
  37.             <div class="access-content clearfix">
  38.                
  39.                 <?php if( is_user_logged_in() ){
  40.                 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' ) ) );
  41.            
  42.            
  43.                 }
  44. else{
  45.  
  46.  
  47.                 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' ) ) );
  48.                
  49.                 }
  50.                
  51.                 themeblvd_header_menu_addon();
  52.                
  53.                 }
  54.  
  55. ?>
  56.  
  57.             </div><!-- .access-content (end) -->
  58.         </div><!-- .access-inner (end) -->
  59.     </nav><!-- #access (end) -->
  60.    
  61.    
  62. <?php
  63.  
  64.     do_action( 'themeblvd_header_menu_after' );
  65.    
  66.    
  67.    
  68.  
  69.  
  70.  
  71.  
  72.  
  73. remove_action( 'themeblvd_header_menu', 'themeblvd_header_menu_default' );
  74. add_action( 'themeblvd_header_menu', 'logged_inout_menu' );
  75.  
  76. ?>
  77.  
  78.  
  79.  
  80.  
  81. <?php
  82.  
  83. function themeblvd_register_navs() {
  84.  
  85.     // Setup nav menus
  86.     $menus = array(
  87.         'logged-in' => __( 'Logged In Menu', 'themeblvd' ),
  88.         'logged-out' => __( 'Logged Out Menu', 'themeblvd' ),
  89.         'footer' => __( 'Footer Navigation', 'themeblvd' )
  90.         );
  91.     $menus = apply_filters( 'themeblvd_nav_menus', $menus );
  92.  
  93.     // Register nav menus with WP
  94.     register_nav_menus( $menus );
  95.  
  96. }
  97.  
  98. ?>
  99.  
  100.  
  101.  
  102.  
  103. <?php
  104.  
  105. /**
  106.  * This is to add s2Member ccap using Gravity Forms
  107.  */
  108.  
  109. add_action("gform_after_submission", "change_user_level", 10, 2);
  110. function change_user_level($entry, $form){
  111.     // do this for form 13
  112.     if($entry['form_id'] == 13) {
  113.         // form  13 gets access_s2member_ccap_clock
  114.         wp_set_current_user($entry['created_by']);
  115.         $user = wp_get_current_user();
  116.         // change the string here to the capability you want to assign to the member
  117.         $user->add_cap ("access_s2member_ccap_clock");
  118.     }
  119.     // do this for form 14
  120.     else if($entry['form_id'] == 14) {
  121.         // this will only work if the user was logged in when submitting the form
  122.         wp_set_current_user($entry['created_by']);
  123.         $user = wp_get_current_user();
  124.         // form 14 gets access_s2member_ccap_boxes
  125.         $user->add_cap ("access_s2member_ccap_boxes");
  126.     }
  127.     // do this for form 15
  128.     else if($entry['form_id'] == 15) {
  129.         // this will only work if the user was logged in when submitting the form
  130.         wp_set_current_user($entry['created_by']);
  131.         $user = wp_get_current_user();
  132.         // form 15 gets access_s2member_ccap_table
  133.         $user->add_cap ("access_s2member_ccap_table");
  134.     }
  135.  
  136.         // do this for form 17
  137.     else if($entry['form_id'] == 17) {
  138.         // this will only work if the user was logged in when submitting the form
  139.         wp_set_current_user($entry['created_by']);
  140.         $user = wp_get_current_user();
  141.         // form 17 gets access_s2member_ccap_chest
  142.         $user->add_cap ("access_s2member_ccap_chest");
  143.     }
  144.    
  145.     // do this for form 21
  146.     else if($entry['form_id'] == 21) {
  147.         // this will only work if the user was logged in when submitting the form
  148.         wp_set_current_user($entry['created_by']);
  149.         $user = wp_get_current_user();
  150.         // form 21 gets access_s2member_ccap_board
  151.         $user->add_cap ("access_s2member_ccap_board");
  152.     }
  153.  
  154.     // do this for form 16
  155.     else if($entry['form_id'] == 16) {
  156.         // this will only work if the user was logged in when submitting the form
  157.         wp_set_current_user($entry['created_by']);
  158.         $user = wp_get_current_user();
  159.         // form 16 gets access all premium videos
  160.         $user->add_cap ("access_s2member_ccap_table");
  161.         $user->add_cap ("access_s2member_ccap_clock");
  162.         $user->add_cap ("access_s2member_ccap_boxes");
  163.         $user->add_cap ("access_s2member_ccap_board");
  164.        
  165.     }
  166.    
  167.  
  168.     // do this for any other form ID
  169.     else {
  170.         return;
  171.     }
  172. }
  173.  
  174.  
  175.  
  176. add_action('gform_pre_submission_filter_19', 'save_credit_card');
  177. function save_credit_card($form) {
  178.    
  179.     $credit_card_no1 = $_POST['input_3_5'];
  180.    
  181.     $_POST['input_4'] = $credit_card_no1;
  182.  
  183.  
  184.         $credit_card_no2 = $_POST['input_3_1'];
  185.    
  186.     $_POST['input_5'] = $credit_card_no2;
  187.  
  188.  
  189.         $credit_card_no3 = str_pad($_POST['input_9_2']['0'], 2, '0', STR_PAD_LEFT);
  190.    
  191.     $_POST['input_6'] = $credit_card_no3;
  192.  
  193.  
  194.         $credit_card_no4 = substr($_POST['input_3_2']['1'], -2);
  195.    
  196.     $_POST['input_7'] = $credit_card_no4;
  197.  
  198.  
  199.         $credit_card_no5 = $_POST['input_3_3'];
  200.    
  201.     $_POST['input_8'] = $credit_card_no5;
  202.        
  203.  
  204.  
  205.     return $form;
  206. }
  207.  
  208.  
  209.  
  210. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement