WordPress.org

Ready to get started?Download WordPress

Forums

BP My Home
BP My Home as my home page by default, without no option (9 posts)

  1. juanpons14
    Member
    Posted 3 years ago #

    Hello again! I want to make My Home as Home Page of my registred user by default without giving they any option to change it.

    Is that possible?

    Thank again, very nice plugin, thank for your development!

  2. imath
    Member
    Plugin Author

    Posted 3 years ago #

    It's possible.

    1/ in /wp-content/plugins/bp-my-home/bp-my-home.php
    replace :

    $home_page = get_user_meta($bp->loggedin_user->id, 'bpmh_user_home_page',true);
    if($home_page=="yes") wp_redirect( $bp->loggedin_user->domain .'my-home');

    by :
    if(!current_user_can('manage_options')) wp_redirect( $bp->loggedin_user->domain .'my-home');
    this way the admin will not be concerned by the redirection

    2/ In the functions.php of your active theme, add this code in order to hide the checkbox in my-settings page :

    function hide_bp_my_home_set_as_home(){
      global $bp;
      if($bp->current_action == 'my-settings'){
      ?>
      <script type="text/javascript">
        jQuery("#user_home_page").parents("tr").hide();
      </script>
      <?php
      }
    }
    
    add_action('wp_footer','hide_bp_my_home_set_as_home');

    Bye.

  3. juanpons14
    Member
    Posted 3 years ago #

    Don't work!

    I think you miss the topic of set the chekbox checked by default

  4. imath
    Member
    Plugin Author

    Posted 3 years ago #

    Hello juanpons14,

    Have you tried with a user that is not an admin ?

    If so check your php error log to see if you have a warning "headers allredy sent". If it's the case, you'll need to check if you have extra space in your template files for example sometimes when you use a page as the home page of the website instead of the list of posts, the page template looks like this :

    <?php
    /*
    Template Name: Home
    */
    ?>
    
    <?php get_header(); ?>

    then make it looks like this :

    <?php
    /*
    Template Name: Accueil
    */
    get_header(); ?>

    Have a nice day.

  5. juanpons14
    Member
    Posted 3 years ago #

    Uo! I forget try with a normal user! Works fine sorry!

  6. juanpons14
    Member
    Posted 3 years ago #

    Now there is another bug or maybe is my website.
    This don't work fine: BP My Home is now the default component of the 'siteurl/members/user' area

    If i go to mi member area /mebmer/user BP my home isn't default it's activity

  7. imath
    Member
    Plugin Author

    Posted 3 years ago #

    Well it was causing the bug you mentioned me so i deactivated this function in version 1.2.1.

    Yesterday night i found a way to do it without causing a bug. I need to check if it's not causing other bugs before adding a new version soon.

  8. juanpons14
    Member
    Posted 3 years ago #

    Okey! No problem, i suggest you to delete the feature from the WordPress Page plugin until you put it again.!

    Wating for a new realease with this feature! Thank you!

  9. imath
    Member
    Plugin Author

    Posted 3 years ago #

    well, that's what i've done in the changelog actually
    http://wordpress.org/extend/plugins/bp-my-home/changelog/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic