Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 25 replies - 1 through 25 (of 72 total)

  • shaisimchi
    Participant

    @shaisimchi

    Anyone?


    shaisimchi
    Participant

    @shaisimchi

    and what is the path to this file on your installation?


    shaisimchi
    Participant

    @shaisimchi

    the file default.css doesnt seem to exist in my installation. what version are you using?


    shaisimchi
    Participant

    @shaisimchi

    @hnla your code is truncated too…


    shaisimchi
    Participant

    @shaisimchi

    shaisimchi @gmail.com


    shaisimchi
    Participant

    @shaisimchi

    Can you explain more about your step 2 – i dont see the example code.

    Thanks,

    Shai


    shaisimchi
    Participant

    @shaisimchi

    Sure – Is this the default home page of buddypress or is it a totally custom page?
    if so – how do you ‘tell’ the widget where to be placed or create the place holder for it within the page?

    Thanks,

    Shai


    shaisimchi
    Participant

    @shaisimchi

    Any idea anyone?


    shaisimchi
    Participant

    @shaisimchi

    OK I still need a little help here:

    I am creating custom pages on my site the following way:
    in bp-custom.php I am adding:

    define(‘BP_MYPAGE_SLUG’, ‘mypage’);

    function mypage_page_setup_root_component()
    {
    global $bp;
    bp_core_add_root_component( BP_MYPAGE_SLUG );
    }
    add_action( ‘plugins_loaded’, ‘mypage_page_setup_root_component’, 2 );

    function bp_show_mypage_page() {
    global $bp, $current_blog, $wpdb;

    if ( $bp->current_component == BP_MYPAGE_SLUG && $bp->current_action == ” ) {
    // The first variable here must match the name of your template file below
    bp_core_load_template( ‘mypage’, true );
    }
    }
    add_action( ‘wp’, ‘bp_show_mypage_page’, 2 );

    I am also creating a file called mypage.php inside my theme. this works great and already many custom pages like that.
    What I want is to add the content of a widget (for example activity widget) into this page.

    here is what i did: i created a new sidebar in functions.php lets assume its called mysidebar:

    register_sidebars( 1,
    array(
    ‘name’ => ‘mysidebar’,
    ‘before_widget’ => ‘

    ‘,
    ‘after_widget’ => ‘

    ‘,
    ‘before_title’ => ‘

    ‘,
    ‘after_title’ => ‘


    )
    );

    then within my newly created file called mypage.php i have the following code:
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar(‘mysidebar’) ) : ?>

    <a href="/wp-admin/widgets.php?s=&show=&sidebar=mysidebar”>

    then i added the site activity widget in the admin to the mysidebar that I created.

    So far it all works great. my problem is that when the widget gets added to my custom page mpage.php it pretty much goes all over the page and messes up things like the left hand side navigation menu, options-bar etc.
    even placing it within html table doesnt help as it seems that it is trying to conform to the 3 widget areas I have on other sections of my site (like home page etc).
    How do I control the location of the widget’s content on a custom page like that?

    Help is much appreciated!

    Thanks,

    Shai


    shaisimchi
    Participant

    @shaisimchi

    Hi,

    I have something working which still needs some work.
    where do you want to add your widget to? what kind of page? maybe I can help.

    Thanks,

    Shai


    shaisimchi
    Participant

    @shaisimchi

    finally working!
    same code as before but it turns out the filter didnt work because of modifications i made to wp-login.php
    i reverted some of the change there for the filters to work and now the redirection is working.
    thank you so much for your help!!!

    Shai


    shaisimchi
    Participant

    @shaisimchi

    i tried to append $bp->loggedin_user->id to the url just to see what it is and it is 0 so none of the queries are correct too.
    any reason why it would be 0 and not the right user id if i declaried global $bp etc?


    shaisimchi
    Participant

    @shaisimchi

    yes 1.1.3 and all the fields are blank – i deleted them on the DB


    shaisimchi
    Participant

    @shaisimchi

    @techguy or anyone else – any idea here?


    shaisimchi
    Participant

    @shaisimchi

    put it in bp-sn-parent functions.php – goes to home page


    shaisimchi
    Participant

    @shaisimchi

    i now have this which is your code:

    function my_login_redirect($redirect_to,$redirect_to2,$user) {

    global $bp;

    $city = xprofile_get_field_data(26, $user->ID );
    $state = xprofile_get_field_data(27, $user->ID );
    $country = xprofile_get_field_data(103, $user->ID );
    $zip = xprofile_get_field_data(23, $user->ID );

    if( !empty($city) && !empty($state) && !empty($country) && !empty($zip) )

    return ‘http://athleticrash.com&#8217;;

    else

    return bp_core_get_user_domain($user->ID) . ‘profile/edit/’;

    }

    add_filter(‘login_redirect’,’my_login_redirect’,100,3);

    goes to the home page…


    shaisimchi
    Participant

    @shaisimchi

    I mean what is passed as the $user parameter.
    it seems that the 2 redirect parameters are not in use and the $user – i am not sure how it is passed here.
    I have tried to do something similar (dont worry about the mess now – I just want the redirect to work):
    function my_login_redirect($redirect_to,$redirect_to2,$user_id) {

    global $wpdb,$bp;
    $user_id = $bp->loggedin_user->id;
    $city = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=26” , $user_id ));
    $state = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=27” , $user_id ));
    $country = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=103” , $user_id ));
    $zip = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=23” , $user_id ));
    if (!$city || $city==”)
    $has_city=0;
    else
    $has_city=1;
    if (!$state || $state==”)
    $has_state=0;
    else
    $has_state=1;
    if (!$country || $country==”)
    $has_country=0;
    else
    $has_country=1;
    if (!$zip || $zip==”)
    $has_zip=0;
    else
    $has_zip=1;
    if ($has_city==1 && $has_state==1 && $has_country==1 && $has_zip==1 )
    return ‘http://athleticrash.com&#8217;;
    else
    return bp_core_get_user_domain($user_id) . ‘profile/edit/’;
    }
    add_filter(‘login_redirect’,’my_login_redirect’,100,3);

    this gave the same results – just went to the home page.


    shaisimchi
    Participant

    @shaisimchi

    and what do I put for the $user parameter from within bp-custom.php?


    shaisimchi
    Participant

    @shaisimchi

    same result


    shaisimchi
    Participant

    @shaisimchi

    Made the changes and now it doesnt redirect at all as opposed to before when it did redirect but to the wrong place


    shaisimchi
    Participant

    @shaisimchi

    well yeah – these i know and can fix easily but it still doesnt redirect to the right place for some reason


    shaisimchi
    Participant

    @shaisimchi

    i tried with the new action – same result.

    here is the function:

    function bp_location_redirect_to_page()
    {
    global $bp,$wpdb;

    $redirect_url_has_location = ‘http://athleticrash.com&#8217;;
    $city = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=26” , $bp->loggedin_user->id ));
    $state = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=27” , $bp->loggedin_user->id ));
    $country = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=103” , $bp->loggedin_user->id ));
    $zip = $wpdb->get_var($wpdb->prepare(“SELECT value FROM wp_bp_xprofile_data WHERE user_id=%d AND field_id=23” , $bp->loggedin_user->id ));
    if (!$city || $city==”)
    $has_city=0;
    else
    $has_city=1;

    if (!$state || $state==”)
    $has_state=0;
    else
    $has_state=1;

    if (!$country || $country==”)
    $has_country=0;
    else
    $has_country=1;

    if (!$zip || $zip==”)
    $has_zip=0;
    else
    $has_zip=1;

    $user_link = $bp->loggedin_user->domain;
    $profile_path = ‘profile/edit’;
    $redirect_url_no_location = $user_link . $profile_path;

    if ($has_city==1 && $has_state==1 && $has_country==1 && $has_zip==1 )
    bp_core_redirect($redirect_url_has_location);
    else
    bp_core_redirect($redirect_url_no_location);
    }
    /*Add an action to redirect user after login*/
    add_action(‘login_redirect’,’bp_location_redirect_to_page’,100,0);


    shaisimchi
    Participant

    @shaisimchi

    I am testing and only sending to the profile in certain cases.
    it does seem that the redirection is working when the user logs in but the value is wrong.
    according to what you say it should be like this?
    add_action(‘login_redirect’,’bp_location_redirect_to_page’,100,0);
    ??


    shaisimchi
    Participant

    @shaisimchi

    ok – i was able to get this to work but encountering another issue.
    my redirect url is built as follows: $user_domain = $bp->loggedin_user->domain . “profile/edit”;
    for some reason the redirection is made to the home page url with the addition of “profile/edit” not actually putting the user domain infront of it in the string and then i get page not found.
    any idea why its not giving me the user domain?

    Thanks,

    Shai


    shaisimchi
    Participant

    @shaisimchi

    i even tried sticking one of the redirects at the beginning of the function but it still takes me to the same (home) page.
    how do I make sure this function is actually running during login?
    also where should i put it? i put it under bp-custom.php = should it be in a different file?

Viewing 25 replies - 1 through 25 (of 72 total)
Skip to toolbar