Exemplo n.º 1
0
/**
 * Perform upgrades for version 0.4
 *
 * @param integer $db_version
 * @return boolean
 */
function bp_links_upgrade_04($db_version)
{
    global $bp, $wpdb;
    // if DB version is 7 or higher, skip this upgrade
    if ($db_version >= 7) {
        return true;
    }
    // populate the new cloud_id column in the links table
    // we are trying to produce a PERMANENT unique hash, it doesn't need to be reproducable
    $sql_cloud = $wpdb->prepare("UPDATE {$bp->links->table_name} SET cloud_id = MD5(CONCAT(%s,id,url,name))", $bp->root_domain);
    if (false === $wpdb->query($sql_cloud)) {
        return false;
    }
    // update the activity table item_id column replacing the link_id with the cloud_id
    $sql_activity = $wpdb->prepare("UPDATE {$bp->links->table_name} AS l, {$bp->activity->table_name} AS a SET a.item_id = l.cloud_id WHERE l.id = a.item_id AND a.component = %s", bp_links_id());
    if (false === $wpdb->query($sql_activity)) {
        return false;
    }
    // success!
    return true;
}
Exemplo n.º 2
0
function bp_get_link_details_form_action()
{
    global $bp;
    if (bp_links_current_link_exists()) {
        $form_action = bp_get_link_admin_form_action();
    } else {
        switch (bp_current_component()) {
            default:
            case bp_links_id():
            case bp_links_slug():
                $form_action = $bp->loggedin_user->domain . bp_links_slug() . '/create';
                break;
        }
    }
    return apply_filters('bp_get_link_details_form_action', $form_action);
}
Exemplo n.º 3
0
 function get_activity_recent_ids_for_user($user_id, $show_hidden = false)
 {
     global $wpdb, $bp;
     // Hide Hidden Items?
     if (!$show_hidden) {
         $hidden_sql = " AND a.hide_sitewide = 0";
     }
     return $wpdb->get_col($wpdb->prepare("SELECT DISTINCT l.cloud_id FROM {$bp->links->table_name} AS l JOIN {$bp->activity->table_name} AS a ON l.cloud_id = a.item_id WHERE l.user_id = %d AND a.component = %s{$hidden_sql} ORDER BY a.date_recorded DESC LIMIT %d", $user_id, bp_links_id(), BP_LINKS_PERSONAL_ACTIVITY_HISTORY));
 }
Exemplo n.º 4
0
/**
 * Return "my links" feed URL on activity home page
 *
 * @param string $feed_url
 * @param string $scope
 * @return string
 */
function bp_links_dtheme_activity_feed_url($feed_url, $scope)
{
    global $bp;
    if (!bp_links_is_activity_enabled() || empty($scope) || $scope != bp_links_id()) {
        return $feed_url;
    }
    return $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/my-links/feed/';
}
echo mysql2date('D, d M Y H:i:s O', bp_activity_get_last_updated(), false);
?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
?>
</generator>
	<language><?php 
echo get_option('rss_language');
?>
</language>
	<?php 
do_action('bp_links_activity_mylinks_feed_head');
?>
	<?php 
if (bp_has_activities('object=' . bp_links_id() . '&max=50&display_comments=threaded')) {
    ?>
		<?php 
    while (bp_activities()) {
        bp_the_activity();
        ?>
			<item>
				<guid><?php 
        bp_activity_thread_permalink();
        ?>
</guid>
				<title><![CDATA[<?php 
        bp_activity_feed_item_title();
        ?>
]]></title>
				<link><?php 
Exemplo n.º 6
0
?>
</pubDate>
	<generator>http://buddypress.org/?v=<?php 
echo BP_VERSION;
?>
</generator>
	<language><?php 
echo get_option('rss_language');
?>
</language>
	<?php 
do_action('bp_links_activity_link_feed_head');
?>

	<?php 
if (bp_has_activities('object=' . bp_links_id() . '&primary_id=' . $bp->links->current_link->cloud_id . '&max=50&display_comments=threaded')) {
    ?>
		<?php 
    while (bp_activities()) {
        bp_the_activity();
        ?>
			<item>
				<guid><?php 
        bp_activity_thread_permalink();
        ?>
</guid>
				<title><![CDATA[<?php 
        bp_activity_feed_item_title();
        ?>
]]></title>
				<link><?php 
Exemplo n.º 7
0
function bp_links_create_component_id()
{
    $component_id = false;
    // check current component
    switch (bp_current_component()) {
        // Are we at domain.org/links/create ???
        case bp_links_id():
        case bp_links_slug():
            if ('create' == bp_current_action()) {
                $component_id = bp_links_id();
            }
            break;
    }
    return apply_filters('bp_links_create_component_id', $component_id);
}