[dw-free] integrate payment system with console/finduser
[commit: http://hg.dwscoalition.org/dw-free/rev/5f0f1648285b]
http://bugs.dwscoalition.org/show_bug.cgi?id=1213
Add paid account information to finduser.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1213
Add paid account information to finduser.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- cgi-bin/DW/Hooks/Display.pm
- cgi-bin/LJ/Console/Command/Finduser.pm
-------------------------------------------------------------------------------- diff -r 62a215f0f9de -r 5f0f1648285b cgi-bin/DW/Hooks/Display.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/DW/Hooks/Display.pm Mon Jul 13 02:24:12 2009 +0000 @@ -0,0 +1,42 @@ +#!/usr/bin/perl +# +# DW::Hooks::Display +# +# A file for miscellaneous display-related hooks. +# +# Authors: +# Denise Paolucci <denise@dreamwidth.org> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package DW::Hooks::Display; + +# Displays extra info on finduser results. Called as: +# LJ::run_hooks("finduser_extrainfo", $u }) +# Currently used to return paid status, expiration date, and number of +# unused invite codes. + +LJ::register_hook( 'finduser_extrainfo', sub { + my $u = shift; + + my $ret; + + my $paidstatus = DW::Pay::get_paid_status( $u ); + my $numinvites = DW::InviteCodes->unused_count( userid => $u->id ); + + if ( $paidstatus ) { + $ret .= " " . DW::Pay::type_name( $paidstatus->{typeid} ) . ", expiring " . LJ::mysql_time( $paidstatus->{expiretime} ) . "\n"; + } + + if ( $numinvites ) { + $ret .= " Unused invites: " . $numinvites . "\n"; + } + +}); + +1; diff -r 62a215f0f9de -r 5f0f1648285b cgi-bin/LJ/Console/Command/Finduser.pm --- a/cgi-bin/LJ/Console/Command/Finduser.pm Mon Jul 13 01:09:32 2009 +0000 +++ b/cgi-bin/LJ/Console/Command/Finduser.pm Mon Jul 13 02:24:12 2009 +0000 @@ -100,7 +100,7 @@ sub execute { $self->info(" Last updated: " . ($timeupdate->{$userid} ? LJ::time_to_http($timeupdate->{$userid}) : "Never")) if $opt eq 'timeupdate'; - foreach (LJ::run_hooks("finduser_extrainfo", { 'dbh' => $dbh, 'u' => $u })) { + foreach (LJ::run_hooks("finduser_extrainfo", $u)) { next unless $_->[0]; $self->info($_) foreach (split(/\n/, $_->[0])); } --------------------------------------------------------------------------------