Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: diarysub_box 1.00

Author: hillct [Info]

Description:

This box is the subscription link creation code for insertion of the 'subscribe' link to subscribe to users' diaries. In the story_summary block, the call to this box should look like this:

|BOX,diarysub_box,|aid||

This box must also be deployed as it's own op called 'diary', having a page template containing only the text ' |CONTENT| '. The purpose of this OP is to actually perform the subscribe and unsubscribe operations, storing the data used by the diary view of the hotlist_flex(diary) box.

Box Code:

my $op = $S->cgi->param('op');
my $user = $S->cgi->param('user');
my $content;
if($S->{GID} ne 'Anonymous'){
my $subscriptions;
map {$subscriptions->{$_}=1;} split(/,/,$S->pref('diary_sub'));
if($op eq 'diary'){
if(exists $subscriptions->{$user}){
delete $subscriptions->{$user};
}else{$subscriptions->{$user}=1;}
$S->pref('diary_sub',join(',',keys %$subscriptions));
$S->{APACHE}->header_out('location',$S->{REFERER} \|\| "$S->{UI}->{VARS}->{rootdir}/section/Diary");
$S->{APACHE}->header_out('Connection','close');
$S->{APACHE}->status(301); $S->{HEADER_ONLY}=1;
} else{
my $text=($subscriptions->{$ARGS[0]})?'Unsubscribe':'Subscribe';
$content=qq{<font size="2">[</font><a href="|rootdir|/diary/$ARGS[0]"><font size="2">$text</font></a><font size="2">]</font>};
return{content=>$content};
}
}
Announcement and Discussion
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Satanosphere
/* You are not expected to understand this. */

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search