Skip to:
Content
Pages
Categories
Search
Top
Bottom

Manually Insert Bookmarking to Specific Blogs

  • Avatar of Nm
    nm
    Participant

    @nahummadrid

    Is there a way to designate what blogs to exclude/include where there book marks appear? I’d like to do same with bookmarks in the template that i do with the feeds template tag.

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

    @imath

    Well, from my point of view, using a template tag to activate the bookmark link in secondary blogs can be annoying because you have to be aware of the theme used by the member and add it on each blog.. That’s why i choosed to filter `the_content()`.

    But you gave me an idea for a next upgrade.. What you can do is to replace the function `bpmh_bkmks_add_in_content($content)` in `/wp-content/bp-my-home/includes/bp-my-home-auto-bkmk.php` (on line 72) with this new one :
    `function bpmh_bkmks_add_in_content($content) {
    global $blog_id;
    $blog_ids_to_exclude = array(2,3);
    if(!in_array($blog_id, $blog_ids_to_exclude)){
    if((is_single() || (bp_is_blog_page() && is_page())) && !is_front_page() && is_user_logged_in()){
    global $post, $bp, $the_active_widgets;
    $bp_my_home_url = $bp->loggedin_user->domain. BP_MYHOME_SLUG .’/’;
    $getuser_bkmks = get_user_meta($bp->loggedin_user->id, ‘bpmh_bkmks_list’,true);
    if(bpmh_in_array(‘bpmh-bkmks’, $the_active_widgets)==1){
    if(bpmh_in_array(get_permalink($post->ID), $getuser_bkmks, ‘user-saved’)==1){
    $content = ‘<div id=”bpmh-bkmk-auto”><a href=”‘.$bp_my_home_url.’” class=”fav_ok”>’.__(“Bookmark Added”,”bp-my-home”).’</a></div>’.$content;
    }else{
    $content= ‘<div id=”bpmh-bkmk-auto”><a href=”javascript:bpmh_add_widget_bkmk(”.get_the_title($post->ID).”,”.get_permalink($post->ID).”)” class=”to_fav”>’.__(“Add to My Bookmarks widget”,”bp-my-home”).’</a></div>’.$content;
    }
    }
    }
    }
    return $content;
    }`

    Then you simply have to replace the content of the array `$blog_ids_to_exclude = array(2,3);` by the blog ids you want to exclude.

    Avatar of Nm
    nm
    Participant

    @nahummadrid

    I see. I only use one theme for all user blogs for most of my projects but even if I were to add more themes it should be simple enough to add the template tag to each theme no? either way, thanks for the snippet.

    if i’m using a child theme, will this new function overwrite the old one if i were to put it in the functions.php or bp-custom? or do you mean i have to edit the plugin file?

    Avatar of imath
    imath
    Moderator

    @imath

    i’m afraid you have to edit the plugin file :(

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

You must be logged in to reply to this topic.