Example #1
0
function _edit_collection_link($photo)
{
    global $cbphoto;
    if ($cbphoto->collection->is_collection_owner($photo['collection_id'])) {
        return collection_links($photo['collection_id'], 'edit_collection');
    }
    return false;
}
/**
 * This function get photo details, setups an array for content.
 * This also serves as an example on how to use custom callback
 * for subscription type
 * 
 * @author Fawaz Tahir <*****@*****.**>
 * @param type $id
 * @return array|boolean
 */
function get_subscription_photo($id)
{
    global $cbphoto, $userquery;
    $photo = $cbphoto->get_photo($id, true);
    if ($photo) {
        $fields = array('photo_description', 'photo_tags', 'collection_id', 'collection_name', 'views', 'file_directory', 'server_url', 'broadcast', 'date_added');
        $fields = get_photo_fields($fields);
        foreach ($fields as $field) {
            if ($field == 'photo_details') {
                continue;
            }
            $details[$field] = $photo[$field];
        }
        $details['title'] = $photo['photo_title'];
        $details['description'] = $photo['photo_descritpion'];
        $details['tags'] = tags($photo['photo_tags'], "photos");
        $details['heading'] = sprintf(lang('<a href="%s">%s</a> added a new photo in <a href="%s">%s</a>'), $userquery->profile_link($photo), name($photo), collection_links($photo), $photo['collection_name']);
        $details['link'] = view_photo_link($photo);
        $details['thumb'] = get_image_url($photo, 'm');
        return $details;
    }
    return false;
}