Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need help setting up Private page (or posts) in user profile


  • durkk
    Participant

    @durkk

    Hey guys,

    Newbie here and looking for some help with a project I am working on. The goal of this post is to find a solution for the following: I am a teacher doing one 2 one tutoring via Hangouts/skype/Fuze etc. I would like to write a short summary of the lessons and post the recordings so they can watch them back later on. This content would be perfect as a private tab for each unique user that the admin could update after a lesson.

    I bought a plugin for this: Private Content User Data. Not aware this uses a different user database then WP itself. I think this has to do with the fact the dev needed to assign unlimited permission levels if he wanted unlimited users(?).

    So I am back to the drawing board. The plugin allows me to kind of do what I want, but I much rather find a solution that works with WP user database to utilize buddypress.

    I know about courseware, but sadly the project is dead and breaks everything since 2.0

    Commercial LMS themes and plugins for WP are quiz and drip content focussed, not for one 2 one training.

Viewing 12 replies - 1 through 12 (of 12 total)

  • danbp
    Moderator

    @danbp

    @durkk,

    are you speaking about this wordpress add-on ?
    You must have at least PrivateContent v2.3 to use it !

    i would try something different.

    Create a page for each student and set it to private, with a password which you give to the student.
    With the password they can access to the page. This is a WP native behave.

    It would not be very difficult after that to include such a page in each profile.

    To write your summary or summaries, adapted to each student, or any other text, you could use @imath ‘s wp-manual.

    You could also publish courses in PDF and use the buddydrive plugin. Your course will then be listed on your profile, depending your buddydrive visibility settings (public, private, friends, members….).

    I think this can be reasonnably be used if you have few students, but if you have more than 50 you have to use a better adapted solution.


    durkk
    Participant

    @durkk

    @danp: Yes, that’s the plugin indeed. I have the latest version.

    Thanks for the ideas! I have gone through those options and the whole website is pretty much one big WP manual in layout (knowledge base search type of thing) so that’s covered.

    The one 2 one tutoring is practically a video call, but I also share files and links and make a summary and assign homework that I want them to be able to review in their profile.

    So I guess the best way would be to somehow link a personal page to a profile. Any ideas on that?

    While googeling and writing this I have come up with the following:

    Use dynamic links to user profiles via and then give my students a restriction level via s2members or simalair and restrict acces that way. Just thinking out loud and still pondering how to link unique user ID’s to a page.

    http://edu.durkkooistra.com/ I have an open website, so the knowledge base is open to anyone, I just want to restrict one page per student to add the videos etc too.


    durkk
    Participant

    @durkk

    Ah yes, I see i wrote the name of the addon I bought too. But yes I have the main plugin too 🙂


    durkk
    Participant

    @durkk

    @danbp

    Getting closer!

    So I made a custom post type via the CPT UI plugin. I then proceeded to remove the slug from the URL as suggested here: http://colorlabsproject.com/tutorials/remove-slugs-custom-post-type-url/

    I have buddypress installed and use a filter to have a profile link as follows: mydomain.com/username. This to be able users to use a dynamic link in a widget that leads them to a personal page.
    mydoamian.com/username/personalpage where username is dynamic to logged in user.

    This works perfectly with pages but not with the custom post type I made. Anyone got an idea what I am doing wrong here?


    danbp
    Moderator

    @danbp

    @durkk,

    IMHO you do it overcomplicated.

    Create a new page; call it “extra”
    Create eventually a template for it. Basically, you made a copy of your theme “page.php”, you rename it “my-extra_page.php” and in the file header, you remove the original page comment and replace it with the new template comment.

    /*
    * Template name: my extra page
    */

    Save !

    Back to the page “extra” > edit and asign it the new template.

    Now you can add a this page to each profile by using the abose snippet from the child-theme functions.php

    
    function bpfr_my_setup_nav() {
        global $bp;
    	
    	$mytab=array(
    	'name'            => 'My Tab',
    	'link'      	  => 'permalink_to_your_page', // the one under the page title on page editor
    	'slug'         	  => 'my-tab',
    	'css_id'          => 'my_custom_tab',
    	'position'        => 100,
    	'user_has_access' => 1,
        'screen_function' => 'xprofile_screen_my_tab'
    	);
    	$bp->bp_options_nav['profile']['my-tab'] = $mytab; 	
    }
    add_action('bp_setup_nav', 'bpfr_my_setup_nav');

    You can now add into this page template any code you want. To call a plugin, a specific content or what else.

    To avoid this page to be shown in the menu bar, you can use this old plugin (it still works with 4.0)

    To use a shortcode from within the text widget (this is not possible by default)
    you can add this to your child-theme functions.php add_filter('widget_text', 'do_shortcode', 11);
    Now you can use a shortcode in this widget !


    durkk
    Participant

    @durkk

    @danbp

    Thanks again for all the help! You seem to be helping out a lot of people.

    Will this create a unique page for each visitor, or how do i link unique content per user? I tried what described above but I get a 404.


    danbp
    Moderator

    @danbp

    A 404 error ? If you copy/paste a wrong url this can happen !

    When you create a new page in wordpress, a permalink is automatically created under the title box.
    You copy that whole permalink, including http, into the snippet
    'link' => 'your permlink', do not remove the coma ! And be carefull when editing code. Use a text editor, not Word !

    The snippet give you the possibility to add a page to a profile, and this page use his own template file, as also described.

    Don’t copy/paste when you don’t know how to use it and how things are working.
    For that you have the codex, where you can learn a bit on how BP is working.
    Here about theming.


    durkk
    Participant

    @durkk

    @danbp: Ok thanks, the snippet gave me the impression it was relative, not absolute. I am not a complete code n00b, but thanks for your concern.

    Let me see if I get this right; because I am still not sure how this enables me to feed unique content per user.

    Right now with your snippets I have a page template, a page with the template loaded and a link to that page in the buddypress user profile menu’s. How do I load content relevant to the logged in user on that page?

    That is kind off the whole objective of using the dynamic links

    There’s a plugin that can make profile tab links and even pages, so I guess I am not understanding what exactly is the idea behind you reasoning for being a simpler solution to my problem.


    danbp
    Moderator

    @danbp

    Are you already in a reflection stage or already confronted to “a problem” ?

    If you have a template you can display content, with conditionnals.
    Read here to see what it is on hand for template files:

    Template Tag Reference


    durkk
    Participant

    @durkk

    @danbp

    Are you trying to be sarcastic or philosophical?

    I appreciate this is a labor of love and there must be many people like me expecting a easy fix to problem that is not yours.

    I am new to buddypress like I clearly mentioned and was delighted to see you help out with snippets of code. But like anyone starting out with WP/BP a list of conditionals do not constitute an easier solution.

    Where a coder sees a list of options to achieve something, a lamen will see a list of meaningless out of context and poorly documented tags.

    I got my hopes up, but I guess I either have to learn BP whenever I have time (not likely) or keep on working with the crappy solution I have now. Word of advice from a buddypress n00b, don’t expect people to see the options you see when you link to a reference list.


    danbp
    Moderator

    @danbp

    Being philosophical ? Yes at least, for sure ! 😉
    Whatever is well conceived is clearly said… and the words to say it flow with ease. Nicolas Boileau

    But it’s not really the case on this topic 😉 I’m french and you a buddypress n00b (your expression).

    First, I suggested you to create a page.
    You answered that you built a CPT and changed the slug by following a tutorial. This is working for page and not for CPT ?!!!

    Forget my snippets for the moment, and try to explain what you did exactly (a code example would be great).

    And also, once the cpt will work, what do you expect after that ?


    durkk
    Participant

    @durkk

    Heheh,

    You see the only coding experience I have is with music related software or game middleware. The creative process of pulling pages per user is very abstract to me 😀

    I do know my French classics…

    “Perhaps the world’s second worst crime is boredom. The first is being a bore.”
    -Jean Baudrillard

    Hoping not being guilty of the first but here goes:

    First I added a filter to bypass the members in the profile URL so I could use dynamic links via this plugin: Buddy Menu Buddy Links. Then I make a page with the username as parent and a child with the same title for all students (lessons). resulting in a workin url looking this mydomain.com/username/lessons.

    I made a CPT to keep the it more organized only and the pages index less cluttered.

    /**
     * Remove the slug from published post permalinks.
     */
    function custom_remove_cpt_slug( $post_link, $post, $leavename ) {
     
        if ( 'student' != $post->post_type || 'publish' != $post->post_status ) {
            return $post_link;
        }
     
        $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
     
        return $post_link;
    }
    add_filter( 'post_type_link', 'custom_remove_cpt_slug', 10, 3 );
    /**
     * Some hackery to have WordPress match postname to any of our public post types
     * All of our public post types can have /post-name/ as the slug, so they better be unique across all posts
     * Typically core only accounts for posts and pages where the slug is /post-name/
     */
    function custom_parse_request_tricksy( $query ) {
     
        // Only noop the main query
        if ( ! $query->is_main_query() )
            return;
     
        // Only noop our very specific rewrite rule match
        if ( 2 != count( $query->query ) || ! isset( $query->query['page'] ) ) {
            return;
        }
     
        // 'name' will be set if post permalinks are just post_name, otherwise the page rule will match
        if ( ! empty( $query->query['name'] ) ) {
            $query->set( 'post_type', array( 'post', 'student', 'page' ) );
        }
    }
    add_action( 'pre_get_posts', 'custom_parse_request_tricksy' );
    
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Need help setting up Private page (or posts) in user profile’ is closed to new replies.
Skip to toolbar