Skip to:
Content
Pages
Categories
Search
Top
Bottom

Some starting questions!

  • Avatar of Svenl77
    Svenl77
    Participant

    @svenl77

    Hi @boonebgorges,

    great plugin, thanks a lot for all your work. You are the candy man for me Hope buddypress will never lose you.

    Like always after the kind words following the “But …” No, I just started playing around with the plugin and have some questions left.

    I like to know if the Plugin is build on Custom Post Types.
    I tried to access the post type of the plugin in my script, but It looks like you didn’t use custom post types?
    If I print all post types by name, there is nothing to see. Just all my usual post types.

    I wanted to write a script to add some groups to the archives system of wordpress. Or attache group categories with post categories, to have group documents available outside of the group.
    Now I think, I just doing it the wrong way. Anny suggestions? Is it possibe?

    One other question… Is it possible to add meta Boxes to the frontend editor.
    I can see in the backend edit screen all meta boxes added via “add_action(‘edit_form_advanced’, ‘my_post_metabox’);”.
    Is there an add_action available to add custom meta boxes to the front end editor.

    For me it looks like it’s a post in wordpress but also its not accessable as post or as posttype.

    Any help would be great!

    Thanks a lot,

    Svenl

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Glad you’re liking the plugin!

    Yes, the plugin is built using custom post types. As the admin on the main blog, you should see them appear in your Dashboard as BuddyPress Docs. Unless you have changed something, the CPT name is ‘bp_doc’. If you’re not seeing them in your registered list of post types, it could be that you’re calling up the list too soon, before all of the plugins have had a chance to initialize. BuddyPress Docs registers its post types on ‘init’ https://github.com/boonebgorges/buddypress-docs/blob/master/bp-docs.php#L41

    You should be able to access group Docs anywhere in your WP installation by using query_posts() or WP_Query with args like this:
    `$args = array( ‘post_type’ => ‘bp_doc’ );`
    Docs are associated with groups by means of a custom taxonomy called ‘bp_docs_associated_item’. If you want to get docs associated with a certain group, you may need a two-step process. bp_docs_associated_item is two-tiered. It’s a hierarchical taxonomy, where the first level is the item type (currently just ‘groups’ is used, but in the future, ‘users’ and maybe other things will be used as well), and children are numerical group ids. (Side note: it’s built this way because user_ids and group_ids are not mutually unique – there can be a user 50 and a group 50, and it’s important that they are separate. Since WP doesn’t support second-order taxonomies, I had to use hierarchies.)

    Anyway, to get the docs associated with a group with group_id = 12, do something like the following:
    `
    $group_tax_id = term_exists( ‘group’, ‘bp_docs_associated_item’ ); /* This gets the ‘group’ parent taxonomy id */
    $this_group_tax_id = term_exists( 12, ‘bp_docs_associated_item’, $group_tax_id ); /* This gets the taxonomy term id for group 12 */

    /* Now set up the arguments for your WP_Query */
    $args = array(
    ‘post_type’ => ‘bp_doc’,
    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘bp_docs_associated_item’,
    ‘terms’ => $this_group_tax_id,
    ‘slug’ => ‘slug’
    ),
    )
    );
    `

    I haven’t tested this, so there might be a detail or two that is wrong, but it’s essentially how BP Docs itself does the queries.

    As for meta boxes on the front end: essentially, I think the answer is ‘no’. The quasi-meta boxes I have (for tags, parent, etc) are totally custom. However! The styles and javascript that make them all slide-y and pretty are totally abstract, so if you build something with the same markup format (‘toggleable’, ‘toggle-switch’, ‘toggle-content’) you can add your own, and then hook into the Save routine at ‘bp_docs_doc_saved’.

    Good luck!

    Avatar of Svenl77
    Svenl77
    Participant

    @svenl77

    Hi @boonebgorges,

    thanks a lot for the great help, this answer is exactly what I was looking for and makes my Monday morning sweet ;-)

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Awesome! Let me know how it goes.

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

You must be logged in to reply to this topic.