Fixed portfolio for all users?
albertc - March 18, 2007 - 20:46
| Project: | Stock |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi
The module looks very useful. However, I wonder if it would be possible for the admin to set a site-wide portfolio, so all site users get to see the same set of companies. It would also be nice if the sidebar block displayed each quote/symbol in turn, including some graphic (up/down arrow, etc).
I'll be glad to beta test this feature if it's added.
--
Albert

#1
I have the same desire. I don't expect visitors to my blog to actually use the stock module, nor would I even want them to. What I really want it for is just to provide a block that I can use which shows my visitors what stocks I'm invested or interested in. I think that's what "albertc" is saying.
#2
If all you want is to display a block for all users, then create a new module called custom.module,
<?php
function custom_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Portfolio');
return $blocks;
case 'view':
$block['subject'] = t('Portfolio');
if (module_exists('stock')) {
$data = stock_do_quote('short', 'IBM AAPL GOOG');
}
$block['content'] = $data;
return $block;
}
}
?>
Create an custom.info file like this:
name = Customdescription = Customizations for this web site
package = Custom
core = 6.x
Put them all under a new directory sites/all/modules/custom
Enable the module, and then go to admin/build/blocks and place the block where you want it to show.
That should be it.
Other features can be added, arrows, ...etc.
Post them here when you do them.