Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 251 through 275 (of 1,734 total)
  • @burtadsit

    Participant

    Well, the problem is that activating the regular bbpress live widget conflicts with the code already loaded. It’ll never work. You’ll have to figure out how to register the code that bp uses *as a widget*. I think it would be easier to just create a small template loop using the bp provided code. Or use the function bp_forums_get_topics( $forum_id = 0, $number = 0, $page = 1 ) that lives in bp-forums.php

    @burtadsit

    Participant

    Yes, bp uses the bbpress live widget code.

    @burtadsit

    Participant

    Nope. Can’t activate it. Well, maybe you can just register it and then use it. Hmmm. You might try that. Or just use bp’s :

    function bp_forums_get_topics( $forum_id = 0, $number = 0, $page = 1 ) from bp-forums.php

    It’s getting kinda fuzzy here. I gotta get some sleep. :)

    @burtadsit

    Participant

    There is also Sam’s bbPress Live widget which you could use: https://wordpress.org/extend/plugins/bbpress-live/

    Hmmm. Well maybe that wouldn’t work. That widget is what bp uses to communicate with bbpress for group forums. Interesting.

    @burtadsit

    Participant

    See: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/ for examples using other bp_has_[something]() loops.

    @burtadsit

    Participant

    It doesn’ t look like Andy has documented this yet but there is a group forum loop just like other parts of bp have a loop. Look at bp_has_topics() in bp-forums-templatetags.php. It looks like I’d use that if I were you.

    @burtadsit

    Participant

    $bp->action_variables[0] in the above case would be ‘imagename.jpg’

    @burtadsit

    Participant

    You have to create a component and get the group nav stuff working. The group stuff works in a similar fashion. Only the nav call is:

    global $group_obj;

    $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' .
    $group_obj->slug . '/';

    bp_core_add_subnav_item($bp->groups->slug, 'someaction' ,
    __( 'Some Action', 'oci-contents' ), $group_link, 'oci_screen_group_someaction');

    That listens for /groups/somegroup/someaction and triggers oci_screen_group_someaction() when it finds it. Which happens when the user navigates to Groups > Some Group > Some Action.

    Either a link from somewhere in the universe is /groups/somegroup/someaction or the user picks that spot from the member theme menu. The nav system and the urls in bp are intertwined. Your component, when it sets up the nav stuff, determines the urls that your component responds to.

    If the url has things like an image name of some sort after the /groups/somegroup/someaction part of the url like: /groups/somegroup/someaction/imagename.jpg then the imagename.jpg is available in bp through the $bp->action_variables. Everything *after* the component/action is available to your component’s code in $bp->action_variables which is an array of things that are stuff after that component/action part of the url.

    @burtadsit

    Participant

    If bp can’t resolve the url to something covered in nav instead of 404’ing out it send you to your profile. The bp nav mechanism is the url dispatch mechanism.

    An example:

    $profile_link = $bp->loggedin_user->domain . $bp->contents->slug . '/' ;
    bp_core_add_subnav_item($bp->contents->slug, 'my-contents' , __( 'Personal',
    'oci-contents' ), $profile_link, 'oci_screen_profile_my_contents');

    Lets say that $bp->contents->slug is the slug I’ve set up for use in my component which is ‘contents’. Making that call above tells bp to listen for this url structure in the member profile:

    /members/burtadsit/contents/my-contents

    When the $bp->current_component: /members/burtadsit/(contents)/my-contents and the $bp->current_action /members/burtadsit/contents/(my-contents) is the url then trigger the function oci_screen_profile_my_contents().

    What you do in oci_screen_profile_my_contents() is, amongst other things display the template that you want displayed to the user. That can display images or do user input. Whatever you decide it does.

    function oci_screen_profile_my_contents() {
    global $bp, $bp_unfiltered_uri;

    if (!bp_is_home())
    return;

    if ( isset( $_POST['submit_save_profile_tags'] )) {
    $item = oci_get_user_item();
    if ($item){
    $node = oci_save_global_tags($item->id, '/' . OCI_TAG . '/' . OCI_USER);
    }
    $path = oci_get_the_profile_action();
    bp_core_redirect($path);
    }
    bp_core_load_template( 'oci-contents/profile/my-contents' );
    }

    What my function does above is to listen for stuff being submitted by the ‘my-contents’ form and process it. If the user hasn’t hit ‘Save’ then we are just displaying the form for the first time to the user. At the bottom it drops through and just displays the template ‘my-contents’. Default behavior.

    @burtadsit

    Participant

    @jfcarter, I see you tooling around the forums with your sleeves rolled up answering questions. Way to go!

    In reply to: problem fatal error

    @burtadsit

    Participant

    skysoclear, you’d be better off starting a new topic with your issue. This is a 3 mo old thread and just saying “I have the same problem” without any particulars like what you were doing, what version bp, wpmu etc.. will just get you ignored.

    Closing the thread.

    @burtadsit

    Participant

    The widgets you are talking about are not designed to be called from a template. They just don’t work very well for that situation. Perhaps you’d like to investigate the bp custom loops that use template tags. These are designed to be used in templates : https://codex.buddypress.org/developer-docs/custom-buddypress-loops/

    @burtadsit

    Participant

    What you are talking about is a custom component. See : https://codex.buddypress.org/how-to-guides/creating-a-custom-buddypress-component/

    @burtadsit

    Participant

    Tell you the truth Michael I don’t hear about others having this problem. It has to be something specific to your install.

    @burtadsit

    Participant

    This stuff works just fine people. Do you have that plugin in my-plugins as well as bb-plugins? It’s trying to run twice for some reason.

    @burtadsit

    Participant

    You can get rid of the error by calling that like: bp_core_widget_whos_online(array()); but it doesn’t pay any attention to args being passed when it comes to number of user to display. You’ll have to fire up the widget for each blog, set the max users, deactivate the widget to not display it. This widget was not designed to be used in this way.

    You’d be better off creating a mini template for this purpose.

    https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-site-members-loop/ with ‘type=online’.

    @burtadsit

    Participant

    Is that the standard recent posts widget being displayed or is it a template?

    @burtadsit

    Participant

    I’m gonna write a post that talks about simulating wp’s category system next with bpc. The layout for the tree would look something like this:

    root

    — group

    —- ‘authorized user’ created category 1


    end user tag 1


    end user tag 2

    —- ‘authorized user’ created category 2


    end user tag 1


    end user tag 2

    So that groups are first labeled with a category, perhaps at group creation time and all group tags go into a default category for the group. Depending on the type of group.

    It would help in the situation where, like now, you have a zillion group tags of different types mixed in together. Sites could ‘categorize’ groups and then allow tagging of the groups by group admins within the group category.

    group

    — dogs

    —- dog breed tags

    — cats

    —- cat breed tags

    — fish

    —- fish breed tags

    Do fish have breeds? :)

    The advantage to the end user is they could pick a category first and the tag cloud would reflect only that categories tags.

    @burtadsit

    Participant

    Do the posts that are wrong come from the same blog? Does that blog have a different permalink structure than the other blogs?

    @burtadsit

    Participant

    Are these post with the wrong links all scheduled posts. Future posts? What is similar about each of the wrong posts? There has to be a similarity between all the posts with wrong links. Find the similarity and we can track down the problem. Without being able to reproduce it, there is no way to help.

    @burtadsit

    Participant

    I noticed that the articles you are referring to are all about 3 months old. The article ‘

    Vogelhaus’ is a current article and seems to have the proper slug for the title. I don’t know how to tell if the slugs are right or not. People can change the title of a blog post and the slug will can remain the same.

    How do I tell if the links are wrong?

    I recently just recreated my site and didn’t want all the old ‘recent blog posts’ on the site anymore except some selected ones. I just wiped the recent posts table and the recent comments tables. For the post I wanted to be ‘recent’ again I pulled them up and saved them. That triggers an entry in the recent blog posts table. If you’ve got some trash in there then you may have to resort to that method.

    @burtadsit

    Participant

    What are you trying to get from the profile fields? The new user info? All that filter gives you is the text of the message that it’s gonna send out. The user login name is embedded in there but that’s about the only way to get at it. You’d have to parse the text of the msg to get it out.

    @burtadsit

    Participant

    I said I wasn’t going to document the code yet. I will tell you how it works though. :)

    bpc allows any type of content to be organized into a hierarchy. Think of it as a virtual file system implemented with SQL tables and relationships. Each path in the tree can have it’s own set of tags and content items.

    bpc 1.0a1 creates a tree consisting of member, group and blog tags.

    root

    — user

    — group

    — blog

    That’s the tree for bpc 1.0a1. All content, tags or items, are children of the tag ‘root’. Root is invisible to everyone and it’s the only thing allowed at it’s level. All other content is organized as children of ‘root’.

    Below root are the tags ‘user’, ‘group’ and ‘blog’. These tags are invisible to the end users also. When a bp member tags their profile they create other tags that are forced to be children of ‘user’.

    root

    — user

    —- cats

    —- dogs

    —- fish

    These tags form the member tag cloud. That cloud template tag looks in the path ‘root/user’ and displays everything it finds there. I’m just going to stop saying ‘root/user’ and use ‘/user’. The root is implied by the first slash. Just like a file system.

    What actually happens further is that an content item representing the user who created the tags ‘cats’, ‘dogs’ and ‘fish’ tags is put in each tag. We wind up with this:

    root

    — user

    —- cats


    item (burt)

    —- dogs


    item (burt)

    —- fish


    item (burt)

    These ‘items’ are content neutral representations of any type of content. In the case of items in /user, all items are derived from the bp user that created the tag. In the case of this tree some people want to be tagged differently and some the same:

    root

    — user

    —- cats


    item (burt)


    item (john)


    item (jeff)

    —- dogs


    item (burt)


    item (john)

    —- fish


    item (burt)

    —- giraffes


    item (jeff)

    —- bears


    item (john)

    When a user creates their own set of individual tags bpc inserts an item for them into an existing tag or creates a new one.

    So we’ve got a tag cloud now. In bpc the links in the tag cloud launch the content specific bp directory. A member tag cloud launches the member directory with a query param like /members?tags=cats

    The member directory has been modified by extending the normal template class that bp uses to pay attention to those $_GET vars if they exist in the url.

    The directory parses the $_GET query vars and determines what tag the user clicked on. In this case the tag was ‘cats’. The directory template class then gets all the items in the path /user/cats. These things it gets back from bpc are not the actual user records we need to display in the directory, they are instances of the class OCI_Item. That neutral representation of the original content.

    We get neutral representations of original content from classes that understand the original content types. They know where they came from and how to convert them to OCI_Items. Each content type that wants to store info in bpc has to have one of these conversion classes. In the case of bp members the class is called OCI_Item_User and it is a derived class of OCI_Item.

    It’s defined like: OCI_Item_User extends OCI_Item. You’ll see it in the oci-classes.php file. There’s three like that in there. One each for users, groups and blogs. The purpose of these classes is to convert source content into item format and when the time comes, take the item information and get() the original item back.

    This is the template class for the member directory:

    class OCI_BP_Core_Members_Template extends BP_Core_Members_template.

    When this class is fired up by the user clicking on a tag in the member tag cloud, the directory is launched. The template is run and in the constructor for OCI_BP_Core_Members_Template, it does a bunch of stuff and gets to the following chunk of code (lines 170-188 in oci-classes.php):

    } else if (isset($_GET[$bp->contents->slug])) {

    if (!$path)
    return;

    $tag = $path . '/' . $_GET[$bp->contents->slug];

    $container = new OCI_Container('path=' . $tag);
    $items = $container->get_items();
    foreach ($items as $item){
    $tmp->user_id = $item->item_id;
    $users['users'][] = $tmp;
    unset($tmp);
    }

    $users['total'] = count($users['users']);
    $this->members = $users;
    } else {

    If there are any query vars such as /members/?tags=cats then instantiate an OCI_Container for the path ‘/user/cats’ and get all the items in that tag.

    When the OCI_Item_User creates each member item in a tag it stores the user id in the var $this->item_id. The group version and the blog versions of that class store the group or blog ids in that spot when they create items.

    I took a look at the the bp template class and figured out that it needs an array of the format: array(‘users’ => $users, ‘total’ => $count) to operate properly so that’s what gets built for it in that chunk of code.

    Group and Blog templates use a similar thing. So we just pull out the user ids stored in each item and create an array that bp’s template class is happy with.

    All I had to do to modify the the directories was create a new bp_has_whatever() tempate tag and override the constructor for each template class that bp uses.

    Now we’ve got some modified php templates, classes and a replacement has_whatever() template tag function. It’s a good thing that Andy is filter and action happy because the only other thing to do was to create a filter that tells bp to use our new directories instead of the standard ones.

    // changes the default members dir to this one
    function oci_filter_template_directory_members(){
    return ('oci-contents/directories/members/index');
    }
    add_filter('bp_core_template_directory_members', oci_filter_template_directory_members');

    That function lives in oci-templatetags.php. There’s one for each of the directory types being hijacked.

    @burtadsit

    Participant

    Ya, John’s right. That’s the symptoms of just putting bpmember in /wp-content instead of /wp-content/bp-themes/bpmember during an upgrade. You then have to vist BuddyPress > General Settings and say Save.

    It’s due to the directory ‘bug’ in wpmu 2.7.1.

    @burtadsit

    Participant

    Oh. Before anyone publicly complains, no, there isn’t any pagination included in alpha 1’s directories. I’m totally ignoring it on purpose. All the code is there ready to take advantage of it but I purposely didn’t implement it.

    bpc uses a mechanism called Modifed Pre-Order Tree Traversal (MPTT) that was specifically designed to track tree like structures in SQL tables. I need to find out if that part of the core is working properly. I had no intention of introducing another complexity down at the SQL level right now. As far as I can tell the MPTT implementation is stable.

    I swore I wasn’t gonna document this for programmers yet but I guess it wouldn’t hurt to talk about MPTT now.

    When you look at the properties for a node, in the class OCI_Node, you’ll notice two vars $this->lft and $this->rgt. These are MPTT specfic vars that represent the parent/child relationships of all nodes in the tree. . See these for info about MPTT:

    http://www.sitepoint.com/article/hierarchical-data-database/

    http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

    http://www.dbmsmag.com/9604d06.html

    A simple node insert operation in the tree has a good chance of changing 50% of the lft/rgt values in the entire tree.

    Any sql operation that changes these values must:

    1) lock the table

    2) get the node and it’s valid lft/rgt values

    3) do the operation

    4) unlock the tree

    The only reliable property for a node in the tree is the $this->id which is the record id in the table.

    The boys and girls at wp are investigating MPTT right now for a future version of wp. I can’t wait around until they get to that so I’ve implemented this in bpc. It’s a natural for this kind of project and has many advantages.

Viewing 25 replies - 251 through 275 (of 1,734 total)
Skip to toolbar