Ejemplo n.º 1
0
 function catch_vars()
 {
     global $bp, $wp_query;
     if (!class_exists('Vibe_CustomTypes_Permalinks')) {
         return;
     }
     $permalinks = Vibe_CustomTypes_Permalinks::init();
     if ($bp->unfiltered_uri[0] == trim($permalinks->permalinks['course_base'], '/') || $bp->unfiltered_uri[0] == BP_COURSE_SLUG) {
         $drive_slug = $this->permalinks['drive_slug'] ? $this->permalinks['drive_slug'] : 'drive';
         $drive_slug = str_replace('/', '', $drive_slug);
         if (get_query_var($drive_slug)) {
             $bp->current_component = BP_COURSE_CPT;
             $bp->current_item = get_The_ID();
             $bp->current_action = 'drive';
             add_action('bp_course_plugin_template_content', array($this, 'course_drive'));
             do_action('buddydrive_enqueue_scripts');
             vibe_load_template('course/single/plugins');
             exit;
         }
     }
 }
Ejemplo n.º 2
0
                case '?action=admin&submissions':
                    if (!empty($this->permalinks['submissions_slug'])) {
                        $slug = $admin_slug . $this->permalinks['submissions_slug'];
                    }
                    break;
                case '?action=admin&stats':
                    if (!empty($this->permalinks['stats_slug'])) {
                        $slug = $admin_slug . $this->permalinks['stats_slug'];
                    }
                    break;
            }
        }
        return $slug;
    }
}
Vibe_CustomTypes_Permalinks::init();
//add_filter('post_type_link', 'wplms_unit_permalinks', 10, 3);
//add_filter('post_type_link', 'wplms_quiz_permalinks', 10, 3);
function wplms_unit_permalinks($permalink, $post, $leavename)
{
    $post_id = $post->ID;
    if ($post->post_type != 'unit' || empty($permalink) || in_array($post->post_status, array('draft', 'pending', 'auto-draft'))) {
        return $permalink;
    }
    global $wpdb;
    $course_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key= 'vibe_course_curriculum' AND meta_value LIKE %s LIMIT 1;", "%{$post_id}%"));
    if (is_numeric($course_id)) {
        $slug = get_post_field('post_name', $course_id);
    }
    if (empty($slug)) {
        $slug = WPLMS_UNIT_SLUG;