Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is it possible to have custom themes for groups?

  • @fishbowl81

    Participant

    We have a xbox 360, Nintendo Wii, and Sony PS3 groups. We want to be able to have a custom css file for each of these groups. What do people have for ideas to add custom themes? Any thoughts?

    Thanks,

    Brad

Viewing 13 replies - 1 through 13 (of 13 total)
  • @johnjamesjacoby

    Keymaster

    I think this is actually an AWESOME idea, and one I’ve been poking around at in my head for a while.

    Not sure there is a super easy way to incorporate this, but I’d love to see it done!

    @fishbowl81

    Participant

    I hate to take the myspace approach, but could add <style>CSS</style> into the group description.

    @johnjamesjacoby

    Keymaster

    I’d love to actually just have several themes with different .css files and that’s it. Selecting a different theme would keep the same structure, but allow for different styling.

    @burtadsit

    Participant

    I ran across something similar.

    https://wordpress.org/extend/plugins/art-direction/

    Allows ‘per blog post’ custom css. Cool.

    In the case of bp the css gets queued up on a very selective basis. This is from bp-groups-cssjs.php in /mu-plugins/bp-groups:

    function groups_add_structure_css() {

    /* Enqueue the structure CSS file to give basic positional formatting for components */

    wp_enqueue_style( ‘bp-groups-structure’, site_url( MUPLUGINDIR . ‘/bp-groups/css/structure.css’ ) );

    }

    add_action( ‘bp_styles’, ‘groups_add_structure_css’ );

    We got actions too. Hook ‘bp_styles’ and define an override for the defaults. You might have a problem getting it in the sequence properly.

    function my_custom_group_css(){

    // check if the file exists and if it does queue it up

    ‘group-custom-‘ . $bp->groups->slug . ‘.css’

    }

    add_action(‘bp_styles’, ‘my_custom_group_css’, 99);

    @fishbowl81

    Participant

    Here is a very very rough attempt,

    http://gorgeousgamers.com/beta/groups/official-wii-group/home

    as a note, you need to modify kses.php to allow style tags.

    Brad

    @gpo1

    Participant

    @fishbowl81, Not bad attempt but don’t go for the myspace route..How did you get the amazon plugin or lastfm?

    @nicolagreco

    Participant

    if (the group is XBOX) add_action(‘wp_print_styles’, ‘your style hook’)

    i made a good set of functions in bpdev theme to add stylesheet with condition, look here:

    http://trac.bp-dev.org/plugins/browser/trunk/bpdev-theme/bpdev-theme-extra.php

    look line 9:

    function bpdev_theme_register_style( $slug, $name, $callback, $default = 'off', $admin_show = 'on', $condition = true, $priority = 1 ) {

    it means that with this function you will be able to add styles in wordpress/buddypress integrating them in the bpdev admin interface to activate or deactivate them,

    in your example you need a plugin like that called for example my-styles-bpdev.php

    <?php
    /*
    Author: Nicola Greco
    Author URI: http://nicolagreco.com
    */

    require_once( 'bp-core.php' );
    require_once( 'bpdev-core.php' );

    function bpdev_search_css() {

    global $group_obj;

    bpdev_theme_register_style(
    'my-styles', // your style slug name
    'XBOX Styles', // your style name
    'xbox_styles_function', // callback
    'on', // status "on" on default
    'off', // off will not display it in admin interface
    $group_obj->id = 1; // the group ID
    );

    }

    function xbox_styles_function() { // example of css content
    ?>
    #header {
    background: #FFF;
    }
    <?php
    }

    add_action( 'bpdev_theme_extra_setup_globals', 'bpdev_search_css' ); // it will add the style

    ?>

    @apeatling

    Keymaster

    If you look in the table wp_bp_groups_groupmeta you will see that every group has a theme and stylesheet applied to it. This corresponds with the member theme used to display the group.

    I can’t remember if I use the table to load the theme at the moment, but it should make it easy to have multiple themes that you can then pick for each group.

    @nicolagreco

    Participant

    ops stupid error

    <?php

    /*

    Author: Nicola Greco

    Author URI: http://nicolagreco.com

    */

    require_once( ‘bp-core.php’ );

    require_once( ‘bpdev-core.php’ );

    function bpdev_search_css() {

    global $group_obj;

    bpdev_theme_register_style(

    ‘my-styles’, // your style slug name

    ‘XBOX Styles’, // your style name

    ‘xbox_styles_function’, // callback

    ‘on’, // status “on” on default

    ‘off’, // off will not display it in admin interface

    ( $groups_obj->id == 1 ) ? ( true ) : ( false ); // the group ID

    );

    }

    function xbox_styles_function() { // example of css content

    ?>

    #header {

    background: #FFF;

    }

    <?php

    }

    add_action( ‘bpdev_theme_extra_setup_globals’, ‘bpdev_search_css’ ); // it will add the style

    ?>

    @johnjamesjacoby

    Keymaster

    Ah I love it when a plan comes together. Woop woop!

    @fishbowl81

    Participant

    The reason for going the myspace route, it allows members to generate themes, and not requiring me to upload css files.

    I will take a look at these other options, but this might be a good starting route to allow members to adjust their own group look and feel.

    @nicolagreco

    Participant

    Cool idea,

    this week i’ll commit bpdev extra groups,

    so groups could have extra field and if you want do that you need add meta for theme like

    Add new field for theme:

    Theme : – 1 white theme

    – 1 black theme

    and after do that

    bpdev_theme_register_style(
    'my-styles', // your style slug name
    'XBOX Styles', // your style name
    "xbox_color{$color}", // callback
    'on', // status "on" on default
    'off', // off will not display it in admin interface
    ( bpdev_get_groupmeta($groups_obj->id, 'color' ) == $color ) ? ( true ) : ( false ); // the group ID
    );

    wait less than a week to do that

    @darfuria

    Participant

    Is there any update on this? Do we have any functionality for users being able to have their own profile themes?

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Is it possible to have custom themes for groups?’ is closed to new replies.
Skip to toolbar