Functions needed for plugins
What functions aren't in the API that are needed to write plugins? This topic is for people who are trying to write plugins but (think they) need some functionality. (That is, those of us with check-in privileges can just add stuff to
TWiki::Func.)
--
Contributors: MeredithLesly
Discussion
To programmatically set the html page name/title based on the heading from within a plugin, I need a function to set a preferences variable (in this case
PAGETITLE) which is than accessible e.g. from a template. Please see for reference
TopicDisplayName discussion from 31 Mar 2006.
--
TobiasRoeser - 25 Apr 2006
FindElsewherePlugin bypasses current API to use
takeOutBlocks /
putBackBlocks.
--
SteffenPoulsen - 25 Apr 2006
Yes; I did that to simplify the plugin and eliminate duplication in handling
noautolink blocks.
You are right, they ought to be in the API.
--
CrawfordCurrie - 26 Apr 2006
MoreFuncContrib is in svn, btw. I created it eons ago (or so it seems) as a place to put functions that ought to go into the next version of
TWiki::Func.
--
MeredithLesly - 01 Jun 2006
I would like a function that gets a list of registered users in an array. In my plugin at the moment, I am getting the list of users by doing the following (stolen from tools/upgrade_emails.pl):
sub getListOfUsers {
my @users = ();
my $mainWeb = TWiki::Func::getMainWebname();
my (undef, $text) = TWiki::Func::readTopic(
$mainWeb, $TWiki::cfg{UsersTopicName} );
foreach my $line ( split( /\r?\n/, $text )) {
if( $line =~ m/^\s*\* ($TWiki::regex{webNameRegex}\.)?(\w+)\s*(?:-\s*(\S+)\s*)?-\s*\d+ \w+ \d+\s*$/o ) {
my $web = $1 || $mainWeb;
my $wikiName = $2;
if(TWiki::Func::topicExists($web, $wikiName) && $wikiName !~ m/TWiki.*|UnknownUser/){
push(@users, $wikiName);
}
}
}
return (\@users);
}
--
AndrewRJones - 01 Mar 2007
This topic is a bit stale, and overlapping with
MoreApiFunctions. Andrew, for tracking purposes it is better to create a feature request topic for every API enhancement. See also related
ProvideMechanismToSendEmailsToRegisteredUsers.
--
PeterThoeny - 02 Mar 2007
As it happens, it is already going to be available in 4.2 by implementing
MergeFuncUsersContribWithFunc.
--
AndrewRJones - 02 Mar 2007