Skip to:
Content
Pages
Categories
Search
Top
Bottom

where is the link to MyHome in front end

  • Hi, I just installed this cool plugin but I dont see a link to myhome page anywhere in the front-end. Do I have to make a link in the menu or something? If so, what would the address be to MyHome page.

    Another question, can I add any widgets alread made for wordpress or they have to be made specially for Bp My Home?

    edit: ok, I found the link in the user’s profile page. What if I want to add the link to only registered users in a custom menu??

Viewing 13 replies - 1 through 13 (of 13 total)
  • Avatar of imath
    imath
    Moderator

    @imath

    Hi @gixty,

    first of all, thks for your interest in this plugin.

    Then if you want to add a link to the “my home” page of a logged in user elsewhere than in the members directory you can use this code :
    `<?php if ( is_user_logged_in() ) : ?>
    <a href=”<?php echo bp_loggedin_user_domain() ?>my-home/”>My Home</a>
    <?php endif;?>`

    About widgets, i didn’t make this plugin to display WordPress sidebar widgets. I don’t know about sidebar widgets that are customized by user data. So my first reply would be : widgets have to be made specially for BP My Home. That’s why i added the bpmh-example widget to help people build their own.

    But you can actually add WordPress sidebar widgets. To do so, you have to register a new sidebar in the functions.php file of the main blog theme :
    `register_sidebars( 1,
    array(
    ‘name’ => ‘imath-bpmh-first’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3 class=”widgettitle”>’,
    ‘after_title’ => ‘</h3>’
    )
    );`

    Then you can use the bpmh-example widget to display it. To do so edit the wp-content/plugins/bp-my-home/widgets/bpmh-example/bpmh-example.php file. On line 54 replace this content :
    `<div style=”text-align:center;padding:40px”>
    <h5>Hello BP My Home !!</h5>
    </div>`
    By this content :
    `<?php dynamic_sidebar( ‘imath-bpmh-first’ ) ?>`

    Then in your WordPress Backend, go to the Appearance / Widgets menu. You will find a new sidebar area called `imath-bpmh-first` where you can drag WordPress widgets.

    The only trouble is that if you want to have a BP My Home dragbox per WordPress sidebar widget, you’ll have to register as many sidebars as dragboxes and clone the bpmh-example widget for each sidebars (changing name of directory, file and functions in the cloned widgets)…

    Again, this is not the goal of this plugin :)

    Avatar of sciencebox.net
    sciencebox.net
    Member

    @scienceboxoxnet

    Hello,

    I was hoping you could help :-)

    I have been playing around with your widgetised home page addition and its a very cool!. So thank you for developing this..
    I was hoping to ask 2 things..

    Firstly, I was hoping to get some guidance as to exactly what directory, file, and functions need to be edited to allow additional widgetised boxes to appear ( and on what lines)

    Secondly, I was going to mention that although you did not develop this plugin to be used as a way of adding drag and drop functionality to existing plugins.. that would be a really really cool thing to do.. I think the future of all web apps will be to allow customization, as on a desktop application.

    A great idea for added functionality would be to intelligently populate widgets when a new user signs up, based on their individual preferences at sign up.. They would of course be able to change this if they were not happy..

    This is probably quite a big development ask.. :-)

    Anyway.. well done .. really really cool work. and I look forward to the next updates..

    ps.I am using chrome and it keeps telling my annoying error messages when a box is not ‘dropped’ coprrectly. I would like to disable this for visitors .. any ideas?

    Thanks again,

    Avatar of imath
    imath
    Moderator

    @imath

    Hello @scienceboxonet,

    First, you’re welcome ;)

    Then to add a new widget : you should find some answers here http://buddypress.org/community/groups/bp-my-home/forum/topic/short-code-to-call-my-widgets-nav/#post-79429

    Once you developed your widget, you simply have to log in as admin and in the WordPress Backend go to the BuddyPress submenu called BPMH Manager and activate the widget.

    I think you’re right about the user experience.

    For the signup procedure, it’s a bit complex because the user needs to confirm a registration…

    If you wan to remove the alert message you can put it away by removing the line 277 in file `wp-content/plugins/bp-my-home/includes/bp-my-home-core.php` or you can comment the line this way :
    `//else _e(‘Oops, something went wrong !’,’bp-my-home’);`

    Have a nice time :)

    Avatar of sciencebox.net
    sciencebox.net
    Member

    @scienceboxoxnet

    Hello,

    Thanks for the help. This is really useful. Regarding the last point, when I remove or comment out line 277 the text within the error box disappears, but the error box remains. Ideally I would like to completely remove the error box from appearing..i.e override or ignore the error.

    Cheers,

    Avatar of imath
    imath
    Moderator

    @imath

    @scienceboxnet,

    Hi and sorry, i replied too quickly without really giving you a way to remove the alert :(

    To completely remove it you simply have to delete line 72 of `bp-my-home/js/bp-my-home.js` or comment it :
    `// if(response!=”ok”) alert(response);`

    Avatar of sciencebox.net
    sciencebox.net
    Member

    @scienceboxoxnet

    HI iMath,

    Thanks for your help! Its now perfect. I spent some time trying to get additional widgets included. I managed to modify the ‘example’ widget but have not managed to create a new widget. I copied all the example code, changed the names of all the functions, links etc, inserted a new function to initiate a widegt in the sidebar.. but when I drop the widegte I want into the sidebar, it does not appear on the My Home front end. I checked the code many times. I enabled the plugion on the back end as well… It just does not show up.

    Any ideas? Perhaps there is another file that may need modifying as well?

    Thanks again for your help!

    Avatar of imath
    imath
    Moderator

    @imath

    May be the function prefix in header comments of the widget.. I’ve wrote a post on my blog lately, it’s in french but may be it can help you : http://imath.owni.fr/2011/01/16/bp-my-home-tricks/

    Avatar of sciencebox.net
    sciencebox.net
    Member

    @scienceboxoxnet

    Hi iMath.

    Got this sorted now. I was trying to change the paths to the Constant variables as well. I didn’t understand we were cloning the My example widget.
    Thanks alot.

    Next question……….. :-) Is there a relatively easy way to make the jquery work for 3 columns? I can do this on a static page.. but would not want to hack your script without some advice.

    Cheers

    Avatar of imath
    imath
    Moderator

    @imath

    Hi sciencebox.net,

    Well, i have no particular advice on this one, because the 2 columns are set in the plugin. The only choice is to edit core file (bp-my-home-core.php) :(

    how can we link to BP My Home from a widget or the wordpress 3 menu system?

    Avatar of imath
    imath
    Moderator

    @imath

    Hi @frizzo,

    As BP My Home only loads if the loggedin user goes to his member area, you first need to make sure that the user is loggedin and then you can add a link this way into your widget.
    `
    <a href="my-home/”>My Home
    `
    Adding a link using WP3 menu system is a bit more complex.. I’ll post about that later.

    Ok, and please do post about the WP3 menu link, I think that is important. Thanks!

    Avatar of imath
    imath
    Moderator

    @imath

    Hi @frizzo,

    You can try this :

    1/ WP Admin > Menus
    In your menu (in this example primary-menu), add a custom link and call it “My Home”

    2/ in the functions.php script of your active theme :
    `add_action( ‘init’, ‘register_my_menu’ );

    function register_my_menu() {
    register_nav_menu( ‘primary-menu’, __( ‘Primary Menu’ ) );
    }

    function imath_my_home_menu(){
    global $bp;
    $menu = wp_nav_menu( array( ‘theme_location’ => ‘primary-menu’, ‘fallback_cb’ => ”, ‘echo’ => ’0′ ) );
    $xml = simplexml_load_string($menu);
    if($xml){
    foreach($xml->ul->li as $items){
    if($items->a == “My Home”){
    // Make sure that the label of the custom link is ‘My Home’
    if(!is_user_logged_in()) $items->addAttribute(‘style’,’display:none’);
    else $items->a->attributes()->href = $bp->loggedin_user->domain.”my-home/”;
    }
    }
    }
    echo $xml->asXML();
    }`

    3/ Then in the template file where you want to display the menu (header.php or sidebar.php for example), simply add this :
    `<?php if(function_exists(‘imath_my_home_menu’)) imath_my_home_menu();?>`

    if the user is logged in, then the link will be displayed, if not the li tag wont be displayed.

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

You must be logged in to reply to this topic.